@scaleway/sdk 1.25.0 → 1.27.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.
@@ -18,7 +18,7 @@ const jsonContentHeaders = {
18
18
  */
19
19
  class API extends API$1 {
20
20
  /** Lists the available zones of the API. */
21
- static LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1'];
21
+ static LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'nl-ams-2'];
22
22
  pageOfListServers = (() => {
23
23
  var _this = this;
24
24
  return function (request) {
@@ -413,6 +413,7 @@ const unmarshalServerType = data => {
413
413
  network: data.network ? unmarshalServerTypeNetwork(data.network) : undefined,
414
414
  perVolumeConstraint: data.per_volume_constraint ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) : undefined,
415
415
  ram: data.ram,
416
+ scratchStorageMaxSize: data.scratch_storage_max_size,
416
417
  volumesConstraint: data.volumes_constraint ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) : undefined
417
418
  };
418
419
  };
@@ -2,8 +2,8 @@ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
2
  import { API as API$1 } from '../../../scw/api.js';
3
3
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
4
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
- import { PIN_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse } from './marshalling.gen.js';
5
+ import { PIN_TRANSIENT_STATUSES, NAME_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse, marshalCreateNameRequest, unmarshalName, unmarshalListNamesResponse, marshalUpdateNameRequest } from './marshalling.gen.js';
7
7
 
8
8
  // This file was automatically generated. DO NOT EDIT.
9
9
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -192,6 +192,57 @@ class API extends API$1 {
192
192
  path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
193
193
  urlParams: urlParams(['volume_id', request.volumeId])
194
194
  });
195
+ createName = request => this.client.fetch({
196
+ body: JSON.stringify(marshalCreateNameRequest(request, this.client.settings)),
197
+ headers: jsonContentHeaders,
198
+ method: 'POST',
199
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names`
200
+ }, unmarshalName);
201
+ getName = request => this.client.fetch({
202
+ method: 'GET',
203
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
204
+ }, unmarshalName);
205
+
206
+ /**
207
+ * Waits for {@link Name} to be in a final state.
208
+ *
209
+ * @param request - The request {@link GetNameRequest}
210
+ * @param options - The waiting options
211
+ * @returns A Promise of Name
212
+ */
213
+ waitForName = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NAME_TRANSIENT_STATUSES.includes(res.status))), this.getName, request, options);
214
+ deleteName = request => this.client.fetch({
215
+ method: 'DELETE',
216
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
217
+ });
218
+ pageOfListNames = (() => {
219
+ var _this3 = this;
220
+ return function (request) {
221
+ if (request === void 0) {
222
+ request = {};
223
+ }
224
+ return _this3.client.fetch({
225
+ method: 'GET',
226
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/names`,
227
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
228
+ }, unmarshalListNamesResponse);
229
+ };
230
+ })();
231
+ listNames = (() => {
232
+ var _this4 = this;
233
+ return function (request) {
234
+ if (request === void 0) {
235
+ request = {};
236
+ }
237
+ return enrichForPagination('names', _this4.pageOfListNames, request);
238
+ };
239
+ })();
240
+ updateName = request => this.client.fetch({
241
+ body: JSON.stringify(marshalUpdateNameRequest(request, this.client.settings)),
242
+ headers: jsonContentHeaders,
243
+ method: 'PATCH',
244
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
245
+ }, unmarshalName);
195
246
  }
196
247
 
197
248
  export { API };
@@ -1,7 +1,10 @@
1
1
  // This file was automatically generated. DO NOT EDIT.
2
2
  // If you have any remark or suggestion do not hesitate to open an issue.
3
3
 
4
+ /** Lists transient statutes of the enum {@link NameStatus}. */
5
+ const NAME_TRANSIENT_STATUSES = ['queued', 'publishing'];
6
+
4
7
  /** Lists transient statutes of the enum {@link PinStatus}. */
5
8
  const PIN_TRANSIENT_STATUSES = ['queued', 'pinning'];
6
9
 
7
- export { PIN_TRANSIENT_STATUSES };
10
+ export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES };
@@ -1,5 +1,5 @@
1
1
  export { API } from './api.gen.js';
2
- export { PIN_TRANSIENT_STATUSES } from './content.gen.js';
2
+ export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES } from './content.gen.js';
3
3
 
4
4
  // This file was automatically generated. DO NOT EDIT.
5
5
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -34,6 +34,22 @@ const unmarshalPinInfo = data => {
34
34
  url: data.url
35
35
  };
