@scaleway/sdk 2.5.0 → 2.6.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.
- package/dist/api/instance/v1/api.gen.js +54 -15
- package/dist/api/instance/v1/api.utils.js +0 -126
- package/dist/api/instance/v1/marshalling.gen.js +76 -4
- package/dist/api/jobs/v1alpha1/api.gen.js +13 -26
- package/dist/api/k8s/v1/marshalling.gen.js +1 -0
- package/dist/index.cjs +142 -221
- package/dist/index.d.ts +141 -131
- package/dist/scw/constants.js +1 -1
- package/dist/scw/errors/scw-error.js +0 -1
- package/package.json +2 -2
- package/dist/api/instance/v1/marshalling.utils.js +0 -63
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { API as API$1 } from '../../../scw/api.js';
|
|
2
2
|
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
3
3
|
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
-
import { unmarshalGetServerTypesAvailabilityResponse, unmarshalListServersTypesResponse, unmarshalListVolumesTypesResponse, unmarshalListServersResponse, marshalCreateServerRequest, unmarshalCreateServerResponse, unmarshalGetServerResponse, marshalSetServerRequest, unmarshalSetServerResponse, marshalUpdateServerRequest, unmarshalUpdateServerResponse, unmarshalListServerActionsResponse, marshalServerActionRequest, unmarshalServerActionResponse, unmarshalListServerUserDataResponse, marshalAttachServerVolumeRequest, unmarshalAttachServerVolumeResponse, marshalDetachServerVolumeRequest, unmarshalDetachServerVolumeResponse, unmarshalListImagesResponse, unmarshalGetImageResponse, marshalCreateImageRequest, unmarshalCreateImageResponse, marshalSetImageRequest, unmarshalSetImageResponse, unmarshalListSnapshotsResponse, marshalCreateSnapshotRequest, unmarshalCreateSnapshotResponse, unmarshalGetSnapshotResponse, marshalSetSnapshotRequest, unmarshalSetSnapshotResponse, marshalExportSnapshotRequest, unmarshalExportSnapshotResponse, unmarshalListVolumesResponse, marshalCreateVolumeRequest, unmarshalCreateVolumeResponse, unmarshalGetVolumeResponse, marshalUpdateVolumeRequest, unmarshalUpdateVolumeResponse, unmarshalListSecurityGroupsResponse, marshalCreateSecurityGroupRequest, unmarshalCreateSecurityGroupResponse, unmarshalGetSecurityGroupResponse, marshalSetSecurityGroupRequest, unmarshalSetSecurityGroupResponse, unmarshalListSecurityGroupRulesResponse, marshalCreateSecurityGroupRuleRequest, unmarshalCreateSecurityGroupRuleResponse, marshalSetSecurityGroupRulesRequest, unmarshalSetSecurityGroupRulesResponse, unmarshalGetSecurityGroupRuleResponse, marshalSetSecurityGroupRuleRequest, unmarshalSetSecurityGroupRuleResponse, unmarshalListPlacementGroupsResponse, marshalCreatePlacementGroupRequest, unmarshalCreatePlacementGroupResponse, unmarshalGetPlacementGroupResponse, marshalSetPlacementGroupRequest, unmarshalSetPlacementGroupResponse, marshalUpdatePlacementGroupRequest, unmarshalUpdatePlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, marshalSetPlacementGroupServersRequest, unmarshalSetPlacementGroupServersResponse, marshalUpdatePlacementGroupServersRequest, unmarshalUpdatePlacementGroupServersResponse, unmarshalListIpsResponse, marshalCreateIpRequest, unmarshalCreateIpResponse, unmarshalGetIpResponse, marshalUpdateIpRequest, unmarshalUpdateIpResponse, unmarshalListPrivateNICsResponse, marshalCreatePrivateNICRequest, unmarshalCreatePrivateNICResponse, unmarshalGetPrivateNICResponse, marshalUpdatePrivateNICRequest, unmarshalPrivateNIC, unmarshalListBootscriptsResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, marshalPlanBlockMigrationRequest, unmarshalMigrationPlan, marshalApplyBlockMigrationRequest } from './marshalling.gen.js';
|
|
4
|
+
import { unmarshalGetServerTypesAvailabilityResponse, unmarshalListServersTypesResponse, unmarshalListVolumesTypesResponse, unmarshalListServersResponse, marshalCreateServerRequest, unmarshalCreateServerResponse, unmarshalGetServerResponse, marshalSetServerRequest, unmarshalSetServerResponse, marshalUpdateServerRequest, unmarshalUpdateServerResponse, unmarshalListServerActionsResponse, marshalServerActionRequest, unmarshalServerActionResponse, unmarshalListServerUserDataResponse, marshalAttachServerVolumeRequest, unmarshalAttachServerVolumeResponse, marshalDetachServerVolumeRequest, unmarshalDetachServerVolumeResponse, unmarshalListImagesResponse, unmarshalGetImageResponse, marshalCreateImageRequest, unmarshalCreateImageResponse, marshalSetImageRequest, unmarshalSetImageResponse, marshalUpdateImageRequest, unmarshalUpdateImageResponse, unmarshalListSnapshotsResponse, marshalCreateSnapshotRequest, unmarshalCreateSnapshotResponse, unmarshalGetSnapshotResponse, marshalSetSnapshotRequest, unmarshalSetSnapshotResponse, marshalUpdateSnapshotRequest, unmarshalUpdateSnapshotResponse, marshalExportSnapshotRequest, unmarshalExportSnapshotResponse, unmarshalListVolumesResponse, marshalCreateVolumeRequest, unmarshalCreateVolumeResponse, unmarshalGetVolumeResponse, marshalUpdateVolumeRequest, unmarshalUpdateVolumeResponse, unmarshalListSecurityGroupsResponse, marshalCreateSecurityGroupRequest, unmarshalCreateSecurityGroupResponse, unmarshalGetSecurityGroupResponse, marshalSetSecurityGroupRequest, unmarshalSetSecurityGroupResponse, marshalUpdateSecurityGroupRequest, unmarshalUpdateSecurityGroupResponse, unmarshalListSecurityGroupRulesResponse, marshalCreateSecurityGroupRuleRequest, unmarshalCreateSecurityGroupRuleResponse, marshalSetSecurityGroupRulesRequest, unmarshalSetSecurityGroupRulesResponse, unmarshalGetSecurityGroupRuleResponse, marshalSetSecurityGroupRuleRequest, unmarshalSetSecurityGroupRuleResponse, marshalUpdateSecurityGroupRuleRequest, unmarshalUpdateSecurityGroupRuleResponse, unmarshalListPlacementGroupsResponse, marshalCreatePlacementGroupRequest, unmarshalCreatePlacementGroupResponse, unmarshalGetPlacementGroupResponse, marshalSetPlacementGroupRequest, unmarshalSetPlacementGroupResponse, marshalUpdatePlacementGroupRequest, unmarshalUpdatePlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, marshalSetPlacementGroupServersRequest, unmarshalSetPlacementGroupServersResponse, marshalUpdatePlacementGroupServersRequest, unmarshalUpdatePlacementGroupServersResponse, unmarshalListIpsResponse, marshalCreateIpRequest, unmarshalCreateIpResponse, unmarshalGetIpResponse, marshalUpdateIpRequest, unmarshalUpdateIpResponse, unmarshalListPrivateNICsResponse, marshalCreatePrivateNICRequest, unmarshalCreatePrivateNICResponse, unmarshalGetPrivateNICResponse, marshalUpdatePrivateNICRequest, unmarshalPrivateNIC, unmarshalListBootscriptsResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, marshalPlanBlockMigrationRequest, unmarshalMigrationPlan, marshalApplyBlockMigrationRequest } from './marshalling.gen.js';
|
|
5
5
|
|
|
6
6
|
// This file was automatically generated. DO NOT EDIT.
|
|
7
7
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
@@ -202,26 +202,12 @@ class API extends API$1 {
|
|
|
202
202
|
method: 'DELETE',
|
|
203
203
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/user_data/${validatePathParam('key', request.key)}`
|
|
204
204
|
});
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Attach a volume to a server.
|
|
208
|
-
*
|
|
209
|
-
* @param request - The request {@link AttachServerVolumeRequest}
|
|
210
|
-
* @returns A Promise of AttachServerVolumeResponse
|
|
211
|
-
*/
|
|
212
205
|
attachServerVolume = request => this.client.fetch({
|
|
213
206
|
body: JSON.stringify(marshalAttachServerVolumeRequest(request, this.client.settings)),
|
|
214
207
|
headers: jsonContentHeaders,
|
|
215
208
|
method: 'POST',
|
|
216
209
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/attach-volume`
|
|
217
210
|
}, unmarshalAttachServerVolumeResponse);
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Detach a volume from a server.
|
|
221
|
-
*
|
|
222
|
-
* @param request - The request {@link DetachServerVolumeRequest}
|
|
223
|
-
* @returns A Promise of DetachServerVolumeResponse
|
|
224
|
-
*/
|
|
225
211
|
detachServerVolume = request => this.client.fetch({
|
|
226
212
|
body: JSON.stringify(marshalDetachServerVolumeRequest(request, this.client.settings)),
|
|
227
213
|
headers: jsonContentHeaders,
|
|
@@ -289,6 +275,19 @@ class API extends API$1 {
|
|
|
289
275
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam('id', request.id)}`
|
|
290
276
|
}, unmarshalSetImageResponse);
|
|
291
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Update image. Update the properties of an image.
|
|
280
|
+
*
|
|
281
|
+
* @param request - The request {@link UpdateImageRequest}
|
|
282
|
+
* @returns A Promise of UpdateImageResponse
|
|
283
|
+
*/
|
|
284
|
+
updateImage = request => this.client.fetch({
|
|
285
|
+
body: JSON.stringify(marshalUpdateImageRequest(request, this.client.settings)),
|
|
286
|
+
headers: jsonContentHeaders,
|
|
287
|
+
method: 'PATCH',
|
|
288
|
+
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam('imageId', request.imageId)}`
|
|
289
|
+
}, unmarshalUpdateImageResponse);
|
|
290
|
+
|
|
292
291
|
/**
|
|
293
292
|
* Delete an Instance image. Delete the image with the specified ID.
|
|
294
293
|
*
|
|
@@ -369,6 +368,19 @@ class API extends API$1 {
|
|
|
369
368
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
|
|
370
369
|
}, unmarshalSetSnapshotResponse);
|
|
371
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Update a snapshot. Update the properties of a snapshot.
|
|
373
|
+
*
|
|
374
|
+
* @param request - The request {@link UpdateSnapshotRequest}
|
|
375
|
+
* @returns A Promise of UpdateSnapshotResponse
|
|
376
|
+
*/
|
|
377
|
+
updateSnapshot = request => this.client.fetch({
|
|
378
|
+
body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
|
|
379
|
+
headers: jsonContentHeaders,
|
|
380
|
+
method: 'PATCH',
|
|
381
|
+
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
|
|
382
|
+
}, unmarshalUpdateSnapshotResponse);
|
|
383
|
+
|
|
372
384
|
/**
|
|
373
385
|
* Delete a snapshot. Delete the snapshot with the specified ID.
|
|
374
386
|
*
|
|
@@ -552,6 +564,19 @@ class API extends API$1 {
|
|
|
552
564
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam('id', request.id)}`
|
|
553
565
|
}, unmarshalSetSecurityGroupResponse);
|
|
554
566
|
|
|
567
|
+
/**
|
|
568
|
+
* Update a security group. Update the properties of security group.
|
|
569
|
+
*
|
|
570
|
+
* @param request - The request {@link UpdateSecurityGroupRequest}
|
|
571
|
+
* @returns A Promise of UpdateSecurityGroupResponse
|
|
572
|
+
*/
|
|
573
|
+
updateSecurityGroup = request => this.client.fetch({
|
|
574
|
+
body: JSON.stringify(marshalUpdateSecurityGroupRequest(request, this.client.settings)),
|
|
575
|
+
headers: jsonContentHeaders,
|
|
576
|
+
method: 'PATCH',
|
|
577
|
+
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam('securityGroupId', request.securityGroupId)}`
|
|
578
|
+
}, unmarshalUpdateSecurityGroupResponse);
|
|
579
|
+
|
|
555
580
|
/**
|
|
556
581
|
* Get default rules. Lists the default rules applied to all the security
|
|
557
582
|
* groups.
|
|
@@ -640,6 +665,20 @@ class API extends API$1 {
|
|
|
640
665
|
method: 'PUT',
|
|
641
666
|
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam('securityGroupId', request.securityGroupId)}/rules/${validatePathParam('securityGroupRuleId', request.securityGroupRuleId)}`
|
|
642
667
|
}, unmarshalSetSecurityGroupRuleResponse);
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Update security group rule. Update the properties of a rule from a
|
|
671
|
+
* specified security group.
|
|
672
|
+
*
|
|
673
|
+
* @param request - The request {@link UpdateSecurityGroupRuleRequest}
|
|
674
|
+
* @returns A Promise of UpdateSecurityGroupRuleResponse
|
|
675
|
+
*/
|
|
676
|
+
updateSecurityGroupRule = request => this.client.fetch({
|
|
677
|
+
body: JSON.stringify(marshalUpdateSecurityGroupRuleRequest(request, this.client.settings)),
|
|
678
|
+
headers: jsonContentHeaders,
|
|
679
|
+
method: 'PATCH',
|
|
680
|
+
path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam('securityGroupId', request.securityGroupId)}/rules/${validatePathParam('securityGroupRuleId', request.securityGroupRuleId)}`
|
|
681
|
+
}, unmarshalUpdateSecurityGroupRuleResponse);
|
|
643
682
|
pageOfListPlacementGroups = (() => {
|
|
644
683
|
var _this17 = this;
|
|
645
684
|
return function (request) {
|
|
@@ -2,8 +2,6 @@ import { tryAtIntervals, createExponentialBackoffStrategy } from '../../../inter
|
|
|
2
2
|
import { validatePathParam } from '../../../helpers/marshalling.js';
|
|
3
3
|
import { API } from './api.gen.js';
|
|
4
4
|
import { IMAGE_TRANSIENT_STATUSES, PRIVATE_NIC_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from './content.gen.js';
|
|
5
|
-
import { unmarshalSetImageResponse } from './marshalling.gen.js';
|
|
6
|
-
import { marshalSetImageRequestWithID } from './marshalling.utils.js';
|
|
7
5
|
|
|
8
6
|
const validateNotUndefined = obj => {
|
|
9
7
|
if (obj === undefined) throw new TypeError(`object was found undefined`);
|
|
@@ -85,104 +83,6 @@ class InstanceV1UtilsAPI extends API {
|
|
|
85
83
|
};
|
|
86
84
|
}, createExponentialBackoffStrategy(options?.minDelay ?? 1, options?.maxDelay ?? 30), options?.timeout);
|
|
87
85
|
|
|
88
|
-
/**
|
|
89
|
-
* Updates a snapshot.
|
|
90
|
-
*
|
|
91
|
-
* @param request - The request {@link UpdateSnapshotRequest}
|
|
92
|
-
* @returns A Promise of UpdateSnapshotResponse
|
|
93
|
-
*/
|
|
94
|
-
updateSnapshot = request => this.getSnapshot(request).then(res => validateNotUndefined(res.snapshot)).then(snapshot => this._setSnapshot({
|
|
95
|
-
...snapshot,
|
|
96
|
-
name: request.name ?? snapshot.name,
|
|
97
|
-
snapshotId: snapshot.id
|
|
98
|
-
})).then(res => ({
|
|
99
|
-
snapshot: res.snapshot
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Updates a security group.
|
|
104
|
-
*
|
|
105
|
-
* @param request - The request {@link UpdateSecurityGroupRequest}
|
|
106
|
-
* @returns A Promise of UpdateSecurityGroupResponse
|
|
107
|
-
*/
|
|
108
|
-
updateSecurityGroup = request => this.getSecurityGroup({
|
|
109
|
-
securityGroupId: request.securityGroupId,
|
|
110
|
-
zone: request.zone
|
|
111
|
-
}).then(res => validateNotUndefined(res.securityGroup)).then(securityGroup => this._setSecurityGroup({
|
|
112
|
-
creationDate: securityGroup.creationDate,
|
|
113
|
-
description: request.description ?? securityGroup.description,
|
|
114
|
-
enableDefaultSecurity: request.enableDefaultSecurity ?? securityGroup.enableDefaultSecurity,
|
|
115
|
-
id: securityGroup.id,
|
|
116
|
-
inboundDefaultPolicy: request.inboundDefaultPolicy ?? securityGroup.inboundDefaultPolicy,
|
|
117
|
-
modificationDate: securityGroup.modificationDate,
|
|
118
|
-
name: request.name ?? securityGroup.name,
|
|
119
|
-
organization: securityGroup.organization,
|
|
120
|
-
organizationDefault: request.organizationDefault ?? securityGroup.organizationDefault,
|
|
121
|
-
outboundDefaultPolicy: request.outboundDefaultPolicy ?? securityGroup.outboundDefaultPolicy,
|
|
122
|
-
project: securityGroup.project,
|
|
123
|
-
projectDefault: request.projectDefault ?? securityGroup.projectDefault,
|
|
124
|
-
servers: securityGroup.servers,
|
|
125
|
-
stateful: request.stateful ?? securityGroup.stateful,
|
|
126
|
-
zone: request.zone
|
|
127
|
-
})).then(res => ({
|
|
128
|
-
securityGroup: res.securityGroup
|
|
129
|
-
}));
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Updates a security group rule.
|
|
133
|
-
*
|
|
134
|
-
* @param request - The request {@link UpdateSecurityGroupRuleRequest}
|
|
135
|
-
* @returns A Promise of UpdateSecurityGroupRuleResponse
|
|
136
|
-
*/
|
|
137
|
-
updateSecurityGroupRule = request => this.getSecurityGroupRule({
|
|
138
|
-
securityGroupId: request.securityGroupId,
|
|
139
|
-
securityGroupRuleId: request.securityGroupRuleId,
|
|
140
|
-
zone: request.zone
|
|
141
|
-
}).then(res => validateNotUndefined(res.rule)).then(rule => {
|
|
142
|
-
let sReq = {
|
|
143
|
-
action: request.action ?? rule.action,
|
|
144
|
-
destPortFrom: rule.destPortFrom,
|
|
145
|
-
destPortTo: rule.destPortTo,
|
|
146
|
-
direction: request.direction ?? rule.direction,
|
|
147
|
-
editable: rule.editable,
|
|
148
|
-
id: request.securityGroupRuleId,
|
|
149
|
-
ipRange: request.ipRange ?? rule.ipRange,
|
|
150
|
-
position: request.position ?? rule.position,
|
|
151
|
-
protocol: request.protocol ?? rule.protocol,
|
|
152
|
-
securityGroupId: request.securityGroupId,
|
|
153
|
-
securityGroupRuleId: request.securityGroupRuleId
|
|
154
|
-
};
|
|
155
|
-
if (request.destPortFrom) {
|
|
156
|
-
sReq = {
|
|
157
|
-
...sReq,
|
|
158
|
-
destPortFrom: request.destPortFrom > 0 ? request.destPortFrom : undefined
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
if (request.destPortTo) {
|
|
162
|
-
sReq = {
|
|
163
|
-
...sReq,
|
|
164
|
-
destPortTo: request.destPortTo > 0 ? request.destPortTo : undefined
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
if (sReq.destPortFrom && sReq.destPortTo && sReq.destPortFrom === sReq.destPortTo) {
|
|
168
|
-
sReq = {
|
|
169
|
-
...sReq,
|
|
170
|
-
destPortTo: undefined
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
// When we use ICMP protocol portFrom and portTo should be set to nil
|
|
174
|
-
if (request.protocol === 'ICMP') {
|
|
175
|
-
sReq = {
|
|
176
|
-
...sReq,
|
|
177
|
-
destPortFrom: undefined,
|
|
178
|
-
destPortTo: undefined
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return this._setSecurityGroupRule(sReq);
|
|
182
|
-
}).then(res => ({
|
|
183
|
-
rule: res.rule
|
|
184
|
-
}));
|
|
185
|
-
|
|
186
86
|
/**
|
|
187
87
|
* Updates a server.
|
|
188
88
|
*
|
|
@@ -263,7 +163,6 @@ class InstanceV1UtilsAPI extends API {
|
|
|
263
163
|
id: request.volumeId,
|
|
264
164
|
name: request.volumeId // name is ignored on this PATCH
|
|
265
165
|
};
|
|
266
|
-
|
|
267
166
|
found = true;
|
|
268
167
|
break;
|
|
269
168
|
}
|
|
@@ -315,31 +214,6 @@ class InstanceV1UtilsAPI extends API {
|
|
|
315
214
|
}).then(obj => obj);
|
|
316
215
|
};
|
|
317
216
|
|
|
318
|
-
/**
|
|
319
|
-
* Updates an image.
|
|
320
|
-
*
|
|
321
|
-
* @param request - The request {@link UpdateImageRequest}
|
|
322
|
-
* @returns A Promise of UpdateImageResponse
|
|
323
|
-
*/
|
|
324
|
-
updateImage = request => this.getImage({
|
|
325
|
-
zone: request.zone,
|
|
326
|
-
imageId: request.imageId
|
|
327
|
-
}).then(res => validateNotUndefined(res.image)).then(image => ({
|
|
328
|
-
...image,
|
|
329
|
-
name: request.name ?? image.name,
|
|
330
|
-
tags: request.tags ?? image.tags,
|
|
331
|
-
id: image.id
|
|
332
|
-
})).then(imageReq => this.client.fetch({
|
|
333
|
-
body: JSON.stringify(marshalSetImageRequestWithID(imageReq, this.client.settings)),
|
|
334
|
-
headers: {
|
|
335
|
-
'Content-Type': 'application/json; charset=utf-8'
|
|
336
|
-
},
|
|
337
|
-
method: 'PUT',
|
|
338
|
-
path: `/instance/v1/zones/${validatePathParam('zone', imageReq.zone)}/images/${validatePathParam('id', imageReq.id)}`
|
|
339
|
-
}, unmarshalSetImageResponse)).then(res => ({
|
|
340
|
-
image: res.image
|
|
341
|
-
}));
|
|
342
|
-
|
|
343
217
|
/**
|
|
344
218
|
* Get the content of a user data on a server for the given key.
|
|
345
219
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
2
|
import { isJSONObject } from '../../../helpers/json.js';
|
|
3
|
-
import {
|
|
3
|
+
import { unmarshalArrayOfObject, unmarshalMapOfObject, resolveOneOf, unmarshalDate } from '../../../helpers/marshalling.js';
|
|
4
4
|
|
|
5
5
|
// This file was automatically generated. DO NOT EDIT.
|
|
6
6
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
@@ -873,6 +873,14 @@ const unmarshalSetSnapshotResponse = data => {
|
|
|
873
873
|
snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
|
|
874
874
|
};
|
|
875
875
|
};
|
|
876
|
+
const unmarshalUpdateImageResponse = data => {
|
|
877
|
+
if (!isJSONObject(data)) {
|
|
878
|
+
throw new TypeError(`Unmarshalling the type 'UpdateImageResponse' failed as data isn't a dictionary.`);
|
|
879
|
+
}
|
|
880
|
+
return {
|
|
881
|
+
image: data.image ? unmarshalImage(data.image) : undefined
|
|
882
|
+
};
|
|
883
|
+
};
|
|
876
884
|
const unmarshalUpdateIpResponse = data => {
|
|
877
885
|
if (!isJSONObject(data)) {
|
|
878
886
|
throw new TypeError(`Unmarshalling the type 'UpdateIpResponse' failed as data isn't a dictionary.`);
|
|
@@ -897,6 +905,22 @@ const unmarshalUpdatePlacementGroupServersResponse = data => {
|
|
|
897
905
|
servers: unmarshalArrayOfObject(data.servers, unmarshalPlacementGroupServer)
|
|
898
906
|
};
|
|
899
907
|
};
|
|
908
|
+
const unmarshalUpdateSecurityGroupResponse = data => {
|
|
909
|
+
if (!isJSONObject(data)) {
|
|
910
|
+
throw new TypeError(`Unmarshalling the type 'UpdateSecurityGroupResponse' failed as data isn't a dictionary.`);
|
|
911
|
+
}
|
|
912
|
+
return {
|
|
913
|
+
securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
|
|
914
|
+
};
|
|
915
|
+
};
|
|
916
|
+
const unmarshalUpdateSecurityGroupRuleResponse = data => {
|
|
917
|
+
if (!isJSONObject(data)) {
|
|
918
|
+
throw new TypeError(`Unmarshalling the type 'UpdateSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
|
|
919
|
+
}
|
|
920
|
+
return {
|
|
921
|
+
rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
|
|
922
|
+
};
|
|
923
|
+
};
|
|
900
924
|
const unmarshalUpdateServerResponse = data => {
|
|
901
925
|
if (!isJSONObject(data)) {
|
|
902
926
|
throw new TypeError(`Unmarshalling the type 'UpdateServerResponse' failed as data isn't a dictionary.`);
|
|
@@ -905,6 +929,14 @@ const unmarshalUpdateServerResponse = data => {
|
|
|
905
929
|
server: data.server ? unmarshalServer(data.server) : undefined
|
|
906
930
|
};
|
|
907
931
|
};
|
|
932
|
+
const unmarshalUpdateSnapshotResponse = data => {
|
|
933
|
+
if (!isJSONObject(data)) {
|
|
934
|
+
throw new TypeError(`Unmarshalling the type 'UpdateSnapshotResponse' failed as data isn't a dictionary.`);
|
|
935
|
+
}
|
|
936
|
+
return {
|
|
937
|
+
snapshot: data.snapshot ? unmarshalSnapshot(data.snapshot) : undefined
|
|
938
|
+
};
|
|
939
|
+
};
|
|
908
940
|
const unmarshalUpdateVolumeResponse = data => {
|
|
909
941
|
if (!isJSONObject(data)) {
|
|
910
942
|
throw new TypeError(`Unmarshalling the type 'UpdateVolumeResponse' failed as data isn't a dictionary.`);
|
|
@@ -1383,6 +1415,22 @@ const marshalSetSnapshotRequest = (request, defaults) => ({
|
|
|
1383
1415
|
tags: request.tags,
|
|
1384
1416
|
volume_type: request.volumeType
|
|
1385
1417
|
});
|
|
1418
|
+
const marshalVolumeImageUpdateTemplate = (request, defaults) => ({
|
|
1419
|
+
id: request.id
|
|
1420
|
+
});
|
|
1421
|
+
const marshalUpdateImageRequest = (request, defaults) => ({
|
|
1422
|
+
arch: request.arch,
|
|
1423
|
+
extra_volumes: request.extraVolumes !== undefined ? Object.entries(request.extraVolumes).reduce((acc, _ref7) => {
|
|
1424
|
+
let [key, value] = _ref7;
|
|
1425
|
+
return {
|
|
1426
|
+
...acc,
|
|
1427
|
+
[key]: marshalVolumeImageUpdateTemplate(value)
|
|
1428
|
+
};
|
|
1429
|
+
}, {}) : undefined,
|
|
1430
|
+
name: request.name,
|
|
1431
|
+
public: request.public,
|
|
1432
|
+
tags: request.tags
|
|
1433
|
+
});
|
|
1386
1434
|
const marshalUpdateIpRequest = (request, defaults) => ({
|
|
1387
1435
|
reverse: request.reverse,
|
|
1388
1436
|
server: request.server,
|
|
@@ -1401,6 +1449,26 @@ const marshalUpdatePlacementGroupServersRequest = (request, defaults) => ({
|
|
|
1401
1449
|
const marshalUpdatePrivateNICRequest = (request, defaults) => ({
|
|
1402
1450
|
tags: request.tags
|
|
1403
1451
|
});
|
|
1452
|
+
const marshalUpdateSecurityGroupRequest = (request, defaults) => ({
|
|
1453
|
+
description: request.description,
|
|
1454
|
+
enable_default_security: request.enableDefaultSecurity,
|
|
1455
|
+
inbound_default_policy: request.inboundDefaultPolicy,
|
|
1456
|
+
name: request.name,
|
|
1457
|
+
organization_default: request.organizationDefault,
|
|
1458
|
+
outbound_default_policy: request.outboundDefaultPolicy,
|
|
1459
|
+
project_default: request.projectDefault,
|
|
1460
|
+
stateful: request.stateful,
|
|
1461
|
+
tags: request.tags
|
|
1462
|
+
});
|
|
1463
|
+
const marshalUpdateSecurityGroupRuleRequest = (request, defaults) => ({
|
|
1464
|
+
action: request.action,
|
|
1465
|
+
dest_port_from: request.destPortFrom,
|
|
1466
|
+
dest_port_to: request.destPortTo,
|
|
1467
|
+
direction: request.direction,
|
|
1468
|
+
ip_range: request.ipRange,
|
|
1469
|
+
position: request.position,
|
|
1470
|
+
protocol: request.protocol
|
|
1471
|
+
});
|
|
1404
1472
|
const marshalSecurityGroupTemplate = (request, defaults) => ({
|
|
1405
1473
|
id: request.id,
|
|
1406
1474
|
name: request.name
|
|
@@ -1419,18 +1487,22 @@ const marshalUpdateServerRequest = (request, defaults) => ({
|
|
|
1419
1487
|
routed_ip_enabled: request.routedIpEnabled,
|
|
1420
1488
|
security_group: request.securityGroup !== undefined ? marshalSecurityGroupTemplate(request.securityGroup) : undefined,
|
|
1421
1489
|
tags: request.tags,
|
|
1422
|
-
volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc,
|
|
1423
|
-
let [key, value] =
|
|
1490
|
+
volumes: request.volumes !== undefined ? Object.entries(request.volumes).reduce((acc, _ref8) => {
|
|
1491
|
+
let [key, value] = _ref8;
|
|
1424
1492
|
return {
|
|
1425
1493
|
...acc,
|
|
1426
1494
|
[key]: marshalVolumeServerTemplate(value)
|
|
1427
1495
|
};
|
|
1428
1496
|
}, {}) : undefined
|
|
1429
1497
|
});
|
|
1498
|
+
const marshalUpdateSnapshotRequest = (request, defaults) => ({
|
|
1499
|
+
name: request.name,
|
|
1500
|
+
tags: request.tags
|
|
1501
|
+
});
|
|
1430
1502
|
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
1431
1503
|
name: request.name,
|
|
1432
1504
|
size: request.size,
|
|
1433
1505
|
tags: request.tags
|
|
1434
1506
|
});
|
|
1435
1507
|
|
|
1436
|
-
export { marshalApplyBlockMigrationRequest, marshalAttachServerVolumeRequest, marshalCreateImageRequest, marshalCreateIpRequest, marshalCreatePlacementGroupRequest, marshalCreatePrivateNICRequest, marshalCreateSecurityGroupRequest, marshalCreateSecurityGroupRuleRequest, marshalCreateServerRequest, marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalDetachServerVolumeRequest, marshalExportSnapshotRequest, marshalPlanBlockMigrationRequest, marshalServerActionRequest, marshalSetImageRequest, marshalSetPlacementGroupRequest, marshalSetPlacementGroupServersRequest, marshalSetSecurityGroupRequest, marshalSetSecurityGroupRuleRequest, marshalSetSecurityGroupRulesRequest, marshalSetServerRequest, marshalSetSnapshotRequest, marshalUpdateIpRequest, marshalUpdatePlacementGroupRequest, marshalUpdatePlacementGroupServersRequest, marshalUpdatePrivateNICRequest, marshalUpdateServerRequest, marshalUpdateVolumeRequest, unmarshalAttachServerVolumeResponse, unmarshalCreateImageResponse, unmarshalCreateIpResponse, unmarshalCreatePlacementGroupResponse, unmarshalCreatePrivateNICResponse, unmarshalCreateSecurityGroupResponse, unmarshalCreateSecurityGroupRuleResponse, unmarshalCreateServerResponse, unmarshalCreateSnapshotResponse, unmarshalCreateVolumeResponse, unmarshalDetachServerVolumeResponse, unmarshalExportSnapshotResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, unmarshalGetImageResponse, unmarshalGetIpResponse, unmarshalGetPlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, unmarshalGetPrivateNICResponse, unmarshalGetSecurityGroupResponse, unmarshalGetSecurityGroupRuleResponse, unmarshalGetServerResponse, unmarshalGetServerTypesAvailabilityResponse, unmarshalGetSnapshotResponse, unmarshalGetVolumeResponse, unmarshalListBootscriptsResponse, unmarshalListImagesResponse, unmarshalListIpsResponse, unmarshalListPlacementGroupsResponse, unmarshalListPrivateNICsResponse, unmarshalListSecurityGroupRulesResponse, unmarshalListSecurityGroupsResponse, unmarshalListServerActionsResponse, unmarshalListServerUserDataResponse, unmarshalListServersResponse, unmarshalListServersTypesResponse, unmarshalListSnapshotsResponse, unmarshalListVolumesResponse, unmarshalListVolumesTypesResponse, unmarshalMigrationPlan, unmarshalPrivateNIC, unmarshalServerActionResponse, unmarshalSetImageResponse, unmarshalSetPlacementGroupResponse, unmarshalSetPlacementGroupServersResponse, unmarshalSetSecurityGroupResponse, unmarshalSetSecurityGroupRuleResponse, unmarshalSetSecurityGroupRulesResponse, unmarshalSetServerResponse, unmarshalSetSnapshotResponse, unmarshalUpdateIpResponse, unmarshalUpdatePlacementGroupResponse, unmarshalUpdatePlacementGroupServersResponse, unmarshalUpdateServerResponse, unmarshalUpdateVolumeResponse };
|
|
1508
|
+
export { marshalApplyBlockMigrationRequest, marshalAttachServerVolumeRequest, marshalCreateImageRequest, marshalCreateIpRequest, marshalCreatePlacementGroupRequest, marshalCreatePrivateNICRequest, marshalCreateSecurityGroupRequest, marshalCreateSecurityGroupRuleRequest, marshalCreateServerRequest, marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalDetachServerVolumeRequest, marshalExportSnapshotRequest, marshalPlanBlockMigrationRequest, marshalServerActionRequest, marshalSetImageRequest, marshalSetPlacementGroupRequest, marshalSetPlacementGroupServersRequest, marshalSetSecurityGroupRequest, marshalSetSecurityGroupRuleRequest, marshalSetSecurityGroupRulesRequest, marshalSetServerRequest, marshalSetSnapshotRequest, marshalUpdateImageRequest, marshalUpdateIpRequest, marshalUpdatePlacementGroupRequest, marshalUpdatePlacementGroupServersRequest, marshalUpdatePrivateNICRequest, marshalUpdateSecurityGroupRequest, marshalUpdateSecurityGroupRuleRequest, marshalUpdateServerRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalAttachServerVolumeResponse, unmarshalCreateImageResponse, unmarshalCreateIpResponse, unmarshalCreatePlacementGroupResponse, unmarshalCreatePrivateNICResponse, unmarshalCreateSecurityGroupResponse, unmarshalCreateSecurityGroupRuleResponse, unmarshalCreateServerResponse, unmarshalCreateSnapshotResponse, unmarshalCreateVolumeResponse, unmarshalDetachServerVolumeResponse, unmarshalExportSnapshotResponse, unmarshalGetBootscriptResponse, unmarshalGetDashboardResponse, unmarshalGetImageResponse, unmarshalGetIpResponse, unmarshalGetPlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, unmarshalGetPrivateNICResponse, unmarshalGetSecurityGroupResponse, unmarshalGetSecurityGroupRuleResponse, unmarshalGetServerResponse, unmarshalGetServerTypesAvailabilityResponse, unmarshalGetSnapshotResponse, unmarshalGetVolumeResponse, unmarshalListBootscriptsResponse, unmarshalListImagesResponse, unmarshalListIpsResponse, unmarshalListPlacementGroupsResponse, unmarshalListPrivateNICsResponse, unmarshalListSecurityGroupRulesResponse, unmarshalListSecurityGroupsResponse, unmarshalListServerActionsResponse, unmarshalListServerUserDataResponse, unmarshalListServersResponse, unmarshalListServersTypesResponse, unmarshalListSnapshotsResponse, unmarshalListVolumesResponse, unmarshalListVolumesTypesResponse, unmarshalMigrationPlan, unmarshalPrivateNIC, unmarshalServerActionResponse, unmarshalSetImageResponse, unmarshalSetPlacementGroupResponse, unmarshalSetPlacementGroupServersResponse, unmarshalSetSecurityGroupResponse, unmarshalSetSecurityGroupRuleResponse, unmarshalSetSecurityGroupRulesResponse, unmarshalSetServerResponse, unmarshalSetSnapshotResponse, unmarshalUpdateImageResponse, unmarshalUpdateIpResponse, unmarshalUpdatePlacementGroupResponse, unmarshalUpdatePlacementGroupServersResponse, unmarshalUpdateSecurityGroupResponse, unmarshalUpdateSecurityGroupRuleResponse, unmarshalUpdateServerResponse, unmarshalUpdateSnapshotResponse, unmarshalUpdateVolumeResponse };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { API as API$1 } from '../../../scw/api.js';
|
|
2
|
-
import { unmarshalServiceInfo } from '../../../scw/custom-marshalling.js';
|
|
3
|
-
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
2
|
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
4
|
import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, unmarshalJobRun, unmarshalListJobRunsResponse } from './marshalling.gen.js';
|
|
6
5
|
|
|
7
6
|
// This file was automatically generated. DO NOT EDIT.
|
|
@@ -14,18 +13,6 @@ const jsonContentHeaders = {
|
|
|
14
13
|
class API extends API$1 {
|
|
15
14
|
/** Lists the available regions of the API. */
|
|
16
15
|
static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
|
|
17
|
-
getServiceInfo = (() => {
|
|
18
|
-
var _this = this;
|
|
19
|
-
return function (request) {
|
|
20
|
-
if (request === void 0) {
|
|
21
|
-
request = {};
|
|
22
|
-
}
|
|
23
|
-
return _this.client.fetch({
|
|
24
|
-
method: 'GET',
|
|
25
|
-
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}`
|
|
26
|
-
}, unmarshalServiceInfo);
|
|
27
|
-
};
|
|
28
|
-
})();
|
|
29
16
|
createJobDefinition = request => this.client.fetch({
|
|
30
17
|
body: JSON.stringify(marshalCreateJobDefinitionRequest(request, this.client.settings)),
|
|
31
18
|
headers: jsonContentHeaders,
|
|
@@ -37,25 +24,25 @@ class API extends API$1 {
|
|
|
37
24
|
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
|
|
38
25
|
}, unmarshalJobDefinition);
|
|
39
26
|
pageOfListJobDefinitions = (() => {
|
|
40
|
-
var
|
|
27
|
+
var _this = this;
|
|
41
28
|
return function (request) {
|
|
42
29
|
if (request === void 0) {
|
|
43
30
|
request = {};
|
|
44
31
|
}
|
|
45
|
-
return
|
|
32
|
+
return _this.client.fetch({
|
|
46
33
|
method: 'GET',
|
|
47
|
-
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ??
|
|
48
|
-
urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ??
|
|
34
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/job-definitions`,
|
|
35
|
+
urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
49
36
|
}, unmarshalListJobDefinitionsResponse);
|
|
50
37
|
};
|
|
51
38
|
})();
|
|
52
39
|
listJobDefinitions = (() => {
|
|
53
|
-
var
|
|
40
|
+
var _this2 = this;
|
|
54
41
|
return function (request) {
|
|
55
42
|
if (request === void 0) {
|
|
56
43
|
request = {};
|
|
57
44
|
}
|
|
58
|
-
return enrichForPagination('jobDefinitions',
|
|
45
|
+
return enrichForPagination('jobDefinitions', _this2.pageOfListJobDefinitions, request);
|
|
59
46
|
};
|
|
60
47
|
})();
|
|
61
48
|
updateJobDefinition = request => this.client.fetch({
|
|
@@ -85,25 +72,25 @@ class API extends API$1 {
|
|
|
85
72
|
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}/stop`
|
|
86
73
|
}, unmarshalJobRun);
|
|
87
74
|
pageOfListJobRuns = (() => {
|
|
88
|
-
var
|
|
75
|
+
var _this3 = this;
|
|
89
76
|
return function (request) {
|
|
90
77
|
if (request === void 0) {
|
|
91
78
|
request = {};
|
|
92
79
|
}
|
|
93
|
-
return
|
|
80
|
+
return _this3.client.fetch({
|
|
94
81
|
method: 'GET',
|
|
95
|
-
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ??
|
|
96
|
-
urlParams: urlParams(['job_definition_id', request.jobDefinitionId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ??
|
|
82
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/job-runs`,
|
|
83
|
+
urlParams: urlParams(['job_definition_id', request.jobDefinitionId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
97
84
|
}, unmarshalListJobRunsResponse);
|
|
98
85
|
};
|
|
99
86
|
})();
|
|
100
87
|
listJobRuns = (() => {
|
|
101
|
-
var
|
|
88
|
+
var _this4 = this;
|
|
102
89
|
return function (request) {
|
|
103
90
|
if (request === void 0) {
|
|
104
91
|
request = {};
|
|
105
92
|
}
|
|
106
|
-
return enrichForPagination('jobRuns',
|
|
93
|
+
return enrichForPagination('jobRuns', _this4.pageOfListJobRuns, request);
|
|
107
94
|
};
|
|
108
95
|
})();
|
|
109
96
|
}
|