@scaleway/sdk 1.24.0 → 1.26.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.
@@ -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, marshalGeneratePasswordRequest, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse, unmarshalListTagsResponse } from './marshalling.gen.js';
4
+ import { marshalCreateSecretRequest, unmarshalSecret, marshalCreateFolderRequest, unmarshalFolder, marshalUpdateSecretRequest, unmarshalListSecretsResponse, unmarshalListFoldersResponse, marshalAddSecretOwnerRequest, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalGeneratePasswordRequest, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse, unmarshalListTagsResponse } 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.
@@ -20,7 +20,7 @@ class API extends API$1 {
20
20
  static LOCALITIES = ['fr-par'];
21
21
 
22
22
  /**
23
- * Create a secret. You must sepcify the `region` to create a secret.
23
+ * Create a secret. You must specify the `region` to create a secret.
24
24
  *
25
25
  * @param request - The request {@link CreateSecretRequest}
26
26
  * @returns A Promise of Secret
@@ -32,6 +32,19 @@ class API extends API$1 {
32
32
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets`
33
33
  }, unmarshalSecret);
34
34
 
35
+ /**
36
+ * Create folder.
37
+ *
38
+ * @param request - The request {@link CreateFolderRequest}
39
+ * @returns A Promise of Folder
40
+ */
41
+ createFolder = request => this.client.fetch({
42
+ body: JSON.stringify(marshalCreateFolderRequest(request, this.client.settings)),
43
+ headers: jsonContentHeaders,
44
+ method: 'POST',
45
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders`
46
+ }, unmarshalFolder);
47
+
35
48
  /**
36
49
  * Get metadata using the secret's ID. Retrieve the metadata of a secret
37
50
  * specified by the `region` and `secret_id` parameters.
@@ -48,6 +61,11 @@ class API extends API$1 {
48
61
  * Get metadata using the secret's name. Retrieve the metadata of a secret
49
62
  * specified by the `region` and `secret_name` parameters.
50
63
  *
64
+ * GetSecretByName usage is now deprecated.
65
+ *
66
+ * Scaleway recommends you to use ListSecrets with the `name` filter.
67
+ *
68
+ * @deprecated
51
69
  * @param request - The request {@link GetSecretByNameRequest}
52
70
  * @returns A Promise of Secret
53
71
  */
@@ -80,7 +98,7 @@ class API extends API$1 {
80
98
  return _this.client.fetch({
81
99
  method: 'GET',
82
100
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets`,
83
- 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])
101
+ 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], ['path', request.path], ['project_id', request.projectId], ['tags', request.tags])
84
102
  }, unmarshalListSecretsResponse);
85
103
  };
86
104
  })();
@@ -102,6 +120,35 @@ class API extends API$1 {
102
120
  return enrichForPagination('secrets', _this2.pageOfListSecrets, request);
103
121
  };
104
122
  })();
