-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimages.ts
More file actions
143 lines (110 loc) · 3.04 KB
/
images.ts
File metadata and controls
143 lines (110 loc) · 3.04 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
// 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 { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
/**
* Custom machine images for instances.
*/
export class Images extends APIResource {
/**
* > ⚠️ This endpoint is in [public preview](/preview/roadmap).
*
* List images in the specified workspace. Pass `sfc:workspace:sfcompute:public` as
* the workspace to list sfc-provided public images instead.
*/
list(query: ImageListParams, options?: RequestOptions): APIPromise<ImageListResponse> {
return this._client.get('/preview/v2/images', {
query,
defaultBaseURL: 'https://api.sfcompute.com',
...options,
});
}
/**
* > ⚠️ This endpoint is in [public preview](/preview/roadmap).
*
* Retrieve an image by ID. Returns both user-owned and public images.
*/
get(id: string, options?: RequestOptions): APIPromise<ImageGetResponse> {
return this._client.get(path`/preview/v2/images/${id}`, {
defaultBaseURL: 'https://api.sfcompute.com',
...options,
});
}
}
export interface ImageListResponse {
data: Array<ImageListResponse.Data>;
has_more: boolean;
object: 'list';
cursor?: string | null;
}
export namespace ImageListResponse {
export interface Data {
id: string;
/**
* Unix timestamp.
*/
created_at: number;
name: string;
object: 'image';
owner: string;
/**
* A resource path for a image resource. Format:
* sfc:image:<account>:<workspace>:<name>.
*/
resource_path: string;
upload_status: 'started' | 'uploading' | 'completed' | 'failed' | 'revoked';
workspace: string;
provider?: string | null;
sha256?: string | null;
}
}
export interface ImageGetResponse {
id: string;
/**
* Unix timestamp.
*/
created_at: number;
name: string;
object: 'image';
owner: string;
/**
* A resource path for a image resource. Format:
* sfc:image:<account>:<workspace>:<name>.
*/
resource_path: string;
upload_status: 'started' | 'uploading' | 'completed' | 'failed' | 'revoked';
workspace: string;
provider?: string | null;
sha256?: string | null;
}
export interface ImageListParams {
/**
* Filter by workspace. Pass `sfc:workspace:sfcompute:public` to list sfc-provided
* public images.
*/
workspace: string;
/**
* Filter by image ID (repeatable).
*/
id?: Array<string>;
/**
* Cursor for backward pagination.
*/
ending_before?: string;
/**
* Maximum number of results to return (1-200, default 50).
*/
limit?: number;
/**
* Cursor for forward pagination (from a previous response's `cursor` field).
*/
starting_after?: string;
}
export declare namespace Images {
export {
type ImageListResponse as ImageListResponse,
type ImageGetResponse as ImageGetResponse,
type ImageListParams as ImageListParams,
};
}