@scaleway/sdk-instance 1.0.2

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,277 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const api_gen = require("./api.gen.cjs");
5
+ const content_gen = require("./content.gen.cjs");
6
+ const validateNotUndefined = (obj) => {
7
+ if (obj === void 0) throw new TypeError(`object was found undefined`);
8
+ return obj;
9
+ };
10
+ class InstanceV1UtilsAPI extends api_gen.API {
11
+ /**
12
+ * Waits for {@link Image} to be in a final state.
13
+ *
14
+ * @param request - The request {@link GetImageRequest}
15
+ * @param options - The waiting options
16
+ * @returns A Promise of Image
17
+ */
18
+ waitForImage = (request, options) => sdkClient.tryAtIntervals(
19
+ async () => {
20
+ const value = await this.getImage(request).then(
21
+ (res) => res.image
22
+ );
23
+ return {
24
+ done: !content_gen.IMAGE_TRANSIENT_STATUSES.includes(value.state),
25
+ value
26
+ };
27
+ },
28
+ sdkClient.createExponentialBackoffStrategy(
29
+ options?.minDelay ?? 1,
30
+ options?.maxDelay ?? 30
31
+ ),
32
+ options?.timeout
33
+ );
34
+ /**
35
+ * Waits for {@link PrivateNIC} to be in a final state.
36
+ *
37
+ * @param request - The request {@link GetPrivateNICRequest}
38
+ * @param options - The waiting options
39
+ * @returns A Promise of PrivateNIC
40
+ */
41
+ waitForPrivateNIC = (request, options) => sdkClient.tryAtIntervals(
42
+ async () => {
43
+ const value = await this.getPrivateNIC(request).then(
44
+ (res) => res.privateNic
45
+ );
46
+ return {
47
+ done: !content_gen.PRIVATE_NIC_TRANSIENT_STATUSES.includes(value.state),
48
+ value
49
+ };
50
+ },
51
+ sdkClient.createExponentialBackoffStrategy(
52
+ options?.minDelay ?? 1,
53
+ options?.maxDelay ?? 30
54
+ ),
55
+ options?.timeout
56
+ );
57
+ /**
58
+ * Waits for {@link Server} to be in a final state.
59
+ *
60
+ * @param request - The request {@link GetServerRequest}
61
+ * @param options - The waiting options
62
+ * @returns A Promise of Server
63
+ */
64
+ waitForServer = (request, options) => sdkClient.tryAtIntervals(
65
+ async () => {
66
+ const value = await this.getServer(request).then(
67
+ (res) => res.server
68
+ );
69
+ return {
70
+ done: !content_gen.SERVER_TRANSIENT_STATUSES.includes(value.state),
71
+ value
72
+ };
73
+ },
74
+ sdkClient.createExponentialBackoffStrategy(
75
+ options?.minDelay ?? 1,
76
+ options?.maxDelay ?? 30
77
+ ),
78
+ options?.timeout
79
+ );
80
+ /**
81
+ * Waits for {@link Server} to be in a final state.
82
+ *
83
+ * @param request - The request {@link GetServerRequest}
84
+ * @param options - The waiting options
85
+ * @returns A Promise of Server
86
+ */
87
+ waitForSnapshot = (request, options) => sdkClient.tryAtIntervals(
88
+ async () => {
89
+ const value = await this.getSnapshot(request).then(
90
+ (res) => res.snapshot
91
+ );
92
+ return {
93
+ done: !content_gen.SNAPSHOT_TRANSIENT_STATUSES.includes(value.state),
94
+ value
95
+ };
96
+ },
97
+ sdkClient.createExponentialBackoffStrategy(
98
+ options?.minDelay ?? 1,
99
+ options?.maxDelay ?? 30
100
+ ),
101
+ options?.timeout
102
+ );
103
+ /**
104
+ * Waits for {@link Volume} to be in a final state.
105
+ *
106
+ * @param request - The request {@link GetVolumeRequest}
107
+ * @param options - The waiting options
108
+ * @returns A Promise of Volume
109
+ */
110
+ waitForVolume = (request, options) => sdkClient.tryAtIntervals(
111
+ async () => {
112
+ const value = await this.getVolume(request).then(
113
+ (res) => res.volume
114
+ );
115
+ return {
116
+ done: !content_gen.VOLUME_TRANSIENT_STATUSES.includes(value.state),
117
+ value
118
+ };
119
+ },
120
+ sdkClient.createExponentialBackoffStrategy(
121
+ options?.minDelay ?? 1,
122
+ options?.maxDelay ?? 30
123
+ ),
124
+ options?.timeout
125
+ );
126
+ /**
127
+ * Updates a server.
128
+ *
129
+ * @param request - The request {@link UpdateServerRequest}
130
+ * @returns A Promise of UpdateServerResponse
131
+ */
132
+ updateServer = (request) => this._updateServer(request);
133
+ /**
134
+ * Creates a server.
135
+ *
136
+ * @param request - The request {@link CreateServerRequest}
137
+ * @returns A Promise of CreateServerResponse
138
+ */
139
+ createServer = (request) => this._createServer(request);
140
+ /**
141
+ * Starts an action and wait for the server to be in the correct "terminal
142
+ * state" expected by this action.
143
+ *
144
+ * @param request - The request {@link ServerActionRequest}
145
+ * @returns A Promise of Server
146
+ */
147
+ serverActionAndWait = async (request, options) => {
148
+ const finalServer = await this.serverAction(request).then(
149
+ () => this.waitForServer(
150
+ {
151
+ serverId: request.serverId,
152
+ zone: request.zone
153
+ },
154
+ options
155
+ )
156
+ );
157
+ let expectedState;
158
+ switch (request.action) {
159
+ case "poweron":
160
+ case "reboot":
161
+ expectedState = "running";
162
+ break;
163
+ case "poweroff":
164
+ expectedState = "stopped";
165
+ break;
166
+ case "stop_in_place":
167
+ expectedState = "stopped in place";
168
+ break;
169
+ }
170
+ if (expectedState && finalServer.state !== expectedState) {
171
+ throw new Error(
172
+ `expected state ${expectedState} but found ${finalServer.state}: ${finalServer.stateDetail}`
173
+ );
174
+ }
175
+ return finalServer;
176
+ };
177
+ /**
178
+ * Attaches a volume to a server.
179
+ *
180
+ * @param request - The request {@link AttachVolumeRequest}
181
+ * @returns A Promise of AttachVolumeResponse
182
+ */
183
+ attachVolume = async (request) => {
184
+ const volumes = await this.getServer({
185
+ serverId: request.serverId,
186
+ zone: request.zone
187
+ }).then((res) => validateNotUndefined(res.server?.volumes));
188
+ const newVolumes = {};
189
+ for (const [key, server] of Object.entries(volumes)) {
190
+ newVolumes[key] = { id: server.id, name: server.name };
191
+ }
192
+ let found = false;
193
+ const volumesLength = Object.keys(volumes).length;
194
+ for (let index = 0; index <= volumesLength; index += 1) {
195
+ const key = index.toString();
196
+ if (!(key in newVolumes)) {
197
+ newVolumes[key] = {
198
+ id: request.volumeId,
199
+ name: request.volumeId
200
+ // name is ignored on this PATCH
201
+ };
202
+ found = true;
203
+ break;
204
+ }
205
+ }
206
+ if (!found) {
207
+ throw new Error(`could not find key to attach volume ${request.volumeId}`);
208
+ }
209
+ return this.updateServer({
210
+ serverId: request.serverId,
211
+ volumes: newVolumes,
212
+ zone: request.zone
213
+ }).then((obj) => obj);
214
+ };
215
+ /**
216
+ * Detaches a volume from a server.
217
+ *
218
+ * @param request - The request {@link DetachVolumeRequest}
219
+ * @returns A Promise of DetachVolumeResponse
220
+ */
221
+ detachVolume = async (request) => {
222
+ const server = await this.getVolume({
223
+ volumeId: request.volumeId,
224
+ zone: request.zone
225
+ }).then((res) => validateNotUndefined(res.volume?.server?.id)).then(
226
+ (serverId) => this.getServer({
227
+ serverId,
228
+ zone: request.zone
229
+ })
230
+ ).then((res) => validateNotUndefined(res.server));
231
+ const newVolumes = {};
232
+ for (const [key, volume] of Object.entries(server.volumes)) {
233
+ if (volume.id !== request.volumeId) {
234
+ newVolumes[key] = { id: volume.id, name: volume.name };
235
+ }
236
+ }
237
+ return this.updateServer({
238
+ serverId: server.id,
239
+ volumes: newVolumes,
240
+ zone: request.zone
241
+ }).then((obj) => obj);
242
+ };
243
+ /**
244
+ * Get the content of a user data on a server for the given key.
245
+ *
246
+ * @param request - The request {@link GetServerUserDataRequest}
247
+ * @returns The content of the key
248
+ */
249
+ getServerUserData = (request) => this.client.fetch({
250
+ method: "GET",
251
+ path: `/instance/v1/zones/${sdkClient.validatePathParam(
252
+ "zone",
253
+ request.zone ?? this.client.settings.defaultZone
254
+ )}/servers/${sdkClient.validatePathParam(
255
+ "serverId",
256
+ request.serverId
257
+ )}/user_data/${sdkClient.validatePathParam("key", request.key)}`
258
+ });
259
+ /**
260
+ * Sets the content of a user data on a server for the given key.
261
+ *
262
+ * @param request - The request {@link SetServerUserDataRequest}
263
+ */
264
+ setServerUserData = (request) => this.client.fetch({
265
+ body: request.content,
266
+ headers: { "Content-Type": "text/plain" },
267
+ method: "PATCH",
268
+ path: `/instance/v1/zones/${sdkClient.validatePathParam(
269
+ "zone",
270
+ request.zone ?? this.client.settings.defaultZone
271
+ )}/servers/${sdkClient.validatePathParam(
272
+ "serverId",
273
+ request.serverId
274
+ )}/user_data/${sdkClient.validatePathParam("key", request.key)}`
275
+ });
276
+ }
277
+ exports.InstanceV1UtilsAPI = InstanceV1UtilsAPI;
@@ -0,0 +1,95 @@
1
+ import type { WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API } from './api.gen';
3
+ import type { CreateServerRequest, GetImageRequest, GetPrivateNICRequest, GetServerRequest, GetSnapshotRequest, GetVolumeRequest, Image, PrivateNIC, Server, ServerActionRequest, Snapshot, UpdateServerRequest, Volume } from './types.gen';
4
+ import type { AttachVolumeRequest, AttachVolumeResponse, DetachVolumeRequest, DetachVolumeResponse, GetServerUserDataRequest, SetServerUserDataRequest } from './types.utils';
5
+ export declare class InstanceV1UtilsAPI extends API {
6
+ /**
7
+ * Waits for {@link Image} to be in a final state.
8
+ *
9
+ * @param request - The request {@link GetImageRequest}
10
+ * @param options - The waiting options
11
+ * @returns A Promise of Image
12
+ */
13
+ waitForImage: (request: Readonly<GetImageRequest>, options?: Readonly<WaitForOptions<Image>>) => Promise<Image>;
14
+ /**
15
+ * Waits for {@link PrivateNIC} to be in a final state.
16
+ *
17
+ * @param request - The request {@link GetPrivateNICRequest}
18
+ * @param options - The waiting options
19
+ * @returns A Promise of PrivateNIC
20
+ */
21
+ waitForPrivateNIC: (request: Readonly<GetPrivateNICRequest>, options?: Readonly<WaitForOptions<PrivateNIC>>) => Promise<PrivateNIC>;
22
+ /**
23
+ * Waits for {@link Server} to be in a final state.
24
+ *
25
+ * @param request - The request {@link GetServerRequest}
26
+ * @param options - The waiting options
27
+ * @returns A Promise of Server
28
+ */
29
+ waitForServer: (request: Readonly<GetServerRequest>, options?: Readonly<WaitForOptions<Server>>) => Promise<Server>;
30
+ /**
31
+ * Waits for {@link Server} to be in a final state.
32
+ *
33
+ * @param request - The request {@link GetServerRequest}
34
+ * @param options - The waiting options
35
+ * @returns A Promise of Server
36
+ */
37
+ waitForSnapshot: (request: Readonly<GetSnapshotRequest>, options?: Readonly<WaitForOptions<Snapshot>>) => Promise<Snapshot>;
38
+ /**
39
+ * Waits for {@link Volume} to be in a final state.
40
+ *
41
+ * @param request - The request {@link GetVolumeRequest}
42
+ * @param options - The waiting options
43
+ * @returns A Promise of Volume
44
+ */
45
+ waitForVolume: (request: Readonly<GetVolumeRequest>, options?: Readonly<WaitForOptions<Volume>>) => Promise<Volume>;
46
+ /**
47
+ * Updates a server.
48
+ *
49
+ * @param request - The request {@link UpdateServerRequest}
50
+ * @returns A Promise of UpdateServerResponse
51
+ */
52
+ updateServer: (request: UpdateServerRequest) => Promise<import("./types.gen").UpdateServerResponse>;
53
+ /**
54
+ * Creates a server.
55
+ *
56
+ * @param request - The request {@link CreateServerRequest}
57
+ * @returns A Promise of CreateServerResponse
58
+ */
59
+ createServer: (request: Readonly<CreateServerRequest>) => Promise<import("./types.gen").CreateServerResponse>;
60
+ /**
61
+ * Starts an action and wait for the server to be in the correct "terminal
62
+ * state" expected by this action.
63
+ *
64
+ * @param request - The request {@link ServerActionRequest}
65
+ * @returns A Promise of Server
66
+ */
67
+ serverActionAndWait: (request: ServerActionRequest, options?: Readonly<WaitForOptions<Server>>) => Promise<Server>;
68
+ /**
69
+ * Attaches a volume to a server.
70
+ *
71
+ * @param request - The request {@link AttachVolumeRequest}
72
+ * @returns A Promise of AttachVolumeResponse
73
+ */
74
+ attachVolume: (request: Readonly<AttachVolumeRequest>) => Promise<AttachVolumeResponse>;
75
+ /**
76
+ * Detaches a volume from a server.
77
+ *
78
+ * @param request - The request {@link DetachVolumeRequest}
79
+ * @returns A Promise of DetachVolumeResponse
80
+ */
81
+ detachVolume: (request: DetachVolumeRequest) => Promise<DetachVolumeResponse>;
82
+ /**
83
+ * Get the content of a user data on a server for the given key.
84
+ *
85
+ * @param request - The request {@link GetServerUserDataRequest}
86
+ * @returns The content of the key
87
+ */
88
+ getServerUserData: (request: Readonly<GetServerUserDataRequest>) => Promise<string>;
89
+ /**
90
+ * Sets the content of a user data on a server for the given key.
91
+ *
92
+ * @param request - The request {@link SetServerUserDataRequest}
93
+ */
94
+ setServerUserData: (request: Readonly<SetServerUserDataRequest>) => Promise<void>;
95
+ }
@@ -0,0 +1,277 @@
1
+ import { tryAtIntervals, createExponentialBackoffStrategy, validatePathParam } from "@scaleway/sdk-client";
2
+ import { API } from "./api.gen.js";
3
+ import { IMAGE_TRANSIENT_STATUSES, PRIVATE_NIC_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from "./content.gen.js";
4
+ const validateNotUndefined = (obj) => {
5
+ if (obj === void 0) throw new TypeError(`object was found undefined`);
6
+ return obj;
7
+ };
8
+ class InstanceV1UtilsAPI extends API {
9
+ /**
10
+ * Waits for {@link Image} to be in a final state.
11
+ *
12
+ * @param request - The request {@link GetImageRequest}
13
+ * @param options - The waiting options
14
+ * @returns A Promise of Image
15
+ */
16
+ waitForImage = (request, options) => tryAtIntervals(
17
+ async () => {
18
+ const value = await this.getImage(request).then(
19
+ (res) => res.image
20
+ );
21
+ return {
22
+ done: !IMAGE_TRANSIENT_STATUSES.includes(value.state),
23
+ value
24
+ };
25
+ },
26
+ createExponentialBackoffStrategy(
27
+ options?.minDelay ?? 1,
28
+ options?.maxDelay ?? 30
29
+ ),
30
+ options?.timeout
31
+ );
32
+ /**
33
+ * Waits for {@link PrivateNIC} to be in a final state.
34
+ *
35
+ * @param request - The request {@link GetPrivateNICRequest}
36
+ * @param options - The waiting options
37
+ * @returns A Promise of PrivateNIC
38
+ */
39
+ waitForPrivateNIC = (request, options) => tryAtIntervals(
40
+ async () => {
41
+ const value = await this.getPrivateNIC(request).then(
42
+ (res) => res.privateNic
43
+ );
44
+ return {
45
+ done: !PRIVATE_NIC_TRANSIENT_STATUSES.includes(value.state),
46
+ value
47
+ };
48
+ },
49
+ createExponentialBackoffStrategy(
50
+ options?.minDelay ?? 1,
51
+ options?.maxDelay ?? 30
52
+ ),
53
+ options?.timeout
54
+ );
55
+ /**
56
+ * Waits for {@link Server} to be in a final state.
57
+ *
58
+ * @param request - The request {@link GetServerRequest}
59
+ * @param options - The waiting options
60
+ * @returns A Promise of Server
61
+ */
62
+ waitForServer = (request, options) => tryAtIntervals(
63
+ async () => {
64
+ const value = await this.getServer(request).then(
65
+ (res) => res.server
66
+ );
67
+ return {
68
+ done: !SERVER_TRANSIENT_STATUSES.includes(value.state),
69
+ value
70
+ };
71
+ },
72
+ createExponentialBackoffStrategy(
73
+ options?.minDelay ?? 1,
74
+ options?.maxDelay ?? 30
75
+ ),
76
+ options?.timeout
77
+ );
78
+ /**
79
+ * Waits for {@link Server} to be in a final state.
80
+ *
81
+ * @param request - The request {@link GetServerRequest}
82
+ * @param options - The waiting options
83
+ * @returns A Promise of Server
84
+ */
85
+ waitForSnapshot = (request, options) => tryAtIntervals(
86
+ async () => {
87
+ const value = await this.getSnapshot(request).then(
88
+ (res) => res.snapshot
89
+ );
90
+ return {
91
+ done: !SNAPSHOT_TRANSIENT_STATUSES.includes(value.state),
92
+ value
93
+ };
94
+ },
95
+ createExponentialBackoffStrategy(
96
+ options?.minDelay ?? 1,
97
+ options?.maxDelay ?? 30
98
+ ),
99
+ options?.timeout
100
+ );
101
+ /**
102
+ * Waits for {@link Volume} to be in a final state.
103
+ *
104
+ * @param request - The request {@link GetVolumeRequest}
105
+ * @param options - The waiting options
106
+ * @returns A Promise of Volume
107
+ */
108
+ waitForVolume = (request, options) => tryAtIntervals(
109
+ async () => {
110
+ const value = await this.getVolume(request).then(
111
+ (res) => res.volume
112
+ );
113
+ return {
114
+ done: !VOLUME_TRANSIENT_STATUSES.includes(value.state),
115
+ value
116
+ };
117
+ },
118
+ createExponentialBackoffStrategy(
119
+ options?.minDelay ?? 1,
120
+ options?.maxDelay ?? 30
121
+ ),
122
+ options?.timeout
123
+ );
124
+ /**
125
+ * Updates a server.
126
+ *
127
+ * @param request - The request {@link UpdateServerRequest}
128
+ * @returns A Promise of UpdateServerResponse
129
+ */
130
+ updateServer = (request) => this._updateServer(request);
131
+ /**
132
+ * Creates a server.
133
+ *
134
+ * @param request - The request {@link CreateServerRequest}
135
+ * @returns A Promise of CreateServerResponse
136
+ */
137
+ createServer = (request) => this._createServer(request);
138
+ /**
139
+ * Starts an action and wait for the server to be in the correct "terminal
140
+ * state" expected by this action.
141
+ *
142
+ * @param request - The request {@link ServerActionRequest}
143
+ * @returns A Promise of Server
144
+ */
145
+ serverActionAndWait = async (request, options) => {
146
+ const finalServer = await this.serverAction(request).then(
147
+ () => this.waitForServer(
148
+ {
149
+ serverId: request.serverId,
150
+ zone: request.zone
151
+ },
152
+ options
153
+ )
154
+ );
155
+ let expectedState;
156
+ switch (request.action) {
157
+ case "poweron":
158
+ case "reboot":
159
+ expectedState = "running";
160
+ break;
161
+ case "poweroff":
162
+ expectedState = "stopped";
163
+ break;
164
+ case "stop_in_place":
165
+ expectedState = "stopped in place";
166
+ break;
167
+ }
168
+ if (expectedState && finalServer.state !== expectedState) {
169
+ throw new Error(
170
+ `expected state ${expectedState} but found ${finalServer.state}: ${finalServer.stateDetail}`
171
+ );
172
+ }
173
+ return finalServer;
174
+ };
175
+ /**
176
+ * Attaches a volume to a server.
177
+ *
178
+ * @param request - The request {@link AttachVolumeRequest}
179
+ * @returns A Promise of AttachVolumeResponse
180
+ */
181
+ attachVolume = async (request) => {
182
+ const volumes = await this.getServer({
183
+ serverId: request.serverId,
184
+ zone: request.zone
185
+ }).then((res) => validateNotUndefined(res.server?.volumes));
186
+ const newVolumes = {};
187
+ for (const [key, server] of Object.entries(volumes)) {
188
+ newVolumes[key] = { id: server.id, name: server.name };
189
+ }
190
+ let found = false;
191
+ const volumesLength = Object.keys(volumes).length;
192
+ for (let index = 0; index <= volumesLength; index += 1) {
193
+ const key = index.toString();
194
+ if (!(key in newVolumes)) {
195
+ newVolumes[key] = {
196
+ id: request.volumeId,
197
+ name: request.volumeId
198
+ // name is ignored on this PATCH
199
+ };
200
+ found = true;
201
+ break;
202
+ }
203
+ }
204
+ if (!found) {
205
+ throw new Error(`could not find key to attach volume ${request.volumeId}`);
206
+ }
207
+ return this.updateServer({
208
+ serverId: request.serverId,
209
+ volumes: newVolumes,
210
+ zone: request.zone
211
+ }).then((obj) => obj);
212
+ };
213
+ /**
214
+ * Detaches a volume from a server.
215
+ *
216
+ * @param request - The request {@link DetachVolumeRequest}
217
+ * @returns A Promise of DetachVolumeResponse
218
+ */
219
+ detachVolume = async (request) => {
220
+ const server = await this.getVolume({
221
+ volumeId: request.volumeId,
222
+ zone: request.zone
223
+ }).then((res) => validateNotUndefined(res.volume?.server?.id)).then(
224
+ (serverId) => this.getServer({
225
+ serverId,
226
+ zone: request.zone
227
+ })
228
+ ).then((res) => validateNotUndefined(res.server));
229
+ const newVolumes = {};
230
+ for (const [key, volume] of Object.entries(server.volumes)) {
231
+ if (volume.id !== request.volumeId) {
232
+ newVolumes[key] = { id: volume.id, name: volume.name };
233
+ }
234
+ }
235
+ return this.updateServer({
236
+ serverId: server.id,
237
+ volumes: newVolumes,
238
+ zone: request.zone
239
+ }).then((obj) => obj);
240
+ };
241
+ /**
242
+ * Get the content of a user data on a server for the given key.
243
+ *
244
+ * @param request - The request {@link GetServerUserDataRequest}
245
+ * @returns The content of the key
246
+ */
247
+ getServerUserData = (request) => this.client.fetch({
248
+ method: "GET",
249
+ path: `/instance/v1/zones/${validatePathParam(
250
+ "zone",
251
+ request.zone ?? this.client.settings.defaultZone
252
+ )}/servers/${validatePathParam(
253
+ "serverId",
254
+ request.serverId
255
+ )}/user_data/${validatePathParam("key", request.key)}`
256
+ });
257
+ /**
258
+ * Sets the content of a user data on a server for the given key.
259
+ *
260
+ * @param request - The request {@link SetServerUserDataRequest}
261
+ */
262
+ setServerUserData = (request) => this.client.fetch({
263
+ body: request.content,
264
+ headers: { "Content-Type": "text/plain" },
265
+ method: "PATCH",
266
+ path: `/instance/v1/zones/${validatePathParam(
267
+ "zone",
268
+ request.zone ?? this.client.settings.defaultZone
269
+ )}/servers/${validatePathParam(
270
+ "serverId",
271
+ request.serverId
272
+ )}/user_data/${validatePathParam("key", request.key)}`
273
+ });
274
+ }
275
+ export {
276
+ InstanceV1UtilsAPI
277
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const IMAGE_TRANSIENT_STATUSES = ["creating"];
4
+ const IP_TRANSIENT_STATUSES = ["pending"];
5
+ const PRIVATE_NIC_TRANSIENT_STATUSES = ["syncing"];
6
+ const SECURITY_GROUP_TRANSIENT_STATUSES = [
7
+ "syncing"
8
+ ];
9
+ const SERVER_IP_TRANSIENT_STATUSES = ["pending"];
10
+ const SERVER_TRANSIENT_STATUSES = ["starting", "stopping"];
11
+ const SNAPSHOT_TRANSIENT_STATUSES = [
12
+ "snapshotting",
13
+ "importing",
14
+ "exporting"
15
+ ];
16
+ const TASK_TRANSIENT_STATUSES = [
17
+ "pending",
18
+ "started",
19
+ "retry"
20
+ ];
21
+ const VOLUME_SERVER_TRANSIENT_STATUSES = [
22
+ "snapshotting",
23
+ "fetching",
24
+ "resizing",
25
+ "saving",
26
+ "hotsyncing"
27
+ ];
28
+ const VOLUME_TRANSIENT_STATUSES = [
29
+ "snapshotting",
30
+ "fetching",
31
+ "resizing",
32
+ "saving",
33
+ "hotsyncing"
34
+ ];
35
+ exports.IMAGE_TRANSIENT_STATUSES = IMAGE_TRANSIENT_STATUSES;
36
+ exports.IP_TRANSIENT_STATUSES = IP_TRANSIENT_STATUSES;
37
+ exports.PRIVATE_NIC_TRANSIENT_STATUSES = PRIVATE_NIC_TRANSIENT_STATUSES;
38
+ exports.SECURITY_GROUP_TRANSIENT_STATUSES = SECURITY_GROUP_TRANSIENT_STATUSES;
39
+ exports.SERVER_IP_TRANSIENT_STATUSES = SERVER_IP_TRANSIENT_STATUSES;
40
+ exports.SERVER_TRANSIENT_STATUSES = SERVER_TRANSIENT_STATUSES;
41
+ exports.SNAPSHOT_TRANSIENT_STATUSES = SNAPSHOT_TRANSIENT_STATUSES;
42
+ exports.TASK_TRANSIENT_STATUSES = TASK_TRANSIENT_STATUSES;
43
+ exports.VOLUME_SERVER_TRANSIENT_STATUSES = VOLUME_SERVER_TRANSIENT_STATUSES;
44
+ exports.VOLUME_TRANSIENT_STATUSES = VOLUME_TRANSIENT_STATUSES;