@origincloud/pvs 0.0.0-stage → 0.2.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.
@@ -0,0 +1,115 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/pvs/v1beta1/storage_class.proto
3
+
4
+ import { type CallOptions, type Client, type Service, pathValue, query } from "@origincloud/core";
5
+
6
+ /**
7
+ * Calls StorageClassService.
8
+ *
9
+ * The catalog of storage classes: every tier the platform publishes, each
10
+ * saying whether it can be selected right now. Not scoped to an
11
+ * organisation or a project; no permission is needed.
12
+ */
13
+ export class StorageClassClient {
14
+ /**
15
+ * The endpoint the client sends its calls to, which also serves the
16
+ * operations its methods answer with.
17
+ */
18
+ readonly service: Service;
19
+
20
+ /** A client of StorageClassService that sends its calls through `client`. */
21
+ constructor(client: Client) {
22
+ this.service = client.service("pvs", true);
23
+ }
24
+
25
+ /** Returns a storage class. */
26
+ async getStorageClass(request: GetStorageClassRequest, options?: CallOptions): Promise<StorageClass> {
27
+ const p0 = pathValue("name", request.name, "storageClasses/*");
28
+ return this.service.call<StorageClass>(
29
+ {
30
+ method: "GET",
31
+ path: `/v1beta1/${p0}`,
32
+ query: query(request, ["name"]),
33
+ idempotent: true,
34
+ },
35
+ options,
36
+ );
37
+ }
38
+
39
+ /**
40
+ * Lists every storage class, including those not yet on sale: check
41
+ * `available` before selecting one.
42
+ */
43
+ async listStorageClasses(request: ListStorageClassesRequest, options?: CallOptions): Promise<ListStorageClassesResponse> {
44
+ return this.service.call<ListStorageClassesResponse>(
45
+ {
46
+ method: "GET",
47
+ path: `/v1beta1/storageClasses`,
48
+ query: query(request, []),
49
+ idempotent: true,
50
+ },
51
+ options,
52
+ );
53
+ }
54
+ }
55
+
56
+ /** A storage tier a volume is created in. */
57
+ export interface StorageClass {
58
+ /** The class's resource name, `storageClasses/gp1`. */
59
+ name?: string;
60
+ /** The name the console shows. */
61
+ displayName?: string;
62
+ /** The media the class is backed by. */
63
+ media?: StorageClass_Media;
64
+ /**
65
+ * Whether a volume created without a storage class is created in this
66
+ * one.
67
+ */
68
+ defaultClass?: boolean;
69
+ /**
70
+ * Whether the class can be selected right now. A class that is listed
71
+ * but not available is a published tier not yet on sale.
72
+ */
73
+ available?: boolean;
74
+ /**
75
+ * The I/O operations per second a volume of the class is limited to; 0
76
+ * for a class not on sale.
77
+ */
78
+ baselineIops?: number;
79
+ /**
80
+ * The MiB per second a volume of the class is limited to; 0 for a class
81
+ * not on sale.
82
+ */
83
+ baselineThroughputMibps?: number;
84
+ }
85
+
86
+ /** The media a class is backed by. */
87
+ export const StorageClass_Media = {
88
+ /** Not set. */
89
+ MEDIA_UNSPECIFIED: "MEDIA_UNSPECIFIED",
90
+ /** Solid-state storage. */
91
+ SSD: "SSD",
92
+ /** Rotational (hard-disk) storage. */
93
+ HDD: "HDD",
94
+ } as const;
95
+
96
+ /** The media a class is backed by. */
97
+ export type StorageClass_Media = (typeof StorageClass_Media)[keyof typeof StorageClass_Media];
98
+
99
+ /** The request for GetStorageClass. */
100
+ export interface GetStorageClassRequest {
101
+ /** The class to return, `storageClasses/{storage_class}`. */
102
+ name?: string;
103
+ }
104
+
105
+ /**
106
+ * The request for ListStorageClasses. The catalog is small and bounded by
107
+ * the platform, so it comes in one page.
108
+ */
109
+ export interface ListStorageClassesRequest {}
110
+
111
+ /** The response for ListStorageClasses. */
112
+ export interface ListStorageClassesResponse {
113
+ /** Every storage class, in catalog order. */
114
+ storageClasses?: StorageClass[];
115
+ }
@@ -0,0 +1,366 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/pvs/v1beta1/volume.proto
3
+
4
+ import {
5
+ type CallOptions,
6
+ type Client,
7
+ type Empty,
8
+ type LongrunningOperation,
9
+ Operation,
10
+ type Service,
11
+ newRequestId,
12
+ pathValue,
13
+ query,
14
+ } from "@origincloud/core";
15
+ import type { OperationMetadata } from "../longrunning/v1beta1/operations.js";
16
+
17
+ /**
18
+ * Calls VolumeService.
19
+ *
20
+ * Block storage volumes: durable disks in one zone that an instance attaches
21
+ * to read and write.
22
+ */
23
+ export class VolumeClient {
24
+ /**
25
+ * The endpoint the client sends its calls to, which also serves the
26
+ * operations its methods answer with.
27
+ */
28
+ readonly service: Service;
29
+
30
+ /** A client of VolumeService that sends its calls through `client`. */
31
+ constructor(client: Client) {
32
+ this.service = client.service("pvs", true);
33
+ }
34
+
35
+ /** Returns a volume. */
36
+ async getVolume(request: GetVolumeRequest, options?: CallOptions): Promise<Volume> {
37
+ const p0 = pathValue("name", request.name, "projects/*/zones/*/volumes/*");
38
+ return this.service.call<Volume>(
39
+ {
40
+ method: "GET",
41
+ path: `/v1beta1/${p0}`,
42
+ query: query(request, ["name"]),
43
+ idempotent: true,
44
+ },
45
+ options,
46
+ );
47
+ }
48
+
49
+ /**
50
+ * Lists the volumes in a zone, oldest first. Deleted volumes aren't
51
+ * listed. For every zone's volumes, list the zones whose `services` name
52
+ * `pvs` with the location service (`location.origincloudapis.eu`), then
53
+ * each zone's volumes.
54
+ */
55
+ async listVolumes(request: ListVolumesRequest, options?: CallOptions): Promise<ListVolumesResponse> {
56
+ const p0 = pathValue("parent", request.parent, "projects/*/zones/*");
57
+ return this.service.call<ListVolumesResponse>(
58
+ {
59
+ method: "GET",
60
+ path: `/v1beta1/${p0}/volumes`,
61
+ query: query(request, ["parent"]),
62
+ idempotent: true,
63
+ },
64
+ options,
65
+ );
66
+ }
67
+
68
+ /**
69
+ * Iterates over everything listVolumes lists from the request's page on,
70
+ * fetching the next page as the loop reaches it. A page that fails ends
71
+ * the iteration with its error.
72
+ */
73
+ async *allVolumes(request: ListVolumesRequest, options?: CallOptions): AsyncGenerator<Volume, void, undefined> {
74
+ for (let page = request; ; ) {
75
+ const response = await this.listVolumes(page, options);
76
+ yield* response.volumes ?? [];
77
+ if (!response.nextPageToken) return;
78
+ page = { ...page, pageToken: response.nextPageToken };
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Creates a volume, empty or as a copy of a snapshot. The operation is
84
+ * done once the volume is `AVAILABLE`, or failed once it is `ERROR`.
85
+ *
86
+ * It answers with an operation to wait on, whose result is the Volume.
87
+ */
88
+ async createVolume(request: CreateVolumeRequest, options?: CallOptions): Promise<Operation<Volume, OperationMetadata>> {
89
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
90
+ const p0 = pathValue("parent", request.parent, "projects/*/zones/*");
91
+ const op = await this.service.call<LongrunningOperation>(
92
+ {
93
+ method: "POST",
94
+ path: `/v1beta1/${p0}/volumes`,
95
+ body: request.volume,
96
+ query: query(request, ["parent", "volume"]),
97
+ idempotent: true,
98
+ },
99
+ options,
100
+ );
101
+ return new Operation<Volume, OperationMetadata>(this.service, op, "origincloud.pvs.v1beta1.Volume");
102
+ }
103
+
104
+ /**
105
+ * Creates a volume whose initial content is a disk image the platform
106
+ * downloads. The operation is done once the volume is `AVAILABLE`.
107
+ *
108
+ * It answers with an operation to wait on, whose result is the Volume.
109
+ */
110
+ async importVolume(request: ImportVolumeRequest, options?: CallOptions): Promise<Operation<Volume, OperationMetadata>> {
111
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
112
+ const p0 = pathValue("parent", request.parent, "projects/*/zones/*");
113
+ const op = await this.service.call<LongrunningOperation>(
114
+ {
115
+ method: "POST",
116
+ path: `/v1beta1/${p0}/volumes:import`,
117
+ body: request,
118
+ idempotent: true,
119
+ },
120
+ options,
121
+ );
122
+ return new Operation<Volume, OperationMetadata>(this.service, op, "origincloud.pvs.v1beta1.Volume");
123
+ }
124
+
125
+ /**
126
+ * Changes a volume's size or tags. A larger `sizeGib` grows the volume,
127
+ * attached or not; it never shrinks, and the size it already has changes
128
+ * nothing. The operation is done once the volume reports the new size.
129
+ *
130
+ * It answers with an operation to wait on, whose result is the Volume.
131
+ */
132
+ async updateVolume(request: UpdateVolumeRequest, options?: CallOptions): Promise<Operation<Volume, OperationMetadata>> {
133
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
134
+ const p0 = pathValue("volume.name", request.volume?.name, "projects/*/zones/*/volumes/*");
135
+ const op = await this.service.call<LongrunningOperation>(
136
+ {
137
+ method: "PATCH",
138
+ path: `/v1beta1/${p0}`,
139
+ body: request.volume,
140
+ query: query(request, ["volume.name", "volume"]),
141
+ idempotent: true,
142
+ },
143
+ options,
144
+ );
145
+ return new Operation<Volume, OperationMetadata>(this.service, op, "origincloud.pvs.v1beta1.Volume");
146
+ }
147
+
148
+ /**
149
+ * Deletes a volume. It must not be attached, and none of its snapshots
150
+ * may be left. The operation is done once the volume is `DELETED`.
151
+ *
152
+ * It answers with an operation to wait on, which has no result.
153
+ */
154
+ async deleteVolume(request: DeleteVolumeRequest, options?: CallOptions): Promise<Operation<Empty, OperationMetadata>> {
155
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
156
+ const p0 = pathValue("name", request.name, "projects/*/zones/*/volumes/*");
157
+ const op = await this.service.call<LongrunningOperation>(
158
+ {
159
+ method: "DELETE",
160
+ path: `/v1beta1/${p0}`,
161
+ query: query(request, ["name"]),
162
+ idempotent: true,
163
+ },
164
+ options,
165
+ );
166
+ return new Operation<Empty, OperationMetadata>(this.service, op, "google.protobuf.Empty");
167
+ }
168
+ }
169
+
170
+ /** A block storage volume in one zone. */
171
+ export interface Volume {
172
+ /** The volume's resource name. */
173
+ name?: string;
174
+ /**
175
+ * The volume's URN, the identifier access policies and the audit log
176
+ * use.
177
+ */
178
+ urn?: string;
179
+ /**
180
+ * The size in GiB, at least 1. Growing it resizes the volume; it never
181
+ * shrinks.
182
+ */
183
+ sizeGib?: number;
184
+ /**
185
+ * The storage class, `storageClasses/{storage_class}`. The default class
186
+ * when left empty.
187
+ */
188
+ storageClass?: string;
189
+ /**
190
+ * The snapshot the volume was created from, in the same project and
191
+ * zone; empty for an empty volume. The volume is at least the snapshot's
192
+ * size.
193
+ */
194
+ sourceSnapshot?: string;
195
+ /** Where the volume is in its lifecycle. */
196
+ state?: Volume_State;
197
+ /** Why the volume is in `ERROR`; empty otherwise. */
198
+ stateReason?: string;
199
+ /** When `state` is `IN_USE`, the id of the volume attachment holding it. */
200
+ attachment?: string;
201
+ /** Where the last resize is. */
202
+ resizeState?: Volume_ResizeState;
203
+ /** Why the last resize failed, when `resizeState` is `RESIZE_FAILED`. */
204
+ resizeReason?: string;
205
+ /**
206
+ * The size a resize under way is heading for; 0 when none is.
207
+ * `sizeGib` changes once the resize is confirmed.
208
+ */
209
+ pendingSizeGib?: number;
210
+ /**
211
+ * Why the volume is still here after the instance it was created with
212
+ * was terminated; empty in every other case. Most often a snapshot of it
213
+ * exists, and a snapshot depends on its volume's data.
214
+ */
215
+ retentionNote?: string;
216
+ /**
217
+ * The most I/O operations per second the volume serves, reads and writes
218
+ * combined: a ceiling, not a guaranteed rate. 0 when it isn't limited.
219
+ */
220
+ iops?: number;
221
+ /**
222
+ * The most MiB per second the volume transfers, reads and writes
223
+ * combined: a ceiling, not a guaranteed rate. 0 when it isn't limited.
224
+ */
225
+ throughputMibps?: number;
226
+ /**
227
+ * The principal that created the volume, such as `user:<id>` or
228
+ * `service_account:<id>`.
229
+ */
230
+ creator?: string;
231
+ /**
232
+ * Labels of your own, at most 50. The `origin:name` tag is the name the
233
+ * console shows.
234
+ */
235
+ tags?: Record<string, string>;
236
+ }
237
+
238
+ /** Where the volume is in its lifecycle. */
239
+ export const Volume_State = {
240
+ /** Not set. */
241
+ STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
242
+ /** Being created. */
243
+ CREATING: "CREATING",
244
+ /** Ready to attach. */
245
+ AVAILABLE: "AVAILABLE",
246
+ /** Attached to an instance. */
247
+ IN_USE: "IN_USE",
248
+ /** Being deleted. */
249
+ DELETING: "DELETING",
250
+ /** Deleted. Readable by name for a day, never listed. */
251
+ DELETED: "DELETED",
252
+ /**
253
+ * Its storage couldn't be created or removed; `stateReason` says
254
+ * which. It can be deleted again.
255
+ */
256
+ ERROR: "ERROR",
257
+ } as const;
258
+
259
+ /** Where the volume is in its lifecycle. */
260
+ export type Volume_State = (typeof Volume_State)[keyof typeof Volume_State];
261
+
262
+ /** Where a resize is. */
263
+ export const Volume_ResizeState = {
264
+ /** Not set. */
265
+ RESIZE_STATE_UNSPECIFIED: "RESIZE_STATE_UNSPECIFIED",
266
+ /** No resize is under way; the last one, if any, finished. */
267
+ RESIZE_COMPLETED: "RESIZE_COMPLETED",
268
+ /** Growing to `pendingSizeGib`. */
269
+ RESIZING: "RESIZING",
270
+ /**
271
+ * The last resize failed; `resizeReason` says why. The volume and its
272
+ * data are unaffected.
273
+ */
274
+ RESIZE_FAILED: "RESIZE_FAILED",
275
+ } as const;
276
+
277
+ /** Where a resize is. */
278
+ export type Volume_ResizeState = (typeof Volume_ResizeState)[keyof typeof Volume_ResizeState];
279
+
280
+ /** The request for GetVolume. */
281
+ export interface GetVolumeRequest {
282
+ /** The volume to return. */
283
+ name?: string;
284
+ }
285
+
286
+ /** The request for ListVolumes. */
287
+ export interface ListVolumesRequest {
288
+ /** The zone whose volumes to list, `projects/{project}/zones/{zone}`. */
289
+ parent?: string;
290
+ /**
291
+ * The most volumes to return; the server clamps it, and 0 means its
292
+ * default.
293
+ */
294
+ pageSize?: number;
295
+ /** A previous response's `nextPageToken`, for the page after it. */
296
+ pageToken?: string;
297
+ }
298
+
299
+ /** The response for ListVolumes. */
300
+ export interface ListVolumesResponse {
301
+ /** The volumes on this page. */
302
+ volumes?: Volume[];
303
+ /** The token for the next page; empty on the last one. */
304
+ nextPageToken?: string;
305
+ }
306
+
307
+ /** The request for CreateVolume. */
308
+ export interface CreateVolumeRequest {
309
+ /** The zone to create the volume in, `projects/{project}/zones/{zone}`. */
310
+ parent?: string;
311
+ /**
312
+ * The volume to create: its size, and optionally its storage class,
313
+ * source snapshot and tags.
314
+ */
315
+ volume?: Volume;
316
+ /**
317
+ * A UUID; a repeat with the same id returns the first request's
318
+ * operation instead of creating a second volume.
319
+ */
320
+ requestId?: string;
321
+ }
322
+
323
+ /** The request for ImportVolume. */
324
+ export interface ImportVolumeRequest {
325
+ /** The zone to create the volume in, `projects/{project}/zones/{zone}`. */
326
+ parent?: string;
327
+ /**
328
+ * The volume to create: its size, which must hold the image, and
329
+ * optionally its storage class and tags.
330
+ */
331
+ volume?: Volume;
332
+ /**
333
+ * The URL of the disk image, which the platform downloads over HTTP or
334
+ * HTTPS: it must be reachable from the platform.
335
+ */
336
+ sourceUrl?: string;
337
+ /**
338
+ * A UUID; a repeat with the same id returns the first request's
339
+ * operation instead of importing twice.
340
+ */
341
+ requestId?: string;
342
+ }
343
+
344
+ /** The request for UpdateVolume. */
345
+ export interface UpdateVolumeRequest {
346
+ /** The volume, by its name, with the fields to change. */
347
+ volume?: Volume;
348
+ /** The fields to change: `sizeGib`, `tags`, or both. `*` is both. */
349
+ updateMask?: string;
350
+ /**
351
+ * A UUID; a repeat with the same id returns the first request's
352
+ * operation instead of changing the volume again.
353
+ */
354
+ requestId?: string;
355
+ }
356
+
357
+ /** The request for DeleteVolume. */
358
+ export interface DeleteVolumeRequest {
359
+ /** The volume to delete. */
360
+ name?: string;
361
+ /**
362
+ * A UUID; a repeat with the same id returns the first request's
363
+ * operation.
364
+ */
365
+ requestId?: string;
366
+ }