@scaleway/sdk 2.2.0 → 2.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.
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ const assertValidSettings = obj => {
497
497
  }
498
498
  };
499
499
 
500
- const version = 'v2.1.0';
500
+ const version = 'v2.2.0';
501
501
  const userAgent = `scaleway-sdk-js/${version}`;
502
502
 
503
503
  const isBrowser = () =>
@@ -3852,6 +3852,7 @@ const unmarshalVolume$4 = data => {
3852
3852
  return {
3853
3853
  createdAt: unmarshalDate(data.created_at),
3854
3854
  id: data.id,
3855
+ lastDetachedAt: unmarshalDate(data.last_detached_at),
3855
3856
  name: data.name,
3856
3857
  parentSnapshotId: data.parent_snapshot_id,
3857
3858
  projectId: data.project_id,
@@ -4531,9 +4532,6 @@ const marshalDisableManagedAlertsRequest = (request, defaults) => ({
4531
4532
  const marshalEnableManagedAlertsRequest = (request, defaults) => ({
4532
4533
  project_id: request.projectId ?? defaults.defaultProjectId
4533
4534
  });
4534
- const marshalResetCockpitGrafanaRequest = (request, defaults) => ({
4535
- project_id: request.projectId ?? defaults.defaultProjectId
4536
- });
4537
4535
  const marshalResetGrafanaUserPasswordRequest = (request, defaults) => ({
4538
4536
  project_id: request.projectId ?? defaults.defaultProjectId
4539
4537
  });
@@ -4618,19 +4616,6 @@ let API$q = class API extends API$w {
4618
4616
  path: `/cockpit/v1beta1/deactivate`
4619
4617
  }, unmarshalCockpit);
4620
4618
 
4621
- /**
4622
- * Reset your Cockpit's Grafana associated with the specified Project ID.
4623
- *
4624
- * @param request - The request {@link ResetCockpitGrafanaRequest}
4625
- * @returns A Promise of Cockpit
4626
- */
4627
- resetCockpitGrafana = (request = {}) => this.client.fetch({
4628
- body: JSON.stringify(marshalResetCockpitGrafanaRequest(request, this.client.settings)),
4629
- headers: jsonContentHeaders$p,
4630
- method: 'POST',
4631
- path: `/cockpit/v1beta1/reset-grafana`
4632
- }, unmarshalCockpit);
4633
-
4634
4619
  /**
4635
4620
  * Create a datasource for the specified Project ID and the given type.
4636
4621
  *
@@ -11956,40 +11941,6 @@ const unmarshalImage$3 = data => {
11956
11941
  zone: data.zone
11957
11942
  };
11958
11943
  };
11959
- const unmarshalCreateImageResponse = data => {
11960
- if (!isJSONObject(data)) {
11961
- throw new TypeError(`Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`);
11962
- }
11963
- return {
11964
- image: data.image ? unmarshalImage$3(data.image) : undefined
11965
- };
11966
- };
11967
- const unmarshalIp$1 = data => {
11968
- if (!isJSONObject(data)) {
11969
- throw new TypeError(`Unmarshalling the type 'Ip' failed as data isn't a dictionary.`);
11970
- }
11971
- return {
11972
- address: data.address,
11973
- id: data.id,
11974
- organization: data.organization,
11975
- prefix: data.prefix,
11976
- project: data.project,
11977
- reverse: data.reverse,
11978
- server: data.server ? unmarshalServerSummary(data.server) : undefined,
11979
- state: data.state,
11980
- tags: data.tags,
11981
- type: data.type,
11982
- zone: data.zone
11983
- };
11984
- };
11985
- const unmarshalCreateIpResponse = data => {
11986
- if (!isJSONObject(data)) {
11987
- throw new TypeError(`Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`);
11988
- }
11989
- return {
11990
- ip: data.ip ? unmarshalIp$1(data.ip) : undefined
11991
- };
11992
- };
11993
11944
  const unmarshalPlacementGroup = data => {
11994
11945
  if (!isJSONObject(data)) {
11995
11946
  throw new TypeError(`Unmarshalling the type 'PlacementGroup' failed as data isn't a dictionary.`);
@@ -12006,79 +11957,6 @@ const unmarshalPlacementGroup = data => {
12006
11957
  zone: data.zone
12007
11958
  };
12008
11959
  };
12009
- const unmarshalCreatePlacementGroupResponse = data => {
12010
- if (!isJSONObject(data)) {
12011
- throw new TypeError(`Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`);
12012
- }
12013
- return {
12014
- placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
12015
- };
12016
- };
12017
- const unmarshalCreatePrivateNICResponse = data => {
12018
- if (!isJSONObject(data)) {
12019
- throw new TypeError(`Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`);
12020
- }
12021
- return {
12022
- privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
12023
- };
12024
- };
12025
- const unmarshalSecurityGroup = data => {
12026
- if (!isJSONObject(data)) {
12027
- throw new TypeError(`Unmarshalling the type 'SecurityGroup' failed as data isn't a dictionary.`);
12028
- }
12029
- return {
12030
- creationDate: unmarshalDate(data.creation_date),
12031
- description: data.description,
12032
- enableDefaultSecurity: data.enable_default_security,
12033
- id: data.id,
12034
- inboundDefaultPolicy: data.inbound_default_policy,
12035
- modificationDate: unmarshalDate(data.modification_date),
12036
- name: data.name,
12037
- organization: data.organization,
12038
- organizationDefault: data.organization_default,
12039
- outboundDefaultPolicy: data.outbound_default_policy,
12040
- project: data.project,
12041
- projectDefault: data.project_default,
12042
- servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary),
12043
- state: data.state,
12044
- stateful: data.stateful,
12045
- tags: data.tags,
12046
- zone: data.zone
12047
- };
12048
- };
12049
- const unmarshalCreateSecurityGroupResponse = data => {
12050
- if (!isJSONObject(data)) {
12051
- throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`);
12052
- }
12053
- return {
12054
- securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
12055
- };
12056
- };
12057
- const unmarshalSecurityGroupRule = data => {
12058
- if (!isJSONObject(data)) {
12059
- throw new TypeError(`Unmarshalling the type 'SecurityGroupRule' failed as data isn't a dictionary.`);
12060
- }
12061
- return {
12062
- action: data.action,
12063
- destPortFrom: data.dest_port_from,
12064
- destPortTo: data.dest_port_to,
12065
- direction: data.direction,
12066
- editable: data.editable,
12067
- id: data.id,
12068
- ipRange: data.ip_range,
12069
- position: data.position,
12070
- protocol: data.protocol,
12071
- zone: data.zone
12072
- };
12073
- };
12074
- const unmarshalCreateSecurityGroupRuleResponse = data => {
12075
- if (!isJSONObject(data)) {
12076
- throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
12077
- }
12078
- return {
12079
- rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
12080
- };
12081
- };
12082
11960
  const unmarshalSecurityGroupSummary = data => {
12083
11961
  if (!isJSONObject(data)) {
12084
11962
  throw new TypeError(`Unmarshalling the type 'SecurityGroupSummary' failed as data isn't a dictionary.`);
@@ -12193,6 +12071,121 @@ const unmarshalServer = data => {
12193
12071
  zone: data.zone
12194
12072
  };
12195
12073
  };
12074
+ const unmarshalAttachServerVolumeResponse = data => {
12075
+ if (!isJSONObject(data)) {
12076
+ throw new TypeError(`Unmarshalling the type 'AttachServerVolumeResponse' failed as data isn't a dictionary.`);
12077
+ }
12078
+ return {
12079
+ server: data.server ? unmarshalServer(data.server) : undefined
12080
+ };
12081
+ };
12082
+ const unmarshalCreateImageResponse = data => {
12083
+ if (!isJSONObject(data)) {
12084
+ throw new TypeError(`Unmarshalling the type 'CreateImageResponse' failed as data isn't a dictionary.`);
12085
+ }
12086
+ return {
12087
+ image: data.image ? unmarshalImage$3(data.image) : undefined
12088
+ };
12089
+ };
12090
+ const unmarshalIp$1 = data => {
12091
+ if (!isJSONObject(data)) {
12092
+ throw new TypeError(`Unmarshalling the type 'Ip' failed as data isn't a dictionary.`);
12093
+ }
12094
+ return {
12095
+ address: data.address,
12096
+ id: data.id,
12097
+ organization: data.organization,
12098
+ prefix: data.prefix,
12099
+ project: data.project,
12100
+ reverse: data.reverse,
12101
+ server: data.server ? unmarshalServerSummary(data.server) : undefined,
12102
+ state: data.state,
12103
+ tags: data.tags,
12104
+ type: data.type,
12105
+ zone: data.zone
12106
+ };
12107
+ };
12108
+ const unmarshalCreateIpResponse = data => {
12109
+ if (!isJSONObject(data)) {
12110
+ throw new TypeError(`Unmarshalling the type 'CreateIpResponse' failed as data isn't a dictionary.`);
12111
+ }
12112
+ return {
12113
+ ip: data.ip ? unmarshalIp$1(data.ip) : undefined
12114
+ };
12115
+ };
12116
+ const unmarshalCreatePlacementGroupResponse = data => {
12117
+ if (!isJSONObject(data)) {
12118
+ throw new TypeError(`Unmarshalling the type 'CreatePlacementGroupResponse' failed as data isn't a dictionary.`);
12119
+ }
12120
+ return {
12121
+ placementGroup: data.placement_group ? unmarshalPlacementGroup(data.placement_group) : undefined
12122
+ };
12123
+ };
12124
+ const unmarshalCreatePrivateNICResponse = data => {
12125
+ if (!isJSONObject(data)) {
12126
+ throw new TypeError(`Unmarshalling the type 'CreatePrivateNICResponse' failed as data isn't a dictionary.`);
12127
+ }
12128
+ return {
12129
+ privateNic: data.private_nic ? unmarshalPrivateNIC(data.private_nic) : undefined
12130
+ };
12131
+ };
12132
+ const unmarshalSecurityGroup = data => {
12133
+ if (!isJSONObject(data)) {
12134
+ throw new TypeError(`Unmarshalling the type 'SecurityGroup' failed as data isn't a dictionary.`);
12135
+ }
12136
+ return {
12137
+ creationDate: unmarshalDate(data.creation_date),
12138
+ description: data.description,
12139
+ enableDefaultSecurity: data.enable_default_security,
12140
+ id: data.id,
12141
+ inboundDefaultPolicy: data.inbound_default_policy,
12142
+ modificationDate: unmarshalDate(data.modification_date),
12143
+ name: data.name,
12144
+ organization: data.organization,
12145
+ organizationDefault: data.organization_default,
12146
+ outboundDefaultPolicy: data.outbound_default_policy,
12147
+ project: data.project,
12148
+ projectDefault: data.project_default,
12149
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServerSummary),
12150
+ state: data.state,
12151
+ stateful: data.stateful,
12152
+ tags: data.tags,
12153
+ zone: data.zone
12154
+ };
12155
+ };
12156
+ const unmarshalCreateSecurityGroupResponse = data => {
12157
+ if (!isJSONObject(data)) {
12158
+ throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupResponse' failed as data isn't a dictionary.`);
12159
+ }
12160
+ return {
12161
+ securityGroup: data.security_group ? unmarshalSecurityGroup(data.security_group) : undefined
12162
+ };
12163
+ };
12164
+ const unmarshalSecurityGroupRule = data => {
12165
+ if (!isJSONObject(data)) {
12166
+ throw new TypeError(`Unmarshalling the type 'SecurityGroupRule' failed as data isn't a dictionary.`);
12167
+ }
12168
+ return {
12169
+ action: data.action,
12170
+ destPortFrom: data.dest_port_from,
12171
+ destPortTo: data.dest_port_to,
12172
+ direction: data.direction,
12173
+ editable: data.editable,
12174
+ id: data.id,
12175
+ ipRange: data.ip_range,
12176
+ position: data.position,
12177
+ protocol: data.protocol,
12178
+ zone: data.zone
12179
+ };
12180
+ };
12181
+ const unmarshalCreateSecurityGroupRuleResponse = data => {
12182
+ if (!isJSONObject(data)) {
12183
+ throw new TypeError(`Unmarshalling the type 'CreateSecurityGroupRuleResponse' failed as data isn't a dictionary.`);
12184
+ }
12185
+ return {
12186
+ rule: data.rule ? unmarshalSecurityGroupRule(data.rule) : undefined
12187
+ };
12188
+ };
12196
12189
  const unmarshalCreateServerResponse = data => {
12197
12190
  if (!isJSONObject(data)) {
12198
12191
  throw new TypeError(`Unmarshalling the type 'CreateServerResponse' failed as data isn't a dictionary.`);
@@ -12263,6 +12256,14 @@ const unmarshalCreateVolumeResponse = data => {
12263
12256
  volume: data.volume ? unmarshalVolume$2(data.volume) : undefined
12264
12257
  };
12265
12258
  };
12259
+ const unmarshalDetachServerVolumeResponse = data => {
12260
+ if (!isJSONObject(data)) {
12261
+ throw new TypeError(`Unmarshalling the type 'DetachServerVolumeResponse' failed as data isn't a dictionary.`);
12262
+ }
12263
+ return {
12264
+ server: data.server ? unmarshalServer(data.server) : undefined
12265
+ };
12266
+ };
12266
12267
  const unmarshalExportSnapshotResponse = data => {
12267
12268
  if (!isJSONObject(data)) {
12268
12269
  throw new TypeError(`Unmarshalling the type 'ExportSnapshotResponse' failed as data isn't a dictionary.`);
@@ -12765,6 +12766,11 @@ const marshalApplyBlockMigrationRequest = (request, defaults) => ({
12765
12766
  value: request.snapshotId
12766
12767
  }])
12767
12768
  });
12769
+ const marshalAttachServerVolumeRequest = (request, defaults) => ({
12770
+ boot: request.boot,
12771
+ volume_id: request.volumeId,
12772
+ volume_type: request.volumeType
12773
+ });
12768
12774
  const marshalVolumeTemplate = (request, defaults) => ({
12769
12775
  id: request.id,
12770
12776
  name: request.name,
@@ -12948,6 +12954,9 @@ const marshalCreateVolumeRequest$1 = (request, defaults) => ({
12948
12954
  value: request.baseSnapshot
12949
12955
  }])
12950
12956
  });
12957
+ const marshalDetachServerVolumeRequest = (request, defaults) => ({
12958
+ volume_id: request.volumeId
12959
+ });
12951
12960
  const marshalExportSnapshotRequest = (request, defaults) => ({
12952
12961
  bucket: request.bucket,
12953
12962
  key: request.key
@@ -13408,6 +13417,32 @@ let API$j = class API extends API$w {
13408
13417
  method: 'DELETE',
13409
13418
  path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/user_data/${validatePathParam('key', request.key)}`
13410
13419
  });
13420
+
13421
+ /**
13422
+ * Attach a volume to a server.
13423
+ *
13424
+ * @param request - The request {@link AttachServerVolumeRequest}
13425
+ * @returns A Promise of AttachServerVolumeResponse
13426
+ */
13427
+ attachServerVolume = request => this.client.fetch({
13428
+ body: JSON.stringify(marshalAttachServerVolumeRequest(request, this.client.settings)),
13429
+ headers: jsonContentHeaders$i,
13430
+ method: 'POST',
13431
+ path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/attach-volume`
13432
+ }, unmarshalAttachServerVolumeResponse);
13433
+
13434
+ /**
13435
+ * Detach a volume from a server.
13436
+ *
13437
+ * @param request - The request {@link DetachServerVolumeRequest}
13438
+ * @returns A Promise of DetachServerVolumeResponse
13439
+ */
13440
+ detachServerVolume = request => this.client.fetch({
13441
+ body: JSON.stringify(marshalDetachServerVolumeRequest(request, this.client.settings)),
13442
+ headers: jsonContentHeaders$i,
13443
+ method: 'POST',
13444
+ path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/detach-volume`
13445
+ }, unmarshalDetachServerVolumeResponse);
13411
13446
  pageOfListImages = (request = {}) => this.client.fetch({
13412
13447
  method: 'GET',
13413
13448
  path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/images`,
@@ -24339,6 +24374,13 @@ let API$6 = class API extends API$w {
24339
24374
  * metadata of a secret's given version specified by the `region`,
24340
24375
  * `secret_name`, `revision` and `project_id` parameters.
24341
24376
  *
24377
+ * This method is deprecated.
24378
+ *
24379
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
24380
+ * filter to specify the secret version desired, then use the
24381
+ * `GetSecretVersion` request.
24382
+ *
24383
+ * @deprecated
24342
24384
  * @param request - The request {@link GetSecretVersionByNameRequest}
24343
24385
  * @returns A Promise of SecretVersion
24344
24386
  */
@@ -24387,6 +24429,13 @@ let API$6 = class API extends API$w {
24387
24429
  * given secret's versions specified by the `secret_name`,`region` and
24388
24430
  * `project_id` parameters.
24389
24431
  *
24432
+ * This method is deprecated.
24433
+ *
24434
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
24435
+ * filter to specify the secret version desired, then use the
24436
+ * `ListSecretVersions` request.
24437
+ *
24438
+ * @deprecated
24390
24439
  * @param request - The request {@link ListSecretVersionsByNameRequest}
24391
24440
  * @returns A Promise of ListSecretVersionsResponse
24392
24441
  */
@@ -24438,6 +24487,13 @@ let API$6 = class API extends API$w {
24438
24487
  * a secret's version specified by the `region`, `secret_name`, `revision` and
24439
24488
  * `project_id` parameters.
24440
24489
  *
24490
+ * This method is deprecated.
24491
+ *
24492
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
24493
+ * filter to specify the secret version desired, then use the
24494
+ * `AccessSecretVersion` request.
24495
+ *
24496
+ * @deprecated
24441
24497
  * @param request - The request {@link AccessSecretVersionByNameRequest}
24442
24498
  * @returns A Promise of AccessSecretVersionResponse
24443
24499
  */