@scaleway/sdk 1.5.0 → 1.7.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.
Files changed (46) hide show
  1. package/dist/api/applesilicon/v1alpha1/api.gen.js +2 -2
  2. package/dist/api/baremetal/v1/api.gen.js +3 -3
  3. package/dist/api/baremetal/v1/api.utils.js +1 -1
  4. package/dist/api/cockpit/v1beta1/api.gen.js +89 -29
  5. package/dist/api/cockpit/v1beta1/marshalling.gen.js +44 -1
  6. package/dist/api/container/v1beta1/api.gen.js +35 -29
  7. package/dist/api/container/v1beta1/marshalling.gen.js +1 -1
  8. package/dist/api/domain/v2beta1/api.gen.js +2 -2
  9. package/dist/api/flexibleip/v1alpha1/api.gen.js +2 -2
  10. package/dist/api/function/v1beta1/api.gen.js +40 -31
  11. package/dist/api/function/v1beta1/marshalling.gen.js +1 -20
  12. package/dist/api/iam/v1alpha1/api.gen.js +2 -3
  13. package/dist/api/iam/v1alpha1/marshalling.gen.js +1 -0
  14. package/dist/api/iam/v1alpha1/validation-rules.gen.js +10 -10
  15. package/dist/api/instance/v1/api.gen.js +86 -67
  16. package/dist/api/instance/v1/api.utils.js +7 -13
  17. package/dist/api/iot/v1/api.gen.js +2 -2
  18. package/dist/api/k8s/v1/api.gen.js +4 -4
  19. package/dist/api/lb/v1/api.gen.js +6 -6
  20. package/dist/api/lb/v1/api.utils.js +4 -4
  21. package/dist/api/lb/v1/marshalling.gen.js +33 -19
  22. package/dist/api/marketplace/v2/api.gen.js +46 -3
  23. package/dist/api/mnq/v1alpha1/api.gen.js +36 -13
  24. package/dist/api/rdb/v1/api.gen.js +6 -6
  25. package/dist/api/redis/v1/api.gen.js +2 -2
  26. package/dist/api/redis/v1/marshalling.gen.js +2 -0
  27. package/dist/api/registry/v1/api.gen.js +4 -4
  28. package/dist/api/secret/v1alpha1/api.gen.js +27 -16
  29. package/dist/api/secret/v1alpha1/marshalling.gen.js +22 -3
  30. package/dist/api/tem/v1alpha1/api.gen.js +3 -3
  31. package/dist/api/test/v1/api.gen.js +1 -1
  32. package/dist/api/vpc/v1/api.gen.js +15 -7
  33. package/dist/api/vpcgw/v1/api.gen.js +3 -3
  34. package/dist/api/webhosting/v1alpha1/api.gen.js +2 -2
  35. package/dist/helpers/marshalling.js +1 -1
  36. package/dist/index.cjs +513 -234
  37. package/dist/index.d.ts +1469 -736
  38. package/dist/internal/async/interval-retrier.js +8 -2
  39. package/dist/internal/logger/level-resolver.js +3 -3
  40. package/dist/scw/client-ini-factory.js +6 -0
  41. package/dist/scw/client-ini-profile.js +18 -0
  42. package/dist/scw/client-settings.js +12 -0
  43. package/dist/scw/constants.js +1 -1
  44. package/dist/scw/custom-marshalling.js +4 -7
  45. package/dist/scw/errors/standard/quotas-exceeded-error.js +6 -0
  46. package/package.json +2 -2
