@scaleway/sdk 1.12.0 → 1.13.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.
@@ -663,27 +663,7 @@ class RegistrarAPI extends API$1 {
663
663
  }, unmarshalGetDomainAuthCodeResponse);
664
664
  /**
665
665
  * Update domain DNSSEC. If your domain has the default Scaleway NS and uses
666
- * another registrar, you have to update the DS record manually. For the
667
- * algorithm, here are the code numbers for each type:
668
- *
669
- * - 1: RSAMD5
670
- * - 2: DIFFIE_HELLMAN
671
- * - 3: DSA_SHA1
672
- * - 5: RSA_SHA1
673
- * - 6: DSA_NSEC3_SHA1
674
- * - 7: RSASHA1_NSEC3_SHA1
675
- * - 8: RSASHA256
676
- * - 10: RSASHA512
677
- * - 12: ECC_GOST
678
- * - 13: ECDSAP256SHA256
679
- * - 14: ECDSAP384SHA384
680
- *
681
- * And for the digest type:
682
- *
683
- * - 1: SHA_1
684
- * - 2: SHA_256
685
- * - 3: GOST_R_34_11_94
686
- * - 4: SHA_384
666
+ * another registrar, you have to update the DS record manually.
687
667
  *
688
668
  * @param request - The request {@link RegistrarApiEnableDomainDNSSECRequest}
689
669
  * @returns A Promise of Domain
@@ -3,7 +3,7 @@ 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
5
  import { CLUSTER_TRANSIENT_STATUSES, POOL_TRANSIENT_STATUSES, NODE_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { unmarshalListClustersResponse, marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, marshalUpgradeClusterRequest, marshalSetClusterTypeRequest, unmarshalListClusterAvailableVersionsResponse, unmarshalListPoolsResponse, marshalCreatePoolRequest, unmarshalPool, marshalUpgradePoolRequest, marshalUpdatePoolRequest, unmarshalExternalNode, unmarshalListNodesResponse, unmarshalNode, unmarshalListVersionsResponse, unmarshalVersion } from './marshalling.gen.js';
6
+ import { unmarshalListClustersResponse, marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, marshalUpgradeClusterRequest, marshalSetClusterTypeRequest, unmarshalListClusterAvailableVersionsResponse, marshalMigrateToPrivateNetworkClusterRequest, unmarshalListPoolsResponse, marshalCreatePoolRequest, unmarshalPool, marshalUpgradePoolRequest, marshalUpdatePoolRequest, unmarshalExternalNode, unmarshalListNodesResponse, unmarshalNode, unmarshalListVersionsResponse, unmarshalVersion } 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.
@@ -155,6 +155,20 @@ class API extends API$1 {
155
155
  method: 'POST',
156
156
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/reset-admin-token`
157
157
  });
158
+ /**
159
+ * Migrate an existing cluster to a Private Network cluster. Migrate a cluster
160
+ * that was created before the release of Private Network clusters to a new
161
+ * one with a Private Network.
162
+ *
163
+ * @param request - The request {@link MigrateToPrivateNetworkClusterRequest}
164
+ * @returns A Promise of Cluster
165
+ */
166
+ this.migrateToPrivateNetworkCluster = request => this.client.fetch({
167
+ body: JSON.stringify(marshalMigrateToPrivateNetworkClusterRequest(request, this.client.settings)),
168
+ headers: jsonContentHeaders,
169
+ method: 'POST',
170
+ path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/migrate-to-private-network`
171
+ }, unmarshalCluster);
158
172
  this.pageOfListPools = request => this.client.fetch({
159
173
  method: 'GET',
160
174
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/pools`,
@@ -344,6 +344,9 @@ const marshalCreatePoolRequest = (request, defaults) => ({
344
344
  upgrade_policy: request.upgradePolicy ? marshalCreatePoolRequestUpgradePolicy(request.upgradePolicy) : undefined,
345
345
  zone: request.zone ?? defaults.defaultZone
346
346
  });
347
+ const marshalMigrateToPrivateNetworkClusterRequest = (request, defaults) => ({
348
+ private_network_id: request.privateNetworkId
349
+ });
347
350
  const marshalSetClusterTypeRequest = (request, defaults) => ({
348
351
  type: request.type
349
352
  });
@@ -378,4 +381,4 @@ const marshalUpgradePoolRequest = (request, defaults) => ({
378
381
  version: request.version
379
382
  });
380
383
 
381
- export { marshalCreateClusterRequest, marshalCreatePoolRequest, marshalSetClusterTypeRequest, marshalUpdateClusterRequest, marshalUpdatePoolRequest, marshalUpgradeClusterRequest, marshalUpgradePoolRequest, unmarshalCluster, unmarshalExternalNode, unmarshalListClusterAvailableVersionsResponse, unmarshalListClustersResponse, unmarshalListNodesResponse, unmarshalListPoolsResponse, unmarshalListVersionsResponse, unmarshalNode, unmarshalPool, unmarshalVersion };
384
+ export { marshalCreateClusterRequest, marshalCreatePoolRequest, marshalMigrateToPrivateNetworkClusterRequest, marshalSetClusterTypeRequest, marshalUpdateClusterRequest, marshalUpdatePoolRequest, marshalUpgradeClusterRequest, marshalUpgradePoolRequest, unmarshalCluster, unmarshalExternalNode, unmarshalListClusterAvailableVersionsResponse, unmarshalListClustersResponse, unmarshalListNodesResponse, unmarshalListPoolsResponse, unmarshalListVersionsResponse, unmarshalNode, unmarshalPool, unmarshalVersion };
@@ -409,7 +409,8 @@ class API extends API$1 {
409
409
  */
410
410
  this.getLbStats = request => this.client.fetch({
411
411
  method: 'GET',
412
- path: `/lb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam('lbId', request.lbId)}/stats`
412
+ path: `/lb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam('lbId', request.lbId)}/stats`,
413
+ urlParams: urlParams(['backend_id', request.backendId])
413
414
  }, unmarshalLbStats);
414
415
  this.pageOfListBackendStats = request => this.client.fetch({
415
416
  method: 'GET',
@@ -1143,7 +1144,8 @@ class ZonedAPI extends API$1 {
1143
1144
  */
1144
1145
  this.getLbStats = request => this.client.fetch({
1145
1146
  method: 'GET',
1146
- path: `/lb/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam('lbId', request.lbId)}/stats`
1147
+ path: `/lb/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam('lbId', request.lbId)}/stats`,
1148
+ urlParams: urlParams(['backend_id', request.backendId])
1147
1149
  }, unmarshalLbStats);
1148
1150
  this.pageOfListBackendStats = request => this.client.fetch({
1149
1151
  method: 'GET',
@@ -143,6 +143,7 @@ const unmarshalReadReplica = data => {
143
143
  endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
144
144
  id: data.id,
145
145
  region: data.region,
146
+ sameZone: data.same_zone,
146
147
  status: data.status
147
148
  };
148
149
  };
@@ -602,7 +603,8 @@ const marshalCreateReadReplicaEndpointRequest = (request, defaults) => ({
602
603
  });
603
604
  const marshalCreateReadReplicaRequest = (request, defaults) => ({
604
605
  endpoint_spec: request.endpointSpec ? request.endpointSpec.map(elt => marshalReadReplicaEndpointSpec(elt)) : undefined,
605
- instance_id: request.instanceId
606
+ instance_id: request.instanceId,
607
+ same_zone: request.sameZone
606
608
  });
607
609
  const marshalCreateSnapshotRequest = (request, defaults) => ({
608
610
  expires_at: request.expiresAt,
@@ -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, marshalAddSecretOwnerRequest, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse } from './marshalling.gen.js';
4
+ import { marshalCreateSecretRequest, unmarshalSecret, marshalUpdateSecretRequest, unmarshalListSecretsResponse, marshalAddSecretOwnerRequest, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalGeneratePasswordRequest, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse } 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.
@@ -45,14 +45,15 @@ class API extends API$1 {
45
45
  }, unmarshalSecret);
46
46
  /**
47
47
  * Get metadata using the secret's ID. Retrieve the metadata of a secret
48
- * specified by the `region` and the `secret_id` parameters.
48
+ * specified by the `region`, `secret_id` and `project_id` parameters.
49
49
  *
50
50
  * @param request - The request {@link GetSecretByNameRequest}
51
51
  * @returns A Promise of Secret
52
52
  */
53
53
  this.getSecretByName = request => this.client.fetch({
54
54
  method: 'GET',
55
- path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}`
55
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}`,
56
+ urlParams: urlParams(['project_id', request.projectId])
56
57
  }, unmarshalSecret);
57
58
  /**
58
59
  * Update metadata of a secret. Edit a secret's metadata such as name, tag(s)
@@ -126,6 +127,20 @@ class API extends API$1 {
126
127
  method: 'POST',
127
128
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions`
128
129
  }, unmarshalSecretVersion);
130
+ /**
131
+ * Generate a password in a new version. Generate a password for the given
132
+ * secret specified by the `region` and `secret_id` parameters. This will also
133
+ * create a new version of the secret that will store the password.
134
+ *
135
+ * @param request - The request {@link GeneratePasswordRequest}
136
+ * @returns A Promise of SecretVersion
137
+ */
138
+ this.generatePassword = request => this.client.fetch({
139
+ body: JSON.stringify(marshalGeneratePasswordRequest(request, this.client.settings)),
140
+ headers: jsonContentHeaders,
141
+ method: 'POST',
142
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/generate-password`
143
+ }, unmarshalSecretVersion);
129
144
  /**
130
145
  * Get metadata of a secret's version using the secret's ID. Retrieve the
131
146
  * metadata of a secret's given version specified by the `region`, `secret_id`
@@ -141,14 +156,15 @@ class API extends API$1 {
141
156
  /**
142
157
  * Get metadata of a secret's version using the secret's name. Retrieve the
143
158
  * metadata of a secret's given version specified by the `region`,
144
- * `secret_name` and `revision` parameters.
159
+ * `secret_name`, `revision` and `project_id` parameters.
145
160
  *
146
161
  * @param request - The request {@link GetSecretVersionByNameRequest}
147
162
  * @returns A Promise of SecretVersion
148
163
  */
149
164
  this.getSecretVersionByName = request => this.client.fetch({
150
165
  method: 'GET',
151
- 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)}`
166
+ 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)}`,
167
+ urlParams: urlParams(['project_id', request.projectId])
152
168
  }, unmarshalSecretVersion);
153
169
  /**
154
170
  * Update metadata of a version. Edit the metadata of a secret's given
@@ -180,12 +196,12 @@ class API extends API$1 {
180
196
  this.pageOfListSecretVersionsByName = request => this.client.fetch({
181
197
  method: 'GET',
182
198
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}/versions`,
183
- urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['status', request.status])
199
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status])
184
200
  }, unmarshalListSecretVersionsResponse);
185
201
  /**
186
202
  * List versions of a secret using the secret's name. Retrieve the list of a
187
- * given secret's versions specified by the `secret_name` and `region`
188
- * parameters.
203
+ * given secret's versions specified by the `secret_name`,`region` and
204
+ * `project_id` parameters.
189
205
  *
190
206
  * @param request - The request {@link ListSecretVersionsByNameRequest}
191
207
  * @returns A Promise of ListSecretVersionsResponse
@@ -231,15 +247,16 @@ class API extends API$1 {
231
247
  }, unmarshalAccessSecretVersionResponse);
232
248
  /**
233
249
  * Access a secret's version using the secret's name. Access sensitive data in
234
- * a secret's version specified by the `region`, `secret_name` and `revision`
235
- * parameters.
250
+ * a secret's version specified by the `region`, `secret_name`, `revision` and
251
+ * `project_id` parameters.
236
252
  *
237
253
  * @param request - The request {@link AccessSecretVersionByNameRequest}
238
254
  * @returns A Promise of AccessSecretVersionResponse
239
255
  */
240
256
  this.accessSecretVersionByName = request => this.client.fetch({
241
257
  method: 'GET',
242
- 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`
258
+ 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`,
259
+ urlParams: urlParams(['project_id', request.projectId])
243
260
  }, unmarshalAccessSecretVersionResponse);
244
261
  /**
245
262
  * Delete a version. Delete a secret's version and the sensitive data
@@ -90,6 +90,15 @@ const marshalCreateSecretVersionRequest = (request, defaults) => ({
90
90
  value: request.passwordGeneration ? marshalPasswordGenerationParams(request.passwordGeneration) : undefined
91
91
  }])
92
92
  });
93
+ const marshalGeneratePasswordRequest = (request, defaults) => ({
94
+ additional_chars: request.additionalChars,
95
+ description: request.description,
96
+ disable_previous: request.disablePrevious,
97
+ length: request.length,
98
+ no_digits: request.noDigits,
99
+ no_lowercase_letters: request.noLowercaseLetters,
100
+ no_uppercase_letters: request.noUppercaseLetters
101
+ });
93
102
  const marshalUpdateSecretRequest = (request, defaults) => ({
94
103
  description: request.description,
95
104
  name: request.name,
@@ -99,4 +108,4 @@ const marshalUpdateSecretVersionRequest = (request, defaults) => ({
99
108
  description: request.description
100
109
  });
101
110
 
102
- export { marshalAddSecretOwnerRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalSecret, unmarshalSecretVersion };
111
+ export { marshalAddSecretOwnerRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalGeneratePasswordRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalSecret, unmarshalSecretVersion };
@@ -1,2 +1,4 @@
1
1
  import * as index_gen from './v1/index.gen.js';
2
2
  export { index_gen as v1 };
3
+ import * as index_gen$1 from './v2/index.gen.js';
4
+ export { index_gen$1 as v2 };
@@ -0,0 +1,231 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { unmarshalListVPCsResponse, marshalCreateVPCRequest, unmarshalVPC, marshalUpdateVPCRequest, unmarshalListPrivateNetworksResponse, marshalCreatePrivateNetworkRequest, unmarshalPrivateNetwork, marshalUpdatePrivateNetworkRequest, marshalMigrateZonalPrivateNetworksRequest, marshalSetSubnetsRequest, unmarshalSetSubnetsResponse, marshalAddSubnetsRequest, unmarshalAddSubnetsResponse, marshalDeleteSubnetsRequest, unmarshalDeleteSubnetsResponse } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ // If you have any remark or suggestion do not hesitate to open an issue.
8
+ const jsonContentHeaders = {
9
+ 'Content-Type': 'application/json; charset=utf-8'
10
+ };
11
+
12
+ /** VPC API. */
13
+ class API extends API$1 {
14
+ constructor() {
15
+ var _this;
16
+ super(...arguments);
17
+ _this = this;
18
+ this.pageOfListVPCs = function (request) {
19
+ if (request === void 0) {
20
+ request = {};
21
+ }
22
+ return _this.client.fetch({
23
+ method: 'GET',
24
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/vpcs`,
25
+ urlParams: urlParams(['is_default', request.isDefault], ['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], ['project_id', request.projectId], ['tags', request.tags])
26
+ }, unmarshalListVPCsResponse);
27
+ };
28
+ /**
29
+ * List VPCs. List existing VPCs in the specified region.
30
+ *
31
+ * @param request - The request {@link ListVPCsRequest}
32
+ * @returns A Promise of ListVPCsResponse
33
+ */
34
+ this.listVPCs = function (request) {
35
+ if (request === void 0) {
36
+ request = {};
37
+ }
38
+ return enrichForPagination('vpcs', _this.pageOfListVPCs, request);
39
+ };
40
+ /**
41
+ * Create a VPC. Create a new VPC in the specified region.
42
+ *
43
+ * @param request - The request {@link CreateVPCRequest}
44
+ * @returns A Promise of VPC
45
+ */
46
+ this.createVPC = function (request) {
47
+ if (request === void 0) {
48
+ request = {};
49
+ }
50
+ return _this.client.fetch({
51
+ body: JSON.stringify(marshalCreateVPCRequest(request, _this.client.settings)),
52
+ headers: jsonContentHeaders,
53
+ method: 'POST',
54
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/vpcs`
55
+ }, unmarshalVPC);
56
+ };
57
+ /**
58
+ * Get a VPC. Retrieve details of an existing VPC, specified by its VPC ID.
59
+ *
60
+ * @param request - The request {@link GetVPCRequest}
61
+ * @returns A Promise of VPC
62
+ */
63
+ this.getVPC = request => this.client.fetch({
64
+ method: 'GET',
65
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/vpcs/${validatePathParam('vpcId', request.vpcId)}`
66
+ }, unmarshalVPC);
67
+ /**
68
+ * Update VPC. Update parameters including name and tags of the specified VPC.
69
+ *
70
+ * @param request - The request {@link UpdateVPCRequest}
71
+ * @returns A Promise of VPC
72
+ */
73
+ this.updateVPC = request => this.client.fetch({
74
+ body: JSON.stringify(marshalUpdateVPCRequest(request, this.client.settings)),
75
+ headers: jsonContentHeaders,
76
+ method: 'PATCH',
77
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/vpcs/${validatePathParam('vpcId', request.vpcId)}`
78
+ }, unmarshalVPC);
79
+ /**
80
+ * Delete a VPC. Delete a VPC specified by its VPC ID.
81
+ *
82
+ * @param request - The request {@link DeleteVPCRequest}
83
+ */
84
+ this.deleteVPC = request => this.client.fetch({
85
+ method: 'DELETE',
86
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/vpcs/${validatePathParam('vpcId', request.vpcId)}`
87
+ });
88
+ this.pageOfListPrivateNetworks = function (request) {
89
+ if (request === void 0) {
90
+ request = {};
91
+ }
92
+ return _this.client.fetch({
93
+ method: 'GET',
94
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/private-networks`,
95
+ 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], ['vpc_id', request.vpcId])
96
+ }, unmarshalListPrivateNetworksResponse);
97
+ };
98
+ /**
99
+ * List Private Networks. List existing Private Networks in the specified
100
+ * region. By default, the Private Networks returned in the list are ordered
101
+ * by creation date in ascending order, though this can be modified via the
102
+ * order_by field.
103
+ *
104
+ * @param request - The request {@link ListPrivateNetworksRequest}
105
+ * @returns A Promise of ListPrivateNetworksResponse
106
+ */
107
+ this.listPrivateNetworks = function (request) {
108
+ if (request === void 0) {
109
+ request = {};
110
+ }
111
+ return enrichForPagination('privateNetworks', _this.pageOfListPrivateNetworks, request);
112
+ };
113
+ /**
114
+ * Create a Private Network. Create a new Private Network. Once created, you
115
+ * can attach Scaleway resources which are in the same region.
116
+ *
117
+ * @param request - The request {@link CreatePrivateNetworkRequest}
118
+ * @returns A Promise of PrivateNetwork
119
+ */
120
+ this.createPrivateNetwork = function (request) {
121
+ if (request === void 0) {
122
+ request = {};
123
+ }
124
+ return _this.client.fetch({
125
+ body: JSON.stringify(marshalCreatePrivateNetworkRequest(request, _this.client.settings)),
126
+ headers: jsonContentHeaders,
127
+ method: 'POST',
128
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/private-networks`
129
+ }, unmarshalPrivateNetwork);
130
+ };
131
+ /**
132
+ * Get a Private Network. Retrieve information about an existing Private
133
+ * Network, specified by its Private Network ID. Its full details are returned
134
+ * in the response object.
135
+ *
136
+ * @param request - The request {@link GetPrivateNetworkRequest}
137
+ * @returns A Promise of PrivateNetwork
138
+ */
139
+ this.getPrivateNetwork = request => this.client.fetch({
140
+ method: 'GET',
141
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
142
+ }, unmarshalPrivateNetwork);
143
+ /**
144
+ * Update Private Network. Update parameters (such as name or tags) of an
145
+ * existing Private Network, specified by its Private Network ID.
146
+ *
147
+ * @param request - The request {@link UpdatePrivateNetworkRequest}
148
+ * @returns A Promise of PrivateNetwork
149
+ */
150
+ this.updatePrivateNetwork = request => this.client.fetch({
151
+ body: JSON.stringify(marshalUpdatePrivateNetworkRequest(request, this.client.settings)),
152
+ headers: jsonContentHeaders,
153
+ method: 'PATCH',
154
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
155
+ }, unmarshalPrivateNetwork);
156
+ /**
157
+ * Delete a Private Network. Delete an existing Private Network. Note that you
158
+ * must first detach all resources from the network, in order to delete it.
159
+ *
160
+ * @param request - The request {@link DeletePrivateNetworkRequest}
161
+ */
162
+ this.deletePrivateNetwork = request => this.client.fetch({
163
+ method: 'DELETE',
164
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
165
+ });
166
+ /**
167
+ * Migrate Private Networks from zoned to regional. Transform multiple
168
+ * existing zoned Private Networks (scoped to a single Availability Zone) into
169
+ * regional Private Networks, scoped to an entire region. You can transform
170
+ * one or many Private Networks (specified by their Private Network IDs)
171
+ * within a single Scaleway Organization or Project, with the same call.
172
+ *
173
+ * @param request - The request {@link MigrateZonalPrivateNetworksRequest}
174
+ */
175
+ this.migrateZonalPrivateNetworks = function (request) {
176
+ if (request === void 0) {
177
+ request = {};
178
+ }
179
+ return _this.client.fetch({
180
+ body: JSON.stringify(marshalMigrateZonalPrivateNetworksRequest(request, _this.client.settings)),
181
+ headers: jsonContentHeaders,
182
+ method: 'POST',
183
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/private-networks/migrate-zonal`
184
+ });
185
+ };
186
+ /**
187
+ * Set the subnets of a Private Network. Set subnets for an existing Private
188
+ * Network. Note that the method is PUT and not PATCH. Any existing subnets
189
+ * will be removed in favor of the new specified set of subnets.
190
+ *
191
+ * @param request - The request {@link SetSubnetsRequest}
192
+ * @returns A Promise of SetSubnetsResponse
193
+ */
194
+ this.setSubnets = request => this.client.fetch({
195
+ body: JSON.stringify(marshalSetSubnetsRequest(request, this.client.settings)),
196
+ headers: jsonContentHeaders,
197
+ method: 'PUT',
198
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}/subnets`
199
+ }, unmarshalSetSubnetsResponse);
200
+ /**
201
+ * Add subnets to a Private Network. Add new subnets to an existing Private
202
+ * Network.
203
+ *
204
+ * @param request - The request {@link AddSubnetsRequest}
205
+ * @returns A Promise of AddSubnetsResponse
206
+ */
207
+ this.addSubnets = request => this.client.fetch({
208
+ body: JSON.stringify(marshalAddSubnetsRequest(request, this.client.settings)),
209
+ headers: jsonContentHeaders,
210
+ method: 'POST',
211
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}/subnets`
212
+ }, unmarshalAddSubnetsResponse);
213
+ /**
214
+ * Delete subnets from a Private Network. Delete the specified subnets from a
215
+ * Private Network.
216
+ *
217
+ * @param request - The request {@link DeleteSubnetsRequest}
218
+ * @returns A Promise of DeleteSubnetsResponse
219
+ */
220
+ this.deleteSubnets = request => this.client.fetch({
221
+ body: JSON.stringify(marshalDeleteSubnetsRequest(request, this.client.settings)),
222
+ headers: jsonContentHeaders,
223
+ method: 'DELETE',
224
+ path: `/vpc/v2/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}/subnets`
225
+ }, unmarshalDeleteSubnetsResponse);
226
+ }
227
+ /** Lists the available regions of the API. */
228
+ }
229
+ API.LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
230
+
231
+ export { API };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
4
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,135 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+ // If you have any remark or suggestion do not hesitate to open an issue.
7
+ const unmarshalSubnet = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'Subnet' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ createdAt: unmarshalDate(data.created_at),
13
+ id: data.id,
14
+ subnet: data.subnet,
15
+ updatedAt: unmarshalDate(data.updated_at)
16
+ };
17
+ };
18
+ const unmarshalPrivateNetwork = data => {
19
+ if (!isJSONObject(data)) {
20
+ throw new TypeError(`Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`);
21
+ }
22
+ return {
23
+ createdAt: unmarshalDate(data.created_at),
24
+ id: data.id,
25
+ name: data.name,
26
+ organizationId: data.organization_id,
27
+ projectId: data.project_id,
28
+ region: data.region,
29
+ subnets: unmarshalArrayOfObject(data.subnets, unmarshalSubnet),
30
+ tags: data.tags,
31
+ updatedAt: unmarshalDate(data.updated_at),
32
+ vpcId: data.vpc_id
33
+ };
34
+ };
35
+ const unmarshalVPC = data => {
36
+ if (!isJSONObject(data)) {
37
+ throw new TypeError(`Unmarshalling the type 'VPC' failed as data isn't a dictionary.`);
38
+ }
39
+ return {
40
+ createdAt: unmarshalDate(data.created_at),
41
+ id: data.id,
42
+ isDefault: data.is_default,
43
+ name: data.name,
44
+ organizationId: data.organization_id,
45
+ projectId: data.project_id,
46
+ region: data.region,
47
+ tags: data.tags,
48
+ updatedAt: unmarshalDate(data.updated_at)
49
+ };
50
+ };
51
+ const unmarshalAddSubnetsResponse = data => {
52
+ if (!isJSONObject(data)) {
53
+ throw new TypeError(`Unmarshalling the type 'AddSubnetsResponse' failed as data isn't a dictionary.`);
54
+ }
55
+ return {
56
+ subnets: data.subnets
57
+ };
58
+ };
59
+ const unmarshalDeleteSubnetsResponse = data => {
60
+ if (!isJSONObject(data)) {
61
+ throw new TypeError(`Unmarshalling the type 'DeleteSubnetsResponse' failed as data isn't a dictionary.`);
62
+ }
63
+ return {
64
+ subnets: data.subnets
65
+ };
66
+ };
67
+ const unmarshalListPrivateNetworksResponse = data => {
68
+ if (!isJSONObject(data)) {
69
+ throw new TypeError(`Unmarshalling the type 'ListPrivateNetworksResponse' failed as data isn't a dictionary.`);
70
+ }
71
+ return {
72
+ privateNetworks: unmarshalArrayOfObject(data.private_networks, unmarshalPrivateNetwork),
73
+ totalCount: data.total_count
74
+ };
75
+ };
76
+ const unmarshalListVPCsResponse = data => {
77
+ if (!isJSONObject(data)) {
78
+ throw new TypeError(`Unmarshalling the type 'ListVPCsResponse' failed as data isn't a dictionary.`);
79
+ }
80
+ return {
81
+ totalCount: data.total_count,
82
+ vpcs: unmarshalArrayOfObject(data.vpcs, unmarshalVPC)
83
+ };
84
+ };
85
+ const unmarshalSetSubnetsResponse = data => {
86
+ if (!isJSONObject(data)) {
87
+ throw new TypeError(`Unmarshalling the type 'SetSubnetsResponse' failed as data isn't a dictionary.`);
88
+ }
89
+ return {
90
+ subnets: data.subnets
91
+ };
92
+ };
93
+ const marshalAddSubnetsRequest = (request, defaults) => ({
94
+ subnets: request.subnets
95
+ });
96
+ const marshalCreatePrivateNetworkRequest = (request, defaults) => ({
97
+ name: request.name || randomName('pn'),
98
+ project_id: request.projectId ?? defaults.defaultProjectId,
99
+ subnets: request.subnets,
100
+ tags: request.tags,
101
+ vpc_id: request.vpcId
102
+ });
103
+ const marshalCreateVPCRequest = (request, defaults) => ({
104
+ name: request.name || randomName('vpc'),
105
+ project_id: request.projectId ?? defaults.defaultProjectId,
106
+ tags: request.tags
107
+ });
108
+ const marshalDeleteSubnetsRequest = (request, defaults) => ({
109
+ subnets: request.subnets
110
+ });
111
+ const marshalMigrateZonalPrivateNetworksRequest = (request, defaults) => ({
112
+ private_network_ids: request.privateNetworkIds,
113
+ ...resolveOneOf([{
114
+ default: defaults.defaultProjectId,
115
+ param: 'project_id',
116
+ value: request.projectId
117
+ }, {
118
+ default: defaults.defaultOrganizationId,
119
+ param: 'organization_id',
120
+ value: request.organizationId
121
+ }])
122
+ });
123
+ const marshalSetSubnetsRequest = (request, defaults) => ({
124
+ subnets: request.subnets
125
+ });
126
+ const marshalUpdatePrivateNetworkRequest = (request, defaults) => ({
127
+ name: request.name,
128
+ tags: request.tags
129
+ });
130
+ const marshalUpdateVPCRequest = (request, defaults) => ({
131
+ name: request.name,
132
+ tags: request.tags
133
+ });
134
+
135
+ export { marshalAddSubnetsRequest, marshalCreatePrivateNetworkRequest, marshalCreateVPCRequest, marshalDeleteSubnetsRequest, marshalMigrateZonalPrivateNetworksRequest, marshalSetSubnetsRequest, marshalUpdatePrivateNetworkRequest, marshalUpdateVPCRequest, unmarshalAddSubnetsResponse, unmarshalDeleteSubnetsResponse, unmarshalListPrivateNetworksResponse, unmarshalListVPCsResponse, unmarshalPrivateNetwork, unmarshalSetSubnetsResponse, unmarshalVPC };