@origincloud/compute 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +24 -2
  3. package/dist/longrunning/v1beta1/index.d.ts +2 -0
  4. package/dist/longrunning/v1beta1/index.d.ts.map +1 -0
  5. package/dist/longrunning/v1beta1/index.js +3 -0
  6. package/dist/longrunning/v1beta1/index.js.map +1 -0
  7. package/dist/longrunning/v1beta1/operations.d.ts +63 -0
  8. package/dist/longrunning/v1beta1/operations.d.ts.map +1 -0
  9. package/dist/longrunning/v1beta1/operations.js +54 -0
  10. package/dist/longrunning/v1beta1/operations.js.map +1 -0
  11. package/dist/v1beta1/catalog.d.ts +146 -0
  12. package/dist/v1beta1/catalog.d.ts.map +1 -0
  13. package/dist/v1beta1/catalog.js +86 -0
  14. package/dist/v1beta1/catalog.js.map +1 -0
  15. package/dist/v1beta1/image.d.ts +172 -0
  16. package/dist/v1beta1/image.d.ts.map +1 -0
  17. package/dist/v1beta1/image.js +115 -0
  18. package/dist/v1beta1/image.js.map +1 -0
  19. package/dist/v1beta1/index.d.ts +7 -0
  20. package/dist/v1beta1/index.d.ts.map +1 -0
  21. package/dist/v1beta1/index.js +8 -0
  22. package/dist/v1beta1/index.js.map +1 -0
  23. package/dist/v1beta1/instance.d.ts +398 -0
  24. package/dist/v1beta1/instance.d.ts.map +1 -0
  25. package/dist/v1beta1/instance.js +253 -0
  26. package/dist/v1beta1/instance.js.map +1 -0
  27. package/dist/v1beta1/key_pair.d.ts +126 -0
  28. package/dist/v1beta1/key_pair.d.ts.map +1 -0
  29. package/dist/v1beta1/key_pair.js +95 -0
  30. package/dist/v1beta1/key_pair.js.map +1 -0
  31. package/dist/v1beta1/public_image.d.ts +94 -0
  32. package/dist/v1beta1/public_image.d.ts.map +1 -0
  33. package/dist/v1beta1/public_image.js +56 -0
  34. package/dist/v1beta1/public_image.js.map +1 -0
  35. package/dist/v1beta1/volume_attachment.d.ts +156 -0
  36. package/dist/v1beta1/volume_attachment.d.ts.map +1 -0
  37. package/dist/v1beta1/volume_attachment.js +125 -0
  38. package/dist/v1beta1/volume_attachment.js.map +1 -0
  39. package/package.json +40 -4
  40. package/src/longrunning/v1beta1/index.ts +3 -0
  41. package/src/longrunning/v1beta1/operations.ts +103 -0
  42. package/src/v1beta1/catalog.ts +208 -0
  43. package/src/v1beta1/image.ts +269 -0
  44. package/src/v1beta1/index.ts +8 -0
  45. package/src/v1beta1/instance.ts +541 -0
  46. package/src/v1beta1/key_pair.ts +216 -0
  47. package/src/v1beta1/public_image.ts +137 -0
  48. package/src/v1beta1/volume_attachment.ts +241 -0