@@ -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 { marshalCreateSecretRequest, unmarshalSecret, marshalUpdateSecretRequest, unmarshalListSecretsResponse, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse } from './marshalling.gen.js';
4
+ import { marshalCreateSecretRequest, unmarshalSecret, marshalUpdateSecretRequest, unmarshalListSecretsResponse, marshalAddSecretOwnerRequest, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse } from './marshalling.gen.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
7
  const jsonContentHeaders = {
@@ -74,7 +74,7 @@ class API extends API$1 {
74
74
  return _this.client.fetch({
75
75
  method: 'GET',
76
76
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets`,
77
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'name_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
77
+ urlParams: urlParams(['is_managed', request.isManaged], ['name', request.name], ['order_by', request.orderBy ?? 'name_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
78
78
  }, unmarshalListSecretsResponse);
79
79
  };
80
80
  /**
@@ -101,6 +101,17 @@ class API extends API$1 {
101
101
  method: 'DELETE',
102
102
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
103
103
  });
104
+ /**
105
+ * Allow a product to use the secret.
106
+ *
107
+ * @param request - The request {@link AddSecretOwnerRequest}
108
+ */
109
+ this.addSecretOwner = request => this.client.fetch({
110
+ body: JSON.stringify(marshalAddSecretOwnerRequest(request, this.client.settings)),
111
+ headers: jsonContentHeaders,
112
+ method: 'POST',
113
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/add-owner`
114
+ });
104
115
  /**
105
116
  * Create a version. Create a version of a given secret specified by the
106
117
  * `region` and `secret_id` parameters.
@@ -179,19 +190,6 @@ class API extends API$1 {
179
190
  * @returns A Promise of ListSecretVersionsResponse
180
191
  */
181
192
  this.listSecretVersionsByName = request => enrichForPagination('versions', this.pageOfListSecretVersionsByName, request);
182
- /**
183
- * Delete a version. Delete a secret's version and the sensitive data
184
- * contained in it. Deleting a version is permanent and cannot be undone.
185
- *
186
- * @param request - The request {@link DestroySecretVersionRequest}
187
- * @returns A Promise of SecretVersion
188
- */
189
- this.destroySecretVersion = request => this.client.fetch({
190
- body: '{}',
191
- headers: jsonContentHeaders,
192
- method: 'POST',
193
- path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/destroy`
194
- }, unmarshalSecretVersion);
195
193
  /**
196
194
  * Enable a version. Make a specific version accessible. You must specify the
197
195
  * `region`, `secret_id` and `revision` parameters.
@@ -242,9 +240,22 @@ class API extends API$1 {
242
240
  method: 'GET',
243
241
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}/versions/${validatePathParam('revision', request.revision)}/access`
244
242
  }, unmarshalAccessSecretVersionResponse);
243
+ /**
244
+ * Delete a version. Delete a secret's version and the sensitive data
245
+ * contained in it. Deleting a version is permanent and cannot be undone.
246
+ *
247
+ * @param request - The request {@link DestroySecretVersionRequest}
248
+ * @returns A Promise of SecretVersion
249
+ */
250
+ this.destroySecretVersion = request => this.client.fetch({
251
+ body: '{}',
252
+ headers: jsonContentHeaders,
253
+ method: 'POST',
254
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/destroy`
255
+ }, unmarshalSecretVersion);
245
256
  }
257
+ /** Lists the available regions of the API. */
246
258
  }
247
- /** Lists the available regions of the API. */
248
259
  API.LOCALITIES = ['fr-par'];
249
260
 
250
261
  export { API };
@@ -1,5 +1,5 @@
1
1
  import { isJSONObject } from '../../../helpers/json.js';
2
- import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
3
 
4
4
  // This file was automatically generated. DO NOT EDIT.
5
5
  const unmarshalSecret = data => {
@@ -10,6 +10,7 @@ const unmarshalSecret = data => {
10
10
  createdAt: unmarshalDate(data.created_at),
11
11
  description: data.description,
12
12
  id: data.id,
13
+ isManaged: data.is_managed,
13
14
  name: data.name,
14
15
  projectId: data.project_id,
15
16
  region: data.region,
@@ -26,6 +27,7 @@ const unmarshalSecretVersion = data => {
26
27
  return {
27
28
  createdAt: unmarshalDate(data.created_at),
28
29
  description: data.description,
30
+ isLatest: data.is_latest,
29
31
  revision: data.revision,
30
32
  secretId: data.secret_id,
31
33
  status: data.status,
@@ -38,6 +40,7 @@ const unmarshalAccessSecretVersionResponse = data => {
38
40
  }
39
41
  return {
40
42
  data: data.data,
43
+ dataCrc32: data.data_crc32,
41
44
  revision: data.revision,
42
45
  secretId: data.secret_id
43
46
  };
@@ -60,6 +63,16 @@ const unmarshalListSecretsResponse = data => {
60
63
  totalCount: data.total_count
61
64
  };
62
65
  };
66
+ const marshalPasswordGenerationParams = (request, defaults) => ({
67
+ additional_chars: request.additionalChars,
68
+ length: request.length,
69
+ no_digits: request.noDigits,
70
+ no_lowercase_letters: request.noLowercaseLetters,
71
+ no_uppercase_letters: request.noUppercaseLetters
72
+ });
73
+ const marshalAddSecretOwnerRequest = (request, defaults) => ({
74
+ product_name: request.productName
75
+ });
63
76
  const marshalCreateSecretRequest = (request, defaults) => ({
64
77
  description: request.description,
65
78
  name: request.name,
@@ -68,7 +81,13 @@ const marshalCreateSecretRequest = (request, defaults) => ({
68
81
  });
69
82
  const marshalCreateSecretVersionRequest = (request, defaults) => ({
70
83
  data: request.data,
71
- description: request.description
84
+ data_crc32: request.dataCrc32,
85
+ description: request.description,
86
+ disable_previous: request.disablePrevious,
87
+ ...resolveOneOf([{
88
+ param: 'password_generation',
89
+ value: request.passwordGeneration ? marshalPasswordGenerationParams(request.passwordGeneration) : undefined
90
+ }])
72
91
  });
73
92
  const marshalUpdateSecretRequest = (request, defaults) => ({
74
93
  description: request.description,
@@ -79,4 +98,4 @@ const marshalUpdateSecretVersionRequest = (request, defaults) => ({
79
98
  description: request.description
80
99
  });
81
100
 
82
- export { marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalSecret, unmarshalSecretVersion };
101
+ export { marshalAddSecretOwnerRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalSecret, unmarshalSecretVersion };
@@ -53,7 +53,7 @@ class API extends API$1 {
53
53
  * @param options - The waiting options
54
54
  * @returns A Promise of Email
55
55
  */
56
- this.waitForEmail = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!EMAIL_TRANSIENT_STATUSES.includes(res.status))), this.getEmail, request, options);
56
+ this.waitForEmail = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!EMAIL_TRANSIENT_STATUSES.includes(res.status))), this.getEmail, request, options);
57
57
  this.pageOfListEmails = function (request) {
58
58
  if (request === void 0) {
59
59
  request = {};
@@ -138,7 +138,7 @@ class API extends API$1 {
138
138
  * @param options - The waiting options
139
139
  * @returns A Promise of Domain
140
140
  */
141
- this.waitForDomain = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
141
+ this.waitForDomain = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
142
142
  this.pageOfListDomains = function (request) {
143
143
  if (request === void 0) {
144
144
  request = {};
@@ -190,8 +190,8 @@ class API extends API$1 {
190
190
  path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/check`
191
191
  }, unmarshalDomain);
192
192
  }
193
+ /** Lists the available regions of the API. */
193
194
  }