36
36
  };
37
+ const unmarshalName = data => {
38
+ if (!isJSONObject(data)) {
39
+ throw new TypeError(`Unmarshalling the type 'Name' failed as data isn't a dictionary.`);
40
+ }
41
+ return {
42
+ cid: data.cid,
43
+ createdAt: unmarshalDate(data.created_at),
44
+ key: data.key,
45
+ name: data.name,
46
+ nameId: data.name_id,
47
+ projectId: data.project_id,
48
+ status: data.status,
49
+ tags: data.tags,
50
+ updatedAt: unmarshalDate(data.updated_at)
51
+ };
52
+ };
37
53
  const unmarshalPin = data => {
38
54
  if (!isJSONObject(data)) {
39
55
  throw new TypeError(`Unmarshalling the type 'Pin' failed as data isn't a dictionary.`);
@@ -63,6 +79,15 @@ const unmarshalVolume = data => {
63
79
  updatedAt: unmarshalDate(data.updated_at)
64
80
  };
65
81
  };
82
+ const unmarshalListNamesResponse = data => {
83
+ if (!isJSONObject(data)) {
84
+ throw new TypeError(`Unmarshalling the type 'ListNamesResponse' failed as data isn't a dictionary.`);
85
+ }
86
+ return {
87
+ names: unmarshalArrayOfObject(data.names, unmarshalName),
88
+ totalCount: data.total_count
89
+ };
90
+ };
66
91
  const unmarshalListPinsResponse = data => {
67
92
  if (!isJSONObject(data)) {
68
93
  throw new TypeError(`Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`);
@@ -93,6 +118,11 @@ const marshalPinOptions = (request, defaults) => ({
93
118
  replication_count: request.replicationCount,
94
119
  required_zones: request.requiredZones
95
120
  });
121
+ const marshalCreateNameRequest = (request, defaults) => ({
122
+ cid: request.cid,
123
+ name: request.name,
124
+ project_id: request.projectId ?? defaults.defaultProjectId
125
+ });
96
126
  const marshalCreatePinByCIDRequest = (request, defaults) => ({
97
127
  cid: request.cid,
98
128
  name: request.name,
@@ -117,9 +147,14 @@ const marshalReplacePinRequest = (request, defaults) => ({
117
147
  pin_options: request.pinOptions ? marshalPinOptions(request.pinOptions) : undefined,
118
148
  volume_id: request.volumeId
119
149
  });
150
+ const marshalUpdateNameRequest = (request, defaults) => ({
151
+ cid: request.cid,
152
+ name: request.name,
153
+ tags: request.tags
154
+ });
120
155
  const marshalUpdateVolumeRequest = (request, defaults) => ({
121
156
  name: request.name,
122
157
  tags: request.tags
123
158
  });
124
159
 
125
- export { marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalReplacePinRequest, marshalUpdateVolumeRequest, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };
160
+ export { marshalCreateNameRequest, marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalReplacePinRequest, marshalUpdateNameRequest, marshalUpdateVolumeRequest, unmarshalListNamesResponse, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalName, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };
@@ -123,6 +123,9 @@ class API extends API$1 {
123
123
 
124
124
  /**
125
125
  * Change the Cluster type. Change the type of a specific Kubernetes cluster.
126
+ * To see the possible values you can enter for the `type` field, [list
127
+ * available cluster
128
+ * types](#path-clusters-list-available-cluster-types-for-a-cluster).
126
129
  *
127
130
  * @param request - The request {@link SetClusterTypeRequest}
128
131
  * @returns A Promise of Cluster
@@ -63,7 +63,8 @@ class API extends API$1 {
63
63
  *
64
64
  * GetSecretByName usage is now deprecated.
65
65
  *
66
- * Scaleway recommends you to use ListSecrets with the `name` filter.
66
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
67
+ * filter.
67
68
  *
68
69
  * @deprecated
69
70
  * @param request - The request {@link GetSecretByNameRequest}
@@ -162,7 +163,7 @@ class API extends API$1 {
162
163
  });
163
164
 
164
165
  /**
165
- * Delete a given folder specified by the and `folder_id` parameter.
166
+ * Delete a given folder specified by the `region` and `folder_id` parameters.
166
167
  *
167
168
  * @param request - The request {@link DeleteFolderRequest}
168
169
  */
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ const assertValidSettings = obj => {
497
497
  }
498
498
  };
499
499
 
500
- const version = 'v1.24.0';
500
+ const version = 'v1.26.0';
501
501
  const userAgent = `scaleway-sdk-js/${version}`;
502
502
 
503
503
  const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
@@ -3069,7 +3069,7 @@ const jsonContentHeaders$m = {
3069
3069
  */
3070
3070
  let API$p = class API extends API$s {
3071
3071
  /** Lists the available zones of the API. */
3072
- static LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1'];
3072
+ static LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'nl-ams-2'];
3073
3073
  pageOfListServers = (request = {}) => this.client.fetch({
3074
3074
  method: 'GET',
3075
3075
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`,
@@ -9955,6 +9955,7 @@ const unmarshalServerType = data => {
9955
9955
  network: data.network ? unmarshalServerTypeNetwork(data.network) : undefined,
9956
9956
  perVolumeConstraint: data.per_volume_constraint ? unmarshalServerTypeVolumeConstraintsByType(data.per_volume_constraint) : undefined,
9957
9957
  ram: data.ram,
9958
+ scratchStorageMaxSize: data.scratch_storage_max_size,
9958
9959
  volumesConstraint: data.volumes_constraint ? unmarshalServerTypeVolumeConstraintSizes(data.volumes_constraint) : undefined
9959
9960
  };
9960
9961
  };
@@ -13080,6 +13081,9 @@ var index$g = /*#__PURE__*/Object.freeze({
13080
13081
  // This file was automatically generated. DO NOT EDIT.
13081
13082
  // If you have any remark or suggestion do not hesitate to open an issue.
13082
13083
 
13084
+ /** Lists transient statutes of the enum {@link NameStatus}. */
13085
+ const NAME_TRANSIENT_STATUSES = ['queued', 'publishing'];
13086
+
13083
13087
  /** Lists transient statutes of the enum {@link PinStatus}. */
13084
13088
  const PIN_TRANSIENT_STATUSES = ['queued', 'pinning'];
13085
13089
 
@@ -13116,6 +13120,22 @@ const unmarshalPinInfo = data => {
13116
13120
  url: data.url
13117
13121
  };
13118
13122
  };
13123
+ const unmarshalName = data => {
13124
+ if (!isJSONObject(data)) {
13125
+ throw new TypeError(`Unmarshalling the type 'Name' failed as data isn't a dictionary.`);
13126
+ }
13127
+ return {
13128
+ cid: data.cid,
13129
+ createdAt: unmarshalDate(data.created_at),
13130
+ key: data.key,
13131
+ name: data.name,
13132
+ nameId: data.name_id,
13133
+ projectId: data.project_id,
13134
+ status: data.status,
13135
+ tags: data.tags,
13136
+ updatedAt: unmarshalDate(data.updated_at)
13137
+ };
13138
+ };
13119
13139
  const unmarshalPin = data => {
13120
13140
  if (!isJSONObject(data)) {
13121
13141
  throw new TypeError(`Unmarshalling the type 'Pin' failed as data isn't a dictionary.`);
@@ -13145,6 +13165,15 @@ const unmarshalVolume$1 = data => {
13145
13165
  updatedAt: unmarshalDate(data.updated_at)
13146
13166
  };
13147
13167
  };
13168
+ const unmarshalListNamesResponse = data => {
13169
+ if (!isJSONObject(data)) {
13170
+ throw new TypeError(`Unmarshalling the type 'ListNamesResponse' failed as data isn't a dictionary.`);
13171
+ }
13172
+ return {
13173
+ names: unmarshalArrayOfObject(data.names, unmarshalName),
13174
+ totalCount: data.total_count
13175
+ };
13176
+ };
13148
13177
  const unmarshalListPinsResponse = data => {
13149
13178
  if (!isJSONObject(data)) {
13150
13179
  throw new TypeError(`Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`);
@@ -13175,6 +13204,11 @@ const marshalPinOptions = (request, defaults) => ({
13175
13204
  replication_count: request.replicationCount,
13176
13205
  required_zones: request.requiredZones
13177
13206
  });
13207
+ const marshalCreateNameRequest = (request, defaults) => ({
13208
+ cid: request.cid,
13209
+ name: request.name,
13210
+ project_id: request.projectId ?? defaults.defaultProjectId
13211
+ });
13178
13212
  const marshalCreatePinByCIDRequest = (request, defaults) => ({
13179
13213
  cid: request.cid,
13180
13214
  name: request.name,
@@ -13199,6 +13233,11 @@ const marshalReplacePinRequest = (request, defaults) => ({
13199
13233
  pin_options: request.pinOptions ? marshalPinOptions(request.pinOptions) : undefined,
13200
13234
  volume_id: request.volumeId
13201
13235
  });
13236
+ const marshalUpdateNameRequest = (request, defaults) => ({
13237
+ cid: request.cid,
13238
+ name: request.name,
13239
+ tags: request.tags
13240
+ });
13202
13241
  const marshalUpdateVolumeRequest = (request, defaults) => ({
13203
13242
  name: request.name,
13204
13243
  tags: request.tags
@@ -13375,6 +13414,41 @@ let API$f = class API extends API$s {
13375
13414
  path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
13376
13415
  urlParams: urlParams(['volume_id', request.volumeId])
13377
13416
  });
13417
+ createName = request => this.client.fetch({
13418
+ body: JSON.stringify(marshalCreateNameRequest(request, this.client.settings)),
13419
+ headers: jsonContentHeaders$d,
13420
+ method: 'POST',
13421
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names`
13422
+ }, unmarshalName);
13423
+ getName = request => this.client.fetch({
13424
+ method: 'GET',
13425
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
13426
+ }, unmarshalName);
13427
+
13428
+ /**
13429
+ * Waits for {@link Name} to be in a final state.
13430
+ *
13431
+ * @param request - The request {@link GetNameRequest}
13432
+ * @param options - The waiting options
13433
+ * @returns A Promise of Name
13434
+ */
13435
+ waitForName = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NAME_TRANSIENT_STATUSES.includes(res.status))), this.getName, request, options);
13436
+ deleteName = request => this.client.fetch({
13437
+ method: 'DELETE',
13438
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
13439
+ });
13440
+ pageOfListNames = (request = {}) => this.client.fetch({
13441
+ method: 'GET',
13442
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names`,
13443
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
13444
+ }, unmarshalListNamesResponse);
13445
+ listNames = (request = {}) => enrichForPagination('names', this.pageOfListNames, request);
13446
+ updateName = request => this.client.fetch({
13447
+ body: JSON.stringify(marshalUpdateNameRequest(request, this.client.settings)),
13448
+ headers: jsonContentHeaders$d,
13449
+ method: 'PATCH',
13450
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
13451
+ }, unmarshalName);
13378
13452
  };
13379
13453
 
13380
13454
  // This file was automatically generated. DO NOT EDIT.
@@ -13383,6 +13457,7 @@ let API$f = class API extends API$s {
13383
13457
  var index_gen$d = /*#__PURE__*/Object.freeze({
13384
13458
  __proto__: null,
13385
13459
  API: API$f,
13460
+ NAME_TRANSIENT_STATUSES: NAME_TRANSIENT_STATUSES,
13386
13461
  PIN_TRANSIENT_STATUSES: PIN_TRANSIENT_STATUSES
13387
13462
  });
13388
13463
 
@@ -13918,6 +13993,9 @@ let API$e = class API extends API$s {
13918
13993
 
13919
13994
  /**
13920
13995
  * Change the Cluster type. Change the type of a specific Kubernetes cluster.
13996
+ * To see the possible values you can enter for the `type` field, [list
13997
+ * available cluster
13998
+ * types](#path-clusters-list-available-cluster-types-for-a-cluster).
13921
13999
  *
13922
14000
  * @param request - The request {@link SetClusterTypeRequest}
13923
14001
  * @returns A Promise of Cluster
@@ -20495,7 +20573,8 @@ let API$6 = class API extends API$s {
20495
20573
  *
20496
20574
  * GetSecretByName usage is now deprecated.
20497
20575
  *
20498
- * Scaleway recommends you to use ListSecrets with the `name` filter.
20576
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
20577
+ * filter.
20499
20578
  *
20500
20579
  * @deprecated
20501
20580
  * @param request - The request {@link GetSecretByNameRequest}
@@ -20562,7 +20641,7 @@ let API$6 = class API extends API$s {
20562
20641
  });
20563
20642
 
20564
20643
  /**
20565
- * Delete a given folder specified by the and `folder_id` parameter.
20644
+ * Delete a given folder specified by the `region` and `folder_id` parameters.
20566
20645
  *
20567
20646
  * @param request - The request {@link DeleteFolderRequest}
20568
20647
  */