-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimages.ts
More file actions
157 lines (135 loc) · 3.2 KB
/
images.ts
File metadata and controls
157 lines (135 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { buildHeaders } from '../internal/headers';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';
export class Images extends APIResource {
/**
* Pull and convert OCI image
*
* @example
* ```ts
* const image = await client.images.create({
* name: 'docker.io/library/nginx:latest',
* });
* ```
*/
create(body: ImageCreateParams, options?: RequestOptions): APIPromise<Image> {
return this._client.post('/images', { body, ...options });
}
/**
* List images
*
* @example
* ```ts
* const images = await client.images.list();
* ```
*/
list(
query: ImageListParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<ImageListResponse> {
return this._client.get('/images', { query, ...options });
}
/**
* Delete image
*
* @example
* ```ts
* await client.images.delete('name');
* ```
*/
delete(name: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/images/${name}`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Get image details
*
* @example
* ```ts
* const image = await client.images.get('name');
* ```
*/
get(name: string, options?: RequestOptions): APIPromise<Image> {
return this._client.get(path`/images/${name}`, options);
}
}
export interface Image {
/**
* Creation timestamp (RFC3339)
*/
created_at: string;
/**
* Resolved manifest digest
*/
digest: string;
/**
* Normalized OCI image reference (tag or digest)
*/
name: string;
/**
* Build status
*/
status: 'pending' | 'pulling' | 'converting' | 'ready' | 'failed';
/**
* CMD from container metadata
*/
cmd?: Array<string> | null;
/**
* Entrypoint from container metadata
*/
entrypoint?: Array<string> | null;
/**
* Environment variables from container metadata
*/
env?: { [key: string]: string };
/**
* Error message if status is failed
*/
error?: string | null;
/**
* Position in build queue (null if not queued)
*/
queue_position?: number | null;
/**
* Disk size in bytes (null until ready)
*/
size_bytes?: number | null;
/**
* User-defined key-value tags.
*/
tags?: { [key: string]: string };
/**
* Working directory from container metadata
*/
working_dir?: string | null;
}
export type ImageListResponse = Array<Image>;
export interface ImageCreateParams {
/**
* OCI image reference (e.g., docker.io/library/nginx:latest)
*/
name: string;
/**
* User-defined key-value tags.
*/
tags?: { [key: string]: string };
}
export interface ImageListParams {
/**
* Filter images by tag key-value pairs.
*/
tags?: { [key: string]: string };
}
export declare namespace Images {
export {
type Image as Image,
type ImageListResponse as ImageListResponse,
type ImageCreateParams as ImageCreateParams,
type ImageListParams as ImageListParams,
};
}