194
- /** Lists the available regions of the API. */
195
195
  API.LOCALITIES = ['fr-par'];
196
196
 
197
197
  export { API };
@@ -84,7 +84,7 @@ class API extends API$1 {
84
84
  * @param options - The waiting options
85
85
  * @returns A Promise of Human
86
86
  */
87
- this.waitForHuman = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))), this.getHuman, request, options);
87
+ this.waitForHuman = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))), this.getHuman, request, options);
88
88
  /**
89
89
  * Create a new human.
90
90
  *
@@ -21,11 +21,14 @@ class API extends API$1 {
21
21
  return _this.client.fetch({
22
22
  method: 'GET',
23
23
  path: `/vpc/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/private-networks`,
24
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_network_ids', request.privateNetworkIds], ['project_id', request.projectId], ['tags', request.tags])
24
+ urlParams: urlParams(['include_regional', request.includeRegional], ['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_network_ids', request.privateNetworkIds], ['project_id', request.projectId], ['tags', request.tags])
25
25
  }, unmarshalListPrivateNetworksResponse);
26
26
  };
27
27
  /**
28
- * List private networks.
28
+ * List Private Networks. List existing Private Networks in a specified
29
+ * Availability Zone. By default, the Private Networks returned in the list
30
+ * are ordered by creation date in ascending order, though this can be
31
+ * modified via the order_by field.
29
32
  *
30
33
  * @param request - The request {@link ListPrivateNetworksRequest}
31
34
  * @returns A Promise of ListPrivateNetworksResponse
@@ -37,7 +40,8 @@ class API extends API$1 {
37
40
  return enrichForPagination('privateNetworks', _this.pageOfListPrivateNetworks, request);
38
41
  };
39
42
  /**
40
- * Create a private network.
43
+ * Create a Private Network. Create a new Private Network. Once created, you
44
+ * can attach Scaleway resources in the same Availability Zone.
41
45
  *
42
46
  * @param request - The request {@link CreatePrivateNetworkRequest}
43
47
  * @returns A Promise of PrivateNetwork
@@ -54,7 +58,9 @@ class API extends API$1 {
54
58
  }, unmarshalPrivateNetwork);
55
59
  };
56
60
  /**
57
- * Get a private network.
61
+ * Get a Private Network. Retrieve information about an existing Private
62
+ * Network, specified by its Private Network ID. Its full details are returned
63
+ * in the response object.
58
64
  *
59
65
  * @param request - The request {@link GetPrivateNetworkRequest}
60
66
  * @returns A Promise of PrivateNetwork
@@ -64,7 +70,8 @@ class API extends API$1 {
64
70
  path: `/vpc/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
65
71
  }, unmarshalPrivateNetwork);
66
72
  /**
67
- * Update private network.
73
+ * Update Private Network. Update parameters (such as name or tags) of an
74
+ * existing Private Network, specified by its Private Network ID.
68
75
  *
69
76
  * @param request - The request {@link UpdatePrivateNetworkRequest}
70
77
  * @returns A Promise of PrivateNetwork
@@ -76,7 +83,8 @@ class API extends API$1 {
76
83
  path: `/vpc/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
77
84
  }, unmarshalPrivateNetwork);
78
85
  /**
79
- * Delete a private network.
86
+ * Delete a Private Network. Delete an existing Private Network. Note that you
87
+ * must first detach all resources from the network, in order to delete it.
80
88
  *
81
89
  * @param request - The request {@link DeletePrivateNetworkRequest}
82
90
  */