@@ -0,0 +1,269 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/compute/v1beta1/image.proto
3
+
4
+ import {
5
+ type CallOptions,
6
+ type Client,
7
+ type Empty,
8
+ type Service,
9
+ newRequestId,
10
+ pathValue,
11
+ query,
12
+ } from "@origincloud/core";
13
+
14
+ /**
15
+ * Calls ImageService.
16
+ *
17
+ * Images: what an instance's boot volume is created from, in one zone. A
18
+ * project creates its own from protected snapshots in the zone; the
19
+ * platform's public images are in `PublicImageService`.
20
+ */
21
+ export class ImageClient {
22
+ /**
23
+ * The endpoint the client sends its calls to, which also serves the
24
+ * operations its methods answer with.
25
+ */
26
+ readonly service: Service;
27
+
28
+ /** A client of ImageService that sends its calls through `client`. */
29
+ constructor(client: Client) {
30
+ this.service = client.service("compute", true);
31
+ }
32
+
33
+ /** Returns one of the project's own images. */
34
+ async getImage(request: GetImageRequest, options?: CallOptions): Promise<Image> {
35
+ const p0 = pathValue("name", request.name, "projects/*/zones/*/images/*");
36
+ return this.service.call<Image>(
37
+ {
38
+ method: "GET",
39
+ path: `/v1beta1/${p0}`,
40
+ query: query(request, ["name"]),
41
+ idempotent: true,
42
+ },
43
+ options,
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Lists the project's own images in a zone, oldest first. The public
49
+ * images are listed by `ListPublicImages`.
50
+ */
51
+ async listImages(request: ListImagesRequest, options?: CallOptions): Promise<ListImagesResponse> {
52
+ const p0 = pathValue("parent", request.parent, "projects/*/zones/*");
53
+ return this.service.call<ListImagesResponse>(
54
+ {
55
+ method: "GET",
56
+ path: `/v1beta1/${p0}/images`,
57
+ query: query(request, ["parent"]),
58
+ idempotent: true,
59
+ },
60
+ options,
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Iterates over everything listImages lists from the request's page on,
66
+ * fetching the next page as the loop reaches it. A page that fails ends
67
+ * the iteration with its error.
68
+ */
69
+ async *allImages(request: ListImagesRequest, options?: CallOptions): AsyncGenerator<Image, void, undefined> {
70
+ for (let page = request; ; ) {
71
+ const response = await this.listImages(page, options);
72
+ yield* response.images ?? [];
73
+ if (!response.nextPageToken) return;
74
+ page = { ...page, pageToken: response.nextPageToken };
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Creates an image from the project's protected snapshots in the zone.
80
+ * The snapshots can't be unprotected while the image exists.
81
+ */
82
+ async createImage(request: CreateImageRequest, options?: CallOptions): Promise<Image> {
83
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
84
+ const p0 = pathValue("parent", request.parent, "projects/*/zones/*");
85
+ return this.service.call<Image>(
86
+ {
87
+ method: "POST",
88
+ path: `/v1beta1/${p0}/images`,
89
+ body: request.image,
90
+ query: query(request, ["parent", "image"]),
91
+ idempotent: true,
92
+ },
93
+ options,
94
+ );
95
+ }
96
+
97
+ /** Changes an image's description or tags. */
98
+ async updateImage(request: UpdateImageRequest, options?: CallOptions): Promise<Image> {
99
+ const p0 = pathValue("image.name", request.image?.name, "projects/*/zones/*/images/*");
100
+ return this.service.call<Image>(
101
+ {
102
+ method: "PATCH",
103
+ path: `/v1beta1/${p0}`,
104
+ body: request.image,
105
+ query: query(request, ["image.name", "image"]),
106
+ },
107
+ options,
108
+ );
109
+ }
110
+
111
+ /** Deletes an image. Instances launched from it are unaffected. */
112
+ async deleteImage(request: DeleteImageRequest, options?: CallOptions): Promise<Empty> {
113
+ const p0 = pathValue("name", request.name, "projects/*/zones/*/images/*");
114
+ return this.service.call<Empty>(
115
+ {
116
+ method: "DELETE",
117
+ path: `/v1beta1/${p0}`,
118
+ query: query(request, ["name"]),
119
+ },
120
+ options,
121
+ );
122
+ }
123
+ }
124
+
125
+ /**
126
+ * A project's own image, which an instance's boot volume can be created
127
+ * from.
128
+ */
129
+ export interface Image {
130
+ /** The image's resource name. */
131
+ name?: string;
132
+ /** The image's URN, the identifier access policies and the audit log use. */
133
+ urn?: string;
134
+ /** What the image holds, as you describe it. */
135
+ description?: string;
136
+ /**
137
+ * The account an instance launched from the image logs in as, unless the
138
+ * launch names another: a POSIX user name of at most 32 lowercase
139
+ * letters, digits, underscores and hyphens, starting with a letter or an
140
+ * underscore, and not `root`. `cloud` when left empty.
141
+ */
142
+ defaultUser?: string;
143
+ /**
144
+ * The device name of the disk the image boots from: one of the
145
+ * `blockDevices`' `device`.
146
+ */
147
+ rootDevice?: string;
148
+ /** The image's disks, each created for an instance launched from it. */
149
+ blockDevices?: ImageBlockDevice[];
150
+ /** The CPU architecture it boots on. */
151
+ architecture?: Image_Architecture;
152
+ /** Its operating system family. */
153
+ platform?: Image_Platform;
154
+ /** Where it is in its lifecycle. */
155
+ state?: Image_State;
156
+ /** The principal that created the image, such as `user:<id>`. */
157
+ creator?: string;
158
+ /**
159
+ * Labels of your own, at most 50. The `origin:name` tag is the name the
160
+ * console shows.
161
+ */
162
+ tags?: Record<string, string>;
163
+ }
164
+
165
+ /** The CPU architecture an image boots on. */
166
+ export const Image_Architecture = {
167
+ /** Not set. */
168
+ ARCHITECTURE_UNSPECIFIED: "ARCHITECTURE_UNSPECIFIED",
169
+ /** 64-bit x86. */
170
+ X86_64: "X86_64",
171
+ } as const;
172
+
173
+ /** The CPU architecture an image boots on. */
174
+ export type Image_Architecture = (typeof Image_Architecture)[keyof typeof Image_Architecture];
175
+
176
+ /** The operating system family of an image. */
177
+ export const Image_Platform = {
178
+ /** Not set. */
179
+ PLATFORM_UNSPECIFIED: "PLATFORM_UNSPECIFIED",
180
+ /** Linux or another Unix. */
181
+ LINUX_UNIX: "LINUX_UNIX",
182
+ } as const;
183
+
184
+ /** The operating system family of an image. */
185
+ export type Image_Platform = (typeof Image_Platform)[keyof typeof Image_Platform];
186
+
187
+ /** Where the image is in its lifecycle. */
188
+ export const Image_State = {
189
+ /** Not set. */
190
+ STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
191
+ /** Instances can be launched from it. */
192
+ AVAILABLE: "AVAILABLE",
193
+ } as const;
194
+
195
+ /** Where the image is in its lifecycle. */
196
+ export type Image_State = (typeof Image_State)[keyof typeof Image_State];
197
+
198
+ /** A disk of an image. */
199
+ export interface ImageBlockDevice {
200
+ /**
201
+ * The device name the disk appears under on every instance launched from
202
+ * the image: `vda` to `vdz` but `vdc`, unique within the image.
203
+ */
204
+ device?: string;
205
+ /** The disk's size in GiB, at least the snapshot's. */
206
+ sizeGib?: number;
207
+ /**
208
+ * The protected snapshot the disk is created from, in the image's
209
+ * project and zone; an empty disk when left empty.
210
+ */
211
+ sourceSnapshot?: string;
212
+ }
213
+
214
+ /** The request for GetImage. */
215
+ export interface GetImageRequest {
216
+ /** The image to return. */
217
+ name?: string;
218
+ }
219
+
220
+ /** The request for ListImages. */
221
+ export interface ListImagesRequest {
222
+ /** The zone whose images to list, `projects/{project}/zones/{zone}`. */
223
+ parent?: string;
224
+ /**
225
+ * The most images to return; the server clamps it, and 0 means its
226
+ * default.
227
+ */
228
+ pageSize?: number;
229
+ /** A previous response's `nextPageToken`, for the page after it. */
230
+ pageToken?: string;
231
+ }
232
+
233
+ /** The response for ListImages. */
234
+ export interface ListImagesResponse {
235
+ /** The images on this page. */
236
+ images?: Image[];
237
+ /** The token for the next page; empty on the last one. */
238
+ nextPageToken?: string;
239
+ }
240
+
241
+ /** The request for CreateImage. */
242
+ export interface CreateImageRequest {
243
+ /** The zone to create the image in, `projects/{project}/zones/{zone}`. */
244
+ parent?: string;
245
+ /**
246
+ * The image to create: its description, root device and disks, and
247
+ * optionally its default user and tags.
248
+ */
249
+ image?: Image;
250
+ /**
251
+ * A UUID; a repeat with the same id returns the first request's image
252
+ * instead of creating a second one.
253
+ */
254
+ requestId?: string;
255
+ }
256
+
257
+ /** The request for UpdateImage. */
258
+ export interface UpdateImageRequest {
259
+ /** The image, by its name, with the fields to change. */
260
+ image?: Image;
261
+ /** The fields to change: `description`, `tags`, or both. `*` is both. */
262
+ updateMask?: string;
263
+ }
264
+
265
+ /** The request for DeleteImage. */
266
+ export interface DeleteImageRequest {
267
+ /** The image to delete. */
268
+ name?: string;
269
+ }
@@ -0,0 +1,8 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+
3
+ export * from "./catalog.js";
4
+ export * from "./image.js";
5
+ export * from "./instance.js";
6
+ export * from "./key_pair.js";
7
+ export * from "./public_image.js";
8
+ export * from "./volume_attachment.js";