123
+ pageOfListFolders = (() => {
124
+ var _this3 = this;
125
+ return function (request) {
126
+ if (request === void 0) {
127
+ request = {};
128
+ }
129
+ return _this3.client.fetch({
130
+ method: 'GET',
131
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/folders`,
132
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['path', request.path], ['project_id', request.projectId ?? _this3.client.settings.defaultProjectId])
133
+ }, unmarshalListFoldersResponse);
134
+ };
135
+ })();
136
+
137
+ /**
138
+ * List secrets. Retrieve the list of folders created within a Project.
139
+ *
140
+ * @param request - The request {@link ListFoldersRequest}
141
+ * @returns A Promise of ListFoldersResponse
142
+ */
143
+ listFolders = (() => {
144
+ var _this4 = this;
145
+ return function (request) {
146
+ if (request === void 0) {
147
+ request = {};
148
+ }
149
+ return enrichForPagination('folders', _this4.pageOfListFolders, request);
150
+ };
151
+ })();
105
152
 
106
153
  /**
107
154
  * Delete a secret. Delete a given secret specified by the `region` and
@@ -114,6 +161,16 @@ class API extends API$1 {
114
161
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
115
162
  });
116
163
 
164
+ /**
165
+ * Delete a given folder specified by the and `folder_id` parameter.
166
+ *
167
+ * @param request - The request {@link DeleteFolderRequest}
168
+ */
169
+ deleteFolder = request => this.client.fetch({
170
+ method: 'DELETE',
171
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders/${validatePathParam('folderId', request.folderId)}`
172
+ });
173
+
117
174
  /**
118
175
  * Protect a secret. Protect a given secret specified by the `secret_id`
119
176
  * parameter. A protected secret can be read and modified but cannot be
@@ -324,15 +381,15 @@ class API extends API$1 {
324
381
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/destroy`
325
382
  }, unmarshalSecretVersion);
326
383
  pageOfListTags = (() => {
327
- var _this3 = this;
384
+ var _this5 = this;
328
385
  return function (request) {
329
386
  if (request === void 0) {
330
387
  request = {};
331
388
  }
332
- return _this3.client.fetch({
389
+ return _this5.client.fetch({
333
390
  method: 'GET',
334
- path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/tags`,
335
- urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
391
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this5.client.settings.defaultRegion)}/tags`,
392
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize], ['project_id', request.projectId])
336
393
  }, unmarshalListTagsResponse);
337
394
  };
338
395
  })();
@@ -344,12 +401,12 @@ class API extends API$1 {
344
401
  * @returns A Promise of ListTagsResponse
345
402
  */
346
403
  listTags = (() => {
347
- var _this4 = this;
404
+ var _this6 = this;
348
405
  return function (request) {
349
406
  if (request === void 0) {
350
407
  request = {};
351
408
  }
352
- return enrichForPagination('tags', _this4.pageOfListTags, request);
409
+ return enrichForPagination('tags', _this6.pageOfListTags, request);
353
410
  };
354
411
  })();
355
412
  }
@@ -3,6 +3,18 @@ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../he
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.
6
+ const unmarshalFolder = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'Folder' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ createdAt: unmarshalDate(data.created_at),
12
+ id: data.id,
13
+ name: data.name,
14
+ path: data.path,
15
+ projectId: data.project_id
16
+ };
17
+ };
6
18
  const unmarshalSecret = data => {
7
19
  if (!isJSONObject(data)) {
8
20
  throw new TypeError(`Unmarshalling the type 'Secret' failed as data isn't a dictionary.`);
@@ -14,6 +26,7 @@ const unmarshalSecret = data => {
14
26
  isManaged: data.is_managed,
15
27
  isProtected: data.is_protected,
16
28
  name: data.name,
29
+ path: data.path,
17
30
  projectId: data.project_id,
18
31
  region: data.region,
19
32
  status: data.status,
@@ -48,6 +61,15 @@ const unmarshalAccessSecretVersionResponse = data => {
48
61
  secretId: data.secret_id
49
62
  };
50
63
  };
64
+ const unmarshalListFoldersResponse = data => {
65
+ if (!isJSONObject(data)) {
66
+ throw new TypeError(`Unmarshalling the type 'ListFoldersResponse' failed as data isn't a dictionary.`);
67
+ }
68
+ return {
69
+ folders: unmarshalArrayOfObject(data.folders, unmarshalFolder),
70
+ totalCount: data.total_count
71
+ };
72
+ };
51
73
  const unmarshalListSecretVersionsResponse = data => {
52
74
  if (!isJSONObject(data)) {
53
75
  throw new TypeError(`Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`);
@@ -86,9 +108,15 @@ const marshalAddSecretOwnerRequest = (request, defaults) => ({
86
108
  product: request.product ?? 'unknown',
87
109
  product_name: request.productName
88
110
  });
111
+ const marshalCreateFolderRequest = (request, defaults) => ({
112
+ name: request.name,
113
+ path: request.path,
114
+ project_id: request.projectId ?? defaults.defaultProjectId
115
+ });
89
116
  const marshalCreateSecretRequest = (request, defaults) => ({
90
117
  description: request.description,
91
118
  name: request.name,
119
+ path: request.path,
92
120
  project_id: request.projectId ?? defaults.defaultProjectId,
93
121
  tags: request.tags,
94
122
  type: request.type ?? 'unknown_secret_type'
@@ -115,10 +143,11 @@ const marshalGeneratePasswordRequest = (request, defaults) => ({
115
143
  const marshalUpdateSecretRequest = (request, defaults) => ({
116
144
  description: request.description,
117
145
  name: request.name,
146
+ path: request.path,
118
147
  tags: request.tags
119
148
  });
120
149
  const marshalUpdateSecretVersionRequest = (request, defaults) => ({
121
150
  description: request.description
122
151
  });
123
152
 
124
- export { marshalAddSecretOwnerRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalGeneratePasswordRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalListTagsResponse, unmarshalSecret, unmarshalSecretVersion };
153
+ export { marshalAddSecretOwnerRequest, marshalCreateFolderRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalGeneratePasswordRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalFolder, unmarshalListFoldersResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalListTagsResponse, unmarshalSecret, unmarshalSecretVersion };
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ const assertValidSettings = obj => {
497
497
  }
498
498
  };
499
499
 
500
- const version = 'v1.23.0';
500
+ const version = 'v1.25.0';
501
501
  const userAgent = `scaleway-sdk-js/${version}`;
502
502
 
503
503
  const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
@@ -20288,6 +20288,18 @@ var index$6 = /*#__PURE__*/Object.freeze({
20288
20288
 
20289
20289
  // This file was automatically generated. DO NOT EDIT.
20290
20290
  // If you have any remark or suggestion do not hesitate to open an issue.
20291
+ const unmarshalFolder = data => {
20292
+ if (!isJSONObject(data)) {
20293
+ throw new TypeError(`Unmarshalling the type 'Folder' failed as data isn't a dictionary.`);
20294
+ }
20295
+ return {
20296
+ createdAt: unmarshalDate(data.created_at),
20297
+ id: data.id,
20298
+ name: data.name,
20299
+ path: data.path,
20300
+ projectId: data.project_id
20301
+ };
20302
+ };
20291
20303
  const unmarshalSecret = data => {
20292
20304
  if (!isJSONObject(data)) {
20293
20305
  throw new TypeError(`Unmarshalling the type 'Secret' failed as data isn't a dictionary.`);
@@ -20299,6 +20311,7 @@ const unmarshalSecret = data => {
20299
20311
  isManaged: data.is_managed,
20300
20312
  isProtected: data.is_protected,
20301
20313
  name: data.name,
20314
+ path: data.path,
20302
20315
  projectId: data.project_id,
20303
20316
  region: data.region,
20304
20317
  status: data.status,
@@ -20333,6 +20346,15 @@ const unmarshalAccessSecretVersionResponse = data => {
20333
20346
  secretId: data.secret_id
20334
20347
  };
20335
20348
  };
20349
+ const unmarshalListFoldersResponse = data => {
20350
+ if (!isJSONObject(data)) {
20351
+ throw new TypeError(`Unmarshalling the type 'ListFoldersResponse' failed as data isn't a dictionary.`);
20352
+ }
20353
+ return {
20354
+ folders: unmarshalArrayOfObject(data.folders, unmarshalFolder),
20355
+ totalCount: data.total_count
20356
+ };
20357
+ };
20336
20358
  const unmarshalListSecretVersionsResponse = data => {
20337
20359
  if (!isJSONObject(data)) {
20338
20360
  throw new TypeError(`Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`);
@@ -20371,9 +20393,15 @@ const marshalAddSecretOwnerRequest = (request, defaults) => ({
20371
20393
  product: request.product ?? 'unknown',
20372
20394
  product_name: request.productName
20373
20395
  });
20396
+ const marshalCreateFolderRequest = (request, defaults) => ({
20397
+ name: request.name,
20398
+ path: request.path,
20399
+ project_id: request.projectId ?? defaults.defaultProjectId
20400
+ });
20374
20401
  const marshalCreateSecretRequest = (request, defaults) => ({
20375
20402
  description: request.description,
20376
20403
  name: request.name,
20404
+ path: request.path,
20377
20405
  project_id: request.projectId ?? defaults.defaultProjectId,
20378
20406
  tags: request.tags,
20379
20407
  type: request.type ?? 'unknown_secret_type'
@@ -20400,6 +20428,7 @@ const marshalGeneratePasswordRequest = (request, defaults) => ({
20400
20428
  const marshalUpdateSecretRequest = (request, defaults) => ({
20401
20429
  description: request.description,
20402
20430
  name: request.name,
20431
+ path: request.path,
20403
20432
  tags: request.tags
20404
20433
  });
20405
20434
  const marshalUpdateSecretVersionRequest = (request, defaults) => ({
@@ -20423,7 +20452,7 @@ let API$6 = class API extends API$s {
20423
20452
  static LOCALITIES = ['fr-par'];
20424
20453
 
20425
20454
  /**
20426
- * Create a secret. You must sepcify the `region` to create a secret.
20455
+ * Create a secret. You must specify the `region` to create a secret.
20427
20456
  *
20428
20457
  * @param request - The request {@link CreateSecretRequest}
20429
20458
  * @returns A Promise of Secret
@@ -20435,6 +20464,19 @@ let API$6 = class API extends API$s {
20435
20464
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets`
20436
20465
  }, unmarshalSecret);
20437
20466
 
20467
+ /**
20468
+ * Create folder.
20469
+ *
20470
+ * @param request - The request {@link CreateFolderRequest}
20471
+ * @returns A Promise of Folder
20472
+ */
20473
+ createFolder = request => this.client.fetch({
20474
+ body: JSON.stringify(marshalCreateFolderRequest(request, this.client.settings)),
20475
+ headers: jsonContentHeaders$6,
20476
+ method: 'POST',
20477
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders`
20478
+ }, unmarshalFolder);
20479
+
20438
20480
  /**
20439
20481
  * Get metadata using the secret's ID. Retrieve the metadata of a secret
20440
20482
  * specified by the `region` and `secret_id` parameters.
@@ -20451,6 +20493,11 @@ let API$6 = class API extends API$s {
20451
20493
  * Get metadata using the secret's name. Retrieve the metadata of a secret
20452
20494
  * specified by the `region` and `secret_name` parameters.
20453
20495
  *
20496
+ * GetSecretByName usage is now deprecated.
20497
+ *
20498
+ * Scaleway recommends you to use ListSecrets with the `name` filter.
20499
+ *
20500
+ * @deprecated
20454
20501
  * @param request - The request {@link GetSecretByNameRequest}
20455
20502
  * @returns A Promise of Secret
20456
20503
  */
@@ -20477,7 +20524,7 @@ let API$6 = class API extends API$s {
20477
20524
  pageOfListSecrets = (request = {}) => this.client.fetch({
20478
20525
  method: 'GET',
20479
20526
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets`,
20480
- 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])
20527
+ 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], ['path', request.path], ['project_id', request.projectId], ['tags', request.tags])
20481
20528
  }, unmarshalListSecretsResponse);
20482
20529
 
20483
20530
  /**
@@ -20489,6 +20536,19 @@ let API$6 = class API extends API$s {
20489
20536
  * @returns A Promise of ListSecretsResponse
20490
20537
  */
20491
20538
  listSecrets = (request = {}) => enrichForPagination('secrets', this.pageOfListSecrets, request);
20539
+ pageOfListFolders = (request = {}) => this.client.fetch({
20540
+ method: 'GET',
20541
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders`,
20542
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['path', request.path], ['project_id', request.projectId ?? this.client.settings.defaultProjectId])
20543
+ }, unmarshalListFoldersResponse);
20544
+
20545
+ /**
20546
+ * List secrets. Retrieve the list of folders created within a Project.
20547
+ *
20548
+ * @param request - The request {@link ListFoldersRequest}
20549
+ * @returns A Promise of ListFoldersResponse
20550
+ */
20551
+ listFolders = (request = {}) => enrichForPagination('folders', this.pageOfListFolders, request);
20492
20552
 
20493
20553
  /**
20494
20554
  * Delete a secret. Delete a given secret specified by the `region` and
@@ -20501,6 +20561,16 @@ let API$6 = class API extends API$s {
20501
20561
  path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
20502
20562
  });
20503
20563
 
20564
+ /**
20565
+ * Delete a given folder specified by the and `folder_id` parameter.
20566
+ *
20567
+ * @param request - The request {@link DeleteFolderRequest}
20568
+ */
20569
+ deleteFolder = request => this.client.fetch({
20570
+ method: 'DELETE',
20571
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders/${validatePathParam('folderId', request.folderId)}`
20572
+ });
20573
+
20504
20574
  /**
20505
20575
  * Protect a secret. Protect a given secret specified by the `secret_id`
20506
20576
  * parameter. A protected secret can be read and modified but cannot be