@@ -85,8 +93,8 @@ class API extends API$1 {
85
93
  path: `/vpc/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
86
94
  });
87
95
  }
96
+ /** Lists the available zones of the API. */
88
97
  }
89
- /** Lists the available zones of the API. */
90
98
  API.LOCALITIES = ['fr-par-1', 'fr-par-2', 'fr-par-3', 'nl-ams-1', 'nl-ams-2', 'pl-waw-1', 'pl-waw-2'];
91
99
 
92
100
  export { API };
@@ -59,7 +59,7 @@ class API extends API$1 {
59
59
  * @param options - The waiting options
60
60
  * @returns A Promise of Gateway
61
61
  */
62
- this.waitForGateway = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!GATEWAY_TRANSIENT_STATUSES.includes(res.status))), this.getGateway, request, options);
62
+ this.waitForGateway = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!GATEWAY_TRANSIENT_STATUSES.includes(res.status))), this.getGateway, request, options);
63
63
  /**
64
64
  * Create a Public Gateway. Create a new Public Gateway in the specified
65
65
  * Scaleway Project, defining its **name**, **type** and other configuration
@@ -165,7 +165,7 @@ class API extends API$1 {
165
165
  * @param options - The waiting options
166
166
  * @returns A Promise of GatewayNetwork
167
167
  */
168
- this.waitForGatewayNetwork = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!GATEWAY_NETWORK_TRANSIENT_STATUSES.includes(res.status))), this.getGatewayNetwork, request, options);
168
+ this.waitForGatewayNetwork = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!GATEWAY_NETWORK_TRANSIENT_STATUSES.includes(res.status))), this.getGatewayNetwork, request, options);
169
169
  /**
170
170
  * Attach a Public Gateway to a Private Network. Attach a specific Public
171
171
  * Gateway to a specific Private Network (create a GatewayNetwork). You can
@@ -587,8 +587,8 @@ class API extends API$1 {
587
587
  path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}/refresh-ssh-keys`
588
588
  }, unmarshalGateway);
589
589
  }
590
+ /** Lists the available zones of the API. */
590
591
  }
591
- /** Lists the available zones of the API. */
592
592
  API.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'nl-ams-2', 'pl-waw-1', 'pl-waw-2'];
593
593
 
594
594
  export { API };
@@ -67,7 +67,7 @@ class API extends API$1 {
67
67
  * @param options - The waiting options
68
68
  * @returns A Promise of Hosting
69
69
  */
70
- this.waitForHosting = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
70
+ this.waitForHosting = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
71
71
  /**
72
72
  * Update a hosting.
73
73
  *
@@ -125,8 +125,8 @@ class API extends API$1 {
125
125
  urlParams: urlParams(['hosting_id', request.hostingId], ['only_options', request.onlyOptions], ['order_by', request.orderBy ?? 'price_asc'], ['without_options', request.withoutOptions])
126
126
  }, unmarshalListOffersResponse);
127
127
  }
128
+ /** Lists the available regions of the API. */
128
129
  }
129
- /** Lists the available regions of the API. */
130
130
  API.LOCALITIES = ['fr-par'];
131
131
 
132
132
  export { API };
@@ -34,7 +34,7 @@ const resolveOneOf = function (list, isRequired) {
34
34
  isRequired = false;
35
35
  }
36
36
  const elt = list.find(obj => obj.value) || list.find(obj => obj.default);
37
- const value = (elt == null ? void 0 : elt.value) || (elt == null ? void 0 : elt.default);
37
+ const value = elt?.value || elt?.default;
38
38
  if (value) return {
39
39
  [elt.param]: value
40
40
  };