@scaleway/sdk-secret 1.3.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-secret
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-secret.svg)](https://www.npmjs.com/package/@scaleway/sdk-secret)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-secret.svg)](https://www.npmjs.com/package/@scaleway/sdk-secret)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-secret.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Secret API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-secret @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-secret @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-secret @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Secret } from '@scaleway/sdk-secret'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Secret.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Secret } from '@scaleway/sdk-secret'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Secret.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Secret API Documentation](https://www.scaleway.com/en/developers/api/secret/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,6 +1,6 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality } from '@scaleway/sdk-client';
3
- import type { AccessSecretVersionByPathRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, AddSecretOwnerRequest, BrowseSecretsRequest, BrowseSecretsResponse, CreateSecretRequest, CreateSecretVersionRequest, DeleteSecretRequest, DeleteSecretVersionRequest, DisableSecretVersionRequest, EnableSecretVersionRequest, GetSecretRequest, GetSecretVersionRequest, ListSecretTypesRequest, ListSecretTypesResponse, ListSecretVersionsRequest, ListSecretVersionsResponse, ListSecretsRequest, ListSecretsResponse, ListTagsRequest, ListTagsResponse, ProtectSecretRequest, RestoreSecretRequest, RestoreSecretVersionRequest, Secret, SecretVersion, UnprotectSecretRequest, UpdateSecretRequest, UpdateSecretVersionRequest } from './types.gen.js';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
+ import type { AccessSecretVersionByPathRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, AddSecretOwnerRequest, BrowseSecretsRequest, BrowseSecretsResponse, CreateSecretRequest, CreateSecretVersionRequest, DeleteSecretRequest, DeleteSecretVersionRequest, DisableSecretVersionRequest, EnableSecretVersionRequest, GetSecretRequest, GetSecretVersionRequest, ListSecretsRequest, ListSecretsResponse, ListSecretTypesRequest, ListSecretTypesResponse, ListSecretVersionsRequest, ListSecretVersionsResponse, ListTagsRequest, ListTagsResponse, ProtectSecretRequest, RestoreSecretRequest, RestoreSecretVersionRequest, Secret, SecretVersion, UnprotectSecretRequest, UpdateSecretRequest, UpdateSecretVersionRequest } from './types.gen.js';
4
4
  /**
5
5
  * Secret Manager API.
6
6
 
@@ -9,7 +9,11 @@ class API extends API$1 {
9
9
  * type ∈ {'zone','region','global','unspecified'}
10
10
  */
11
11
  static LOCALITY = toApiLocality({
12
- regions: ["fr-par", "nl-ams", "pl-waw"]
12
+ regions: [
13
+ "fr-par",
14
+ "nl-ams",
15
+ "pl-waw"
16
+ ]
13
17
  });
14
18
  /**
15
19
  * Create a secret. Create a secret in a given region specified by the `region` parameter.
@@ -63,10 +67,12 @@ class API extends API$1 {
63
67
  *
64
68
  * @param request - The request {@link DeleteSecretRequest}
65
69
  */
66
- deleteSecret = (request) => this.client.fetch({
67
- method: "DELETE",
68
- path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}`
69
- });
70
+ deleteSecret = (request) => this.client.fetch(
71
+ {
72
+ method: "DELETE",
73
+ path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}`
74
+ }
75
+ );
70
76
  pageOfListSecrets = (request) => this.client.fetch(
71
77
  {
72
78
  method: "GET",
@@ -77,10 +83,7 @@ class API extends API$1 {
77
83
  ["order_by", request.orderBy],
78
84
  ["organization_id", request.organizationId],
79
85
  ["page", request.page],
80
- [
81
- "page_size",
82
- request.pageSize ?? this.client.settings.defaultPageSize
83
- ],
86
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
84
87
  ["path", request.path],
85
88
  ["project_id", request.projectId],
86
89
  ["scheduled_for_deletion", request.scheduledForDeletion],
@@ -110,10 +113,7 @@ class API extends API$1 {
110
113
  urlParams: urlParams(
111
114
  ["order_by", request.orderBy],
112
115
  ["page", request.page],
113
- [
114
- "page_size",
115
- request.pageSize ?? this.client.settings.defaultPageSize
116
- ],
116
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
117
117
  ["prefix", request.prefix],
118
118
  ["project_id", request.projectId],
119
119
  ["tags", request.tags],
@@ -157,14 +157,16 @@ class API extends API$1 {
157
157
  *
158
158
  * @param request - The request {@link AddSecretOwnerRequest}
159
159
  */
160
- addSecretOwner = (request) => this.client.fetch({
161
- body: JSON.stringify(
162
- marshalAddSecretOwnerRequest(request, this.client.settings)
163
- ),
164
- headers: jsonContentHeaders,
165
- method: "POST",
166
- path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}/add-owner`
167
- });
160
+ addSecretOwner = (request) => this.client.fetch(
161
+ {
162
+ body: JSON.stringify(
163
+ marshalAddSecretOwnerRequest(request, this.client.settings)
164
+ ),
165
+ headers: jsonContentHeaders,
166
+ method: "POST",
167
+ path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}/add-owner`
168
+ }
169
+ );
168
170
  /**
169
171
  * Create a version. Create a version of a given secret specified by the `region` and `secret_id` parameters.
170
172
  *
@@ -217,20 +219,19 @@ class API extends API$1 {
217
219
  *
218
220
  * @param request - The request {@link DeleteSecretVersionRequest}
219
221
  */
220
- deleteSecretVersion = (request) => this.client.fetch({
221
- method: "DELETE",
222
- path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}/versions/${validatePathParam("revision", request.revision)}`
223
- });
222
+ deleteSecretVersion = (request) => this.client.fetch(
223
+ {
224
+ method: "DELETE",
225
+ path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}/versions/${validatePathParam("revision", request.revision)}`
226
+ }
227
+ );
224
228
  pageOfListSecretVersions = (request) => this.client.fetch(
225
229
  {
226
230
  method: "GET",
227
231
  path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam("secretId", request.secretId)}/versions`,
228
232
  urlParams: urlParams(
229
233
  ["page", request.page],
230
- [
231
- "page_size",
232
- request.pageSize ?? this.client.settings.defaultPageSize
233
- ],
234
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
234
235
  ["status", request.status]
235
236
  )
236
237
  },
@@ -267,10 +268,7 @@ class API extends API$1 {
267
268
  method: "GET",
268
269
  path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets-by-path/versions/${validatePathParam("revision", request.revision)}/access`,
269
270
  urlParams: urlParams(
270
- [
271
- "project_id",
272
- request.projectId ?? this.client.settings.defaultProjectId
273
- ],
271
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId],
274
272
  ["secret_name", request.secretName],
275
273
  ["secret_path", request.secretPath]
276
274
  )
@@ -313,14 +311,8 @@ class API extends API$1 {
313
311
  path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tags`,
314
312
  urlParams: urlParams(
315
313
  ["page", request.page],
316
- [
317
- "page_size",
318
- request.pageSize ?? this.client.settings.defaultPageSize
319
- ],
320
- [
321
- "project_id",
322
- request.projectId ?? this.client.settings.defaultProjectId
323
- ]
314
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
315
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
324
316
  )
325
317
  },
326
318
  unmarshalListTagsResponse
@@ -338,14 +330,8 @@ class API extends API$1 {
338
330
  path: `/secret-manager/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secret-types`,
339
331
  urlParams: urlParams(
340
332
  ["page", request.page],
341
- [
342
- "page_size",
343
- request.pageSize ?? this.client.settings.defaultPageSize
344
- ],
345
- [
346
- "project_id",
347
- request.projectId ?? this.client.settings.defaultProjectId
348
- ]
333
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
334
+ ["project_id", request.projectId ?? this.client.settings.defaultProjectId]
349
335
  )
350
336
  },
351
337
  unmarshalListSecretTypesResponse
@@ -1,4 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './marshalling.gen.js';
3
- export type { AccessSecretVersionByPathRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, AddSecretOwnerRequest, BasicCredentials, BrowseSecretsRequest, BrowseSecretsRequestOrderBy, BrowseSecretsResponse, BrowseSecretsResponseItem, BrowseSecretsResponseItemFolderDetails, BrowseSecretsResponseItemSecretDetails, CreateSecretRequest, CreateSecretVersionRequest, DatabaseCredentials, DeleteSecretRequest, DeleteSecretVersionRequest, DisableSecretVersionRequest, EnableSecretVersionRequest, EphemeralPolicy, EphemeralPolicyAction, EphemeralProperties, GetSecretRequest, GetSecretVersionRequest, ListSecretTypesRequest, ListSecretTypesResponse, ListSecretVersionsRequest, ListSecretVersionsResponse, ListSecretsRequest, ListSecretsRequestOrderBy, ListSecretsResponse, ListTagsRequest, ListTagsResponse, Product, ProtectSecretRequest, RestoreSecretRequest, RestoreSecretVersionRequest, SSHKey, Secret, SecretStatus, SecretType, SecretVersion, SecretVersionStatus, UnprotectSecretRequest, UpdateSecretRequest, UpdateSecretVersionRequest, } from './types.gen.js';
3
+ export type { AccessSecretVersionByPathRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, AddSecretOwnerRequest, BasicCredentials, BrowseSecretsRequest, BrowseSecretsRequestOrderBy, BrowseSecretsResponse, BrowseSecretsResponseItem, BrowseSecretsResponseItemFolderDetails, BrowseSecretsResponseItemSecretDetails, CreateSecretRequest, CreateSecretVersionRequest, DatabaseCredentials, DeleteSecretRequest, DeleteSecretVersionRequest, DisableSecretVersionRequest, EnableSecretVersionRequest, EphemeralPolicy, EphemeralPolicyAction, EphemeralProperties, GetSecretRequest, GetSecretVersionRequest, ListSecretsRequest, ListSecretsRequestOrderBy, ListSecretsResponse, ListSecretTypesRequest, ListSecretTypesResponse, ListSecretVersionsRequest, ListSecretVersionsResponse, ListTagsRequest, ListTagsResponse, Product, ProtectSecretRequest, RestoreSecretRequest, RestoreSecretVersionRequest, Secret, SecretStatus, SecretType, SecretVersion, SecretVersionStatus, SSHKey, UnprotectSecretRequest, UpdateSecretRequest, UpdateSecretVersionRequest, } from './types.gen.js';
4
4
  export * as ValidationRules from './validation-rules.gen.js';
@@ -1,5 +1,5 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { AccessSecretVersionResponse, AddSecretOwnerRequest, BrowseSecretsResponse, CreateSecretRequest, CreateSecretVersionRequest, ListSecretTypesResponse, ListSecretVersionsResponse, ListSecretsResponse, ListTagsResponse, Secret, SecretVersion, UpdateSecretRequest, UpdateSecretVersionRequest } from './types.gen.js';
2
+ import type { AccessSecretVersionResponse, AddSecretOwnerRequest, BrowseSecretsResponse, CreateSecretRequest, CreateSecretVersionRequest, ListSecretsResponse, ListSecretTypesResponse, ListSecretVersionsResponse, ListTagsResponse, Secret, SecretVersion, UpdateSecretRequest, UpdateSecretVersionRequest } from './types.gen.js';
3
3
  export declare const unmarshalSecretVersion: (data: unknown) => SecretVersion;
4
4
  export declare const unmarshalSecret: (data: unknown) => Secret;
5
5
  export declare const unmarshalAccessSecretVersionResponse: (data: unknown) => AccessSecretVersionResponse;
@@ -129,10 +129,7 @@ const unmarshalBrowseSecretsResponse = (data) => {
129
129
  }
130
130
  return {
131
131
  currentPath: data.current_path,
132
- items: unmarshalArrayOfObject(
133
- data.items,
134
- unmarshalBrowseSecretsResponseItem
135
- ),
132
+ items: unmarshalArrayOfObject(data.items, unmarshalBrowseSecretsResponseItem),
136
133
  totalCount: data.total_count
137
134
  };
138
135
  };
@@ -2,7 +2,7 @@ import type { Region as ScwRegion } from '@scaleway/sdk-client';
2
2
  export type BrowseSecretsRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
3
3
  export type EphemeralPolicyAction = 'unknown_action' | 'delete' | 'disable';
4
4
  export type ListSecretsRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
5
- export type Product = 'unknown_product' | 'edge_services';
5
+ export type Product = 'unknown_product' | 'edge_services' | 's2s_vpn';
6
6
  export type SecretStatus = 'unknown_status' | 'ready' | 'locked';
7
7
  export type SecretType = 'unknown_type' | 'opaque' | 'certificate' | 'key_value' | 'basic_credentials' | 'database_credentials' | 'ssh_key';
8
8
  export type SecretVersionStatus = 'unknown_status' | 'enabled' | 'disabled' | 'deleted' | 'scheduled_for_deletion';
@@ -70,10 +70,10 @@ export interface SecretVersion {
70
70
  secretId: string;
71
71
  /**
72
72
  * * `unknown_status`: the version is in an invalid state.
73
- * `enabled`: the version is accessible.
74
- * `disabled`: the version is not accessible but can be enabled.
75
- * `scheduled_for_deletion`: the version is scheduled for deletion. It will be deleted in 7 days.
76
- * `deleted`: the version is permanently deleted. It is not possible to recover it.
73
+ * `enabled`: the version is accessible.
74
+ * `disabled`: the version is not accessible but can be enabled.
75
+ * `scheduled_for_deletion`: the version is scheduled for deletion. It will be deleted in 7 days.
76
+ * `deleted`: the version is permanently deleted. It is not possible to recover it.
77
77
  */
78
78
  status: SecretVersionStatus;
79
79
  /**
@@ -124,7 +124,7 @@ export interface Secret {
124
124
  name: string;
125
125
  /**
126
126
  * * `ready`: the secret can be read, modified and deleted.
127
- * `locked`: no action can be performed on the secret. This status can only be applied and removed by Scaleway.
127
+ * `locked`: no action can be performed on the secret. This status can only be applied and removed by Scaleway.
128
128
  */
129
129
  status: SecretStatus;
130
130
  /**
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-secret",
3
- "version": "1.3.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK secret",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/secret"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1beta1/index.gen.cjs");
4
- exports.Secretv1beta1 = index_gen;
@@ -1,393 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- const jsonContentHeaders = {
6
- "Content-Type": "application/json; charset=utf-8"
7
- };
8
- class API extends sdkClient.API {
9
- /**
10
- * Locality of this API.
11
- * type ∈ {'zone','region','global','unspecified'}
12
- */
13
- static LOCALITY = sdkClient.toApiLocality({
14
- regions: ["fr-par", "nl-ams", "pl-waw"]
15
- });
16
- /**
17
- * Create a secret. Create a secret in a given region specified by the `region` parameter.
18
- *
19
- * @param request - The request {@link CreateSecretRequest}
20
- * @returns A Promise of Secret
21
- */
22
- createSecret = (request) => this.client.fetch(
23
- {
24
- body: JSON.stringify(
25
- marshalling_gen.marshalCreateSecretRequest(request, this.client.settings)
26
- ),
27
- headers: jsonContentHeaders,
28
- method: "POST",
29
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets`
30
- },
31
- marshalling_gen.unmarshalSecret
32
- );
33
- /**
34
- * Get metadata using the secret's ID. Retrieve the metadata of a secret specified by the `region` and `secret_id` parameters.
35
- *
36
- * @param request - The request {@link GetSecretRequest}
37
- * @returns A Promise of Secret
38
- */
39
- getSecret = (request) => this.client.fetch(
40
- {
41
- method: "GET",
42
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}`
43
- },
44
- marshalling_gen.unmarshalSecret
45
- );
46
- /**
47
- * Update metadata of a secret. Edit a secret's metadata such as name, tag(s), description and ephemeral policy. The secret to update is specified by the `secret_id` and `region` parameters.
48
- *
49
- * @param request - The request {@link UpdateSecretRequest}
50
- * @returns A Promise of Secret
51
- */
52
- updateSecret = (request) => this.client.fetch(
53
- {
54
- body: JSON.stringify(
55
- marshalling_gen.marshalUpdateSecretRequest(request, this.client.settings)
56
- ),
57
- headers: jsonContentHeaders,
58
- method: "PATCH",
59
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}`
60
- },
61
- marshalling_gen.unmarshalSecret
62
- );
63
- /**
64
- * Delete a secret. Delete a given secret specified by the `region` and `secret_id` parameters.
65
- *
66
- * @param request - The request {@link DeleteSecretRequest}
67
- */
68
- deleteSecret = (request) => this.client.fetch({
69
- method: "DELETE",
70
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}`
71
- });
72
- pageOfListSecrets = (request) => this.client.fetch(
73
- {
74
- method: "GET",
75
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets`,
76
- urlParams: sdkClient.urlParams(
77
- ["ephemeral", request.ephemeral],
78
- ["name", request.name],
79
- ["order_by", request.orderBy],
80
- ["organization_id", request.organizationId],
81
- ["page", request.page],
82
- [
83
- "page_size",
84
- request.pageSize ?? this.client.settings.defaultPageSize
85
- ],
86
- ["path", request.path],
87
- ["project_id", request.projectId],
88
- ["scheduled_for_deletion", request.scheduledForDeletion],
89
- ["tags", request.tags],
90
- ["type", request.type]
91
- )
92
- },
93
- marshalling_gen.unmarshalListSecretsResponse
94
- );
95
- /**
96
- * List secrets. Retrieve the list of secrets created within an Organization and/or Project. You must specify either the `organization_id` or the `project_id` and the `region`.
97
- *
98
- * @param request - The request {@link ListSecretsRequest}
99
- * @returns A Promise of ListSecretsResponse
100
- */
101
- listSecrets = (request) => sdkClient.enrichForPagination("secrets", this.pageOfListSecrets, request);
102
- /**
103
- * Browse secrets. Retrieve the list of secrets and folders for the given prefix. You must specify either the `organization_id` or the `project_id` and the `region`.
104
- *
105
- * @param request - The request {@link BrowseSecretsRequest}
106
- * @returns A Promise of BrowseSecretsResponse
107
- */
108
- browseSecrets = (request) => this.client.fetch(
109
- {
110
- method: "GET",
111
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/browse`,
112
- urlParams: sdkClient.urlParams(
113
- ["order_by", request.orderBy],
114
- ["page", request.page],
115
- [
116
- "page_size",
117
- request.pageSize ?? this.client.settings.defaultPageSize
118
- ],
119
- ["prefix", request.prefix],
120
- ["project_id", request.projectId],
121
- ["tags", request.tags],
122
- ["type", request.type]
123
- )
124
- },
125
- marshalling_gen.unmarshalBrowseSecretsResponse
126
- );
127
- /**
128
- * Enable secret protection. Enable secret protection for a given secret specified by the `secret_id` parameter. Enabling secret protection means that your secret can be read and modified, but it cannot be deleted.
129
- *
130
- * @param request - The request {@link ProtectSecretRequest}
131
- * @returns A Promise of Secret
132
- */
133
- protectSecret = (request) => this.client.fetch(
134
- {
135
- body: "{}",
136
- headers: jsonContentHeaders,
137
- method: "POST",
138
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/protect`
139
- },
140
- marshalling_gen.unmarshalSecret
141
- );
142
- /**
143
- * Disable secret protection. Disable secret protection for a given secret specified by the `secret_id` parameter. Disabling secret protection means that your secret can be read, modified and deleted.
144
- *
145
- * @param request - The request {@link UnprotectSecretRequest}
146
- * @returns A Promise of Secret
147
- */
148
- unprotectSecret = (request) => this.client.fetch(
149
- {
150
- body: "{}",
151
- headers: jsonContentHeaders,
152
- method: "POST",
153
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/unprotect`
154
- },
155
- marshalling_gen.unmarshalSecret
156
- );
157
- /**
158
- * Allow a product to use the secret.
159
- *
160
- * @param request - The request {@link AddSecretOwnerRequest}
161
- */
162
- addSecretOwner = (request) => this.client.fetch({
163
- body: JSON.stringify(
164
- marshalling_gen.marshalAddSecretOwnerRequest(request, this.client.settings)
165
- ),
166
- headers: jsonContentHeaders,
167
- method: "POST",
168
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/add-owner`
169
- });
170
- /**
171
- * Create a version. Create a version of a given secret specified by the `region` and `secret_id` parameters.
172
- *
173
- * @param request - The request {@link CreateSecretVersionRequest}
174
- * @returns A Promise of SecretVersion
175
- */
176
- createSecretVersion = (request) => this.client.fetch(
177
- {
178
- body: JSON.stringify(
179
- marshalling_gen.marshalCreateSecretVersionRequest(request, this.client.settings)
180
- ),
181
- headers: jsonContentHeaders,
182
- method: "POST",
183
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions`
184
- },
185
- marshalling_gen.unmarshalSecretVersion
186
- );
187
- /**
188
- * Get metadata of a secret's version using the secret's ID. Retrieve the metadata of a secret's given version specified by the `region`, `secret_id` and `revision` parameters.
189
- *
190
- * @param request - The request {@link GetSecretVersionRequest}
191
- * @returns A Promise of SecretVersion
192
- */
193
- getSecretVersion = (request) => this.client.fetch(
194
- {
195
- method: "GET",
196
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}`
197
- },
198
- marshalling_gen.unmarshalSecretVersion
199
- );
200
- /**
201
- * Update metadata of a version. Edit the metadata of a secret's given version, specified by the `region`, `secret_id` and `revision` parameters.
202
- *
203
- * @param request - The request {@link UpdateSecretVersionRequest}
204
- * @returns A Promise of SecretVersion
205
- */
206
- updateSecretVersion = (request) => this.client.fetch(
207
- {
208
- body: JSON.stringify(
209
- marshalling_gen.marshalUpdateSecretVersionRequest(request, this.client.settings)
210
- ),
211
- headers: jsonContentHeaders,
212
- method: "PATCH",
213
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}`
214
- },
215
- marshalling_gen.unmarshalSecretVersion
216
- );
217
- /**
218
- * Delete a version. Delete a secret's version and the sensitive data contained in it. Deleting a version is permanent and cannot be undone.
219
- *
220
- * @param request - The request {@link DeleteSecretVersionRequest}
221
- */
222
- deleteSecretVersion = (request) => this.client.fetch({
223
- method: "DELETE",
224
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}`
225
- });
226
- pageOfListSecretVersions = (request) => this.client.fetch(
227
- {
228
- method: "GET",
229
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions`,
230
- urlParams: sdkClient.urlParams(
231
- ["page", request.page],
232
- [
233
- "page_size",
234
- request.pageSize ?? this.client.settings.defaultPageSize
235
- ],
236
- ["status", request.status]
237
- )
238
- },
239
- marshalling_gen.unmarshalListSecretVersionsResponse
240
- );
241
- /**
242
- * List versions of a secret using the secret's ID. Retrieve the list of a given secret's versions specified by the `secret_id` and `region` parameters.
243
- *
244
- * @param request - The request {@link ListSecretVersionsRequest}
245
- * @returns A Promise of ListSecretVersionsResponse
246
- */
247
- listSecretVersions = (request) => sdkClient.enrichForPagination("versions", this.pageOfListSecretVersions, request);
248
- /**
249
- * Access a secret's version using the secret's ID. Access sensitive data in a secret's version specified by the `region`, `secret_id` and `revision` parameters.
250
- *
251
- * @param request - The request {@link AccessSecretVersionRequest}
252
- * @returns A Promise of AccessSecretVersionResponse
253
- */
254
- accessSecretVersion = (request) => this.client.fetch(
255
- {
256
- method: "GET",
257
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}/access`
258
- },
259
- marshalling_gen.unmarshalAccessSecretVersionResponse
260
- );
261
- /**
262
- * Access a secret's version using the secret's name and path. Access sensitive data in a secret's version specified by the `region`, `secret_name`, `secret_path` and `revision` parameters.
263
- *
264
- * @param request - The request {@link AccessSecretVersionByPathRequest}
265
- * @returns A Promise of AccessSecretVersionResponse
266
- */
267
- accessSecretVersionByPath = (request) => this.client.fetch(
268
- {
269
- method: "GET",
270
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets-by-path/versions/${sdkClient.validatePathParam("revision", request.revision)}/access`,
271
- urlParams: sdkClient.urlParams(
272
- [
273
- "project_id",
274
- request.projectId ?? this.client.settings.defaultProjectId
275
- ],
276
- ["secret_name", request.secretName],
277
- ["secret_path", request.secretPath]
278
- )
279
- },
280
- marshalling_gen.unmarshalAccessSecretVersionResponse
281
- );
282
- /**
283
- * Enable a version. Make a specific version accessible. You must specify the `region`, `secret_id` and `revision` parameters.
284
- *
285
- * @param request - The request {@link EnableSecretVersionRequest}
286
- * @returns A Promise of SecretVersion
287
- */
288
- enableSecretVersion = (request) => this.client.fetch(
289
- {
290
- body: "{}",
291
- headers: jsonContentHeaders,
292
- method: "POST",
293
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}/enable`
294
- },
295
- marshalling_gen.unmarshalSecretVersion
296
- );
297
- /**
298
- * Disable a version. Make a specific version inaccessible. You must specify the `region`, `secret_id` and `revision` parameters.
299
- *
300
- * @param request - The request {@link DisableSecretVersionRequest}
301
- * @returns A Promise of SecretVersion
302
- */
303
- disableSecretVersion = (request) => this.client.fetch(
304
- {
305
- body: "{}",
306
- headers: jsonContentHeaders,
307
- method: "POST",
308
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}/disable`
309
- },
310
- marshalling_gen.unmarshalSecretVersion
311
- );
312
- pageOfListTags = (request = {}) => this.client.fetch(
313
- {
314
- method: "GET",
315
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tags`,
316
- urlParams: sdkClient.urlParams(
317
- ["page", request.page],
318
- [
319
- "page_size",
320
- request.pageSize ?? this.client.settings.defaultPageSize
321
- ],
322
- [
323
- "project_id",
324
- request.projectId ?? this.client.settings.defaultProjectId
325
- ]
326
- )
327
- },
328
- marshalling_gen.unmarshalListTagsResponse
329
- );
330
- /**
331
- * List tags. List all tags associated with secrets within a given Project.
332
- *
333
- * @param request - The request {@link ListTagsRequest}
334
- * @returns A Promise of ListTagsResponse
335
- */
336
- listTags = (request = {}) => sdkClient.enrichForPagination("tags", this.pageOfListTags, request);
337
- pageOfListSecretTypes = (request = {}) => this.client.fetch(
338
- {
339
- method: "GET",
340
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secret-types`,
341
- urlParams: sdkClient.urlParams(
342
- ["page", request.page],
343
- [
344
- "page_size",
345
- request.pageSize ?? this.client.settings.defaultPageSize
346
- ],
347
- [
348
- "project_id",
349
- request.projectId ?? this.client.settings.defaultProjectId
350
- ]
351
- )
352
- },
353
- marshalling_gen.unmarshalListSecretTypesResponse
354
- );
355
- /**
356
- * List secret types. List all secret types created within a given Project.
357
- *
358
- * @param request - The request {@link ListSecretTypesRequest}
359
- * @returns A Promise of ListSecretTypesResponse
360
- */
361
- listSecretTypes = (request = {}) => sdkClient.enrichForPagination("types", this.pageOfListSecretTypes, request);
362
- /**
363
- * Restore a version. Restore a secret's version specified by the `region`, `secret_id` and `revision` parameters.
364
- *
365
- * @param request - The request {@link RestoreSecretVersionRequest}
366
- * @returns A Promise of SecretVersion
367
- */
368
- restoreSecretVersion = (request) => this.client.fetch(
369
- {
370
- body: "{}",
371
- headers: jsonContentHeaders,
372
- method: "POST",
373
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/versions/${sdkClient.validatePathParam("revision", request.revision)}/restore`
374
- },
375
- marshalling_gen.unmarshalSecretVersion
376
- );
377
- /**
378
- * Restore a secret. Restore a secret and all its versions scheduled for deletion specified by the `region` and `secret_id` parameters.
379
- *
380
- * @param request - The request {@link RestoreSecretRequest}
381
- * @returns A Promise of Secret
382
- */
383
- restoreSecret = (request) => this.client.fetch(
384
- {
385
- body: "{}",
386
- headers: jsonContentHeaders,
387
- method: "POST",
388
- path: `/secret-manager/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/secrets/${sdkClient.validatePathParam("secretId", request.secretId)}/restore`
389
- },
390
- marshalling_gen.unmarshalSecret
391
- );
392
- }
393
- exports.API = API;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- const validationRules_gen = require("./validation-rules.gen.cjs");
6
- exports.API = api_gen.API;
7
- exports.marshalAddSecretOwnerRequest = marshalling_gen.marshalAddSecretOwnerRequest;
8
- exports.marshalCreateSecretRequest = marshalling_gen.marshalCreateSecretRequest;
9
- exports.marshalCreateSecretVersionRequest = marshalling_gen.marshalCreateSecretVersionRequest;
10
- exports.marshalUpdateSecretRequest = marshalling_gen.marshalUpdateSecretRequest;
11
- exports.marshalUpdateSecretVersionRequest = marshalling_gen.marshalUpdateSecretVersionRequest;
12
- exports.unmarshalAccessSecretVersionResponse = marshalling_gen.unmarshalAccessSecretVersionResponse;
13
- exports.unmarshalBrowseSecretsResponse = marshalling_gen.unmarshalBrowseSecretsResponse;
14
- exports.unmarshalListSecretTypesResponse = marshalling_gen.unmarshalListSecretTypesResponse;
15
- exports.unmarshalListSecretVersionsResponse = marshalling_gen.unmarshalListSecretVersionsResponse;
16
- exports.unmarshalListSecretsResponse = marshalling_gen.unmarshalListSecretsResponse;
17
- exports.unmarshalListTagsResponse = marshalling_gen.unmarshalListTagsResponse;
18
- exports.unmarshalSecret = marshalling_gen.unmarshalSecret;
19
- exports.unmarshalSecretVersion = marshalling_gen.unmarshalSecretVersion;
20
- exports.ValidationRules = validationRules_gen;
@@ -1,238 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const unmarshalEphemeralProperties = (data) => {
5
- if (!sdkClient.isJSONObject(data)) {
6
- throw new TypeError(
7
- `Unmarshalling the type 'EphemeralProperties' failed as data isn't a dictionary.`
8
- );
9
- }
10
- return {
11
- action: data.action,
12
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
13
- expiresOnceAccessed: data.expires_once_accessed
14
- };
15
- };
16
- const unmarshalSecretVersion = (data) => {
17
- if (!sdkClient.isJSONObject(data)) {
18
- throw new TypeError(
19
- `Unmarshalling the type 'SecretVersion' failed as data isn't a dictionary.`
20
- );
21
- }
22
- return {
23
- createdAt: sdkClient.unmarshalDate(data.created_at),
24
- deletedAt: sdkClient.unmarshalDate(data.deleted_at),
25
- deletionRequestedAt: sdkClient.unmarshalDate(data.deletion_requested_at),
26
- description: data.description,
27
- ephemeralProperties: data.ephemeral_properties ? unmarshalEphemeralProperties(data.ephemeral_properties) : void 0,
28
- latest: data.latest,
29
- region: data.region,
30
- revision: data.revision,
31
- secretId: data.secret_id,
32
- status: data.status,
33
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
34
- };
35
- };
36
- const unmarshalEphemeralPolicy = (data) => {
37
- if (!sdkClient.isJSONObject(data)) {
38
- throw new TypeError(
39
- `Unmarshalling the type 'EphemeralPolicy' failed as data isn't a dictionary.`
40
- );
41
- }
42
- return {
43
- action: data.action,
44
- expiresOnceAccessed: data.expires_once_accessed,
45
- timeToLive: data.time_to_live
46
- };
47
- };
48
- const unmarshalSecret = (data) => {
49
- if (!sdkClient.isJSONObject(data)) {
50
- throw new TypeError(
51
- `Unmarshalling the type 'Secret' failed as data isn't a dictionary.`
52
- );
53
- }
54
- return {
55
- createdAt: sdkClient.unmarshalDate(data.created_at),
56
- deletionRequestedAt: sdkClient.unmarshalDate(data.deletion_requested_at),
57
- description: data.description,
58
- ephemeralPolicy: data.ephemeral_policy ? unmarshalEphemeralPolicy(data.ephemeral_policy) : void 0,
59
- id: data.id,
60
- keyId: data.key_id,
61
- managed: data.managed,
62
- name: data.name,
63
- path: data.path,
64
- projectId: data.project_id,
65
- protected: data.protected,
66
- region: data.region,
67
- status: data.status,
68
- tags: data.tags,
69
- type: data.type,
70
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
71
- usedBy: data.used_by,
72
- versionCount: data.version_count
73
- };
74
- };
75
- const unmarshalAccessSecretVersionResponse = (data) => {
76
- if (!sdkClient.isJSONObject(data)) {
77
- throw new TypeError(
78
- `Unmarshalling the type 'AccessSecretVersionResponse' failed as data isn't a dictionary.`
79
- );
80
- }
81
- return {
82
- data: data.data,
83
- dataCrc32: data.data_crc32,
84
- revision: data.revision,
85
- secretId: data.secret_id,
86
- type: data.type
87
- };
88
- };
89
- const unmarshalBrowseSecretsResponseItemFolderDetails = (data) => {
90
- if (!sdkClient.isJSONObject(data)) {
91
- throw new TypeError(
92
- `Unmarshalling the type 'BrowseSecretsResponseItemFolderDetails' failed as data isn't a dictionary.`
93
- );
94
- }
95
- return {};
96
- };
97
- const unmarshalBrowseSecretsResponseItemSecretDetails = (data) => {
98
- if (!sdkClient.isJSONObject(data)) {
99
- throw new TypeError(
100
- `Unmarshalling the type 'BrowseSecretsResponseItemSecretDetails' failed as data isn't a dictionary.`
101
- );
102
- }
103
- return {
104
- ephemeralPolicy: data.ephemeral_policy ? unmarshalEphemeralPolicy(data.ephemeral_policy) : void 0,
105
- id: data.id,
106
- protected: data.protected,
107
- tags: data.tags,
108
- type: data.type,
109
- versionCount: data.version_count
110
- };
111
- };
112
- const unmarshalBrowseSecretsResponseItem = (data) => {
113
- if (!sdkClient.isJSONObject(data)) {
114
- throw new TypeError(
115
- `Unmarshalling the type 'BrowseSecretsResponseItem' failed as data isn't a dictionary.`
116
- );
117
- }
118
- return {
119
- createdAt: sdkClient.unmarshalDate(data.created_at),
120
- folder: data.folder ? unmarshalBrowseSecretsResponseItemFolderDetails(data.folder) : void 0,
121
- name: data.name,
122
- secret: data.secret ? unmarshalBrowseSecretsResponseItemSecretDetails(data.secret) : void 0,
123
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
124
- };
125
- };
126
- const unmarshalBrowseSecretsResponse = (data) => {
127
- if (!sdkClient.isJSONObject(data)) {
128
- throw new TypeError(
129
- `Unmarshalling the type 'BrowseSecretsResponse' failed as data isn't a dictionary.`
130
- );
131
- }
132
- return {
133
- currentPath: data.current_path,
134
- items: sdkClient.unmarshalArrayOfObject(
135
- data.items,
136
- unmarshalBrowseSecretsResponseItem
137
- ),
138
- totalCount: data.total_count
139
- };
140
- };
141
- const unmarshalListSecretTypesResponse = (data) => {
142
- if (!sdkClient.isJSONObject(data)) {
143
- throw new TypeError(
144
- `Unmarshalling the type 'ListSecretTypesResponse' failed as data isn't a dictionary.`
145
- );
146
- }
147
- return {
148
- totalCount: data.total_count,
149
- types: data.types
150
- };
151
- };
152
- const unmarshalListSecretVersionsResponse = (data) => {
153
- if (!sdkClient.isJSONObject(data)) {
154
- throw new TypeError(
155
- `Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`
156
- );
157
- }
158
- return {
159
- totalCount: data.total_count,
160
- versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalSecretVersion)
161
- };
162
- };
163
- const unmarshalListSecretsResponse = (data) => {
164
- if (!sdkClient.isJSONObject(data)) {
165
- throw new TypeError(
166
- `Unmarshalling the type 'ListSecretsResponse' failed as data isn't a dictionary.`
167
- );
168
- }
169
- return {
170
- secrets: sdkClient.unmarshalArrayOfObject(data.secrets, unmarshalSecret),
171
- totalCount: data.total_count
172
- };
173
- };
174
- const unmarshalListTagsResponse = (data) => {
175
- if (!sdkClient.isJSONObject(data)) {
176
- throw new TypeError(
177
- `Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`
178
- );
179
- }
180
- return {
181
- tags: data.tags,
182
- totalCount: data.total_count
183
- };
184
- };
185
- const marshalAddSecretOwnerRequest = (request, defaults) => ({
186
- product: request.product
187
- });
188
- const marshalEphemeralPolicy = (request, defaults) => ({
189
- action: request.action,
190
- expires_once_accessed: request.expiresOnceAccessed,
191
- time_to_live: request.timeToLive
192
- });
193
- const marshalCreateSecretRequest = (request, defaults) => ({
194
- description: request.description,
195
- ephemeral_policy: request.ephemeralPolicy !== void 0 ? marshalEphemeralPolicy(request.ephemeralPolicy) : void 0,
196
- key_id: request.keyId,
197
- name: request.name,
198
- path: request.path,
199
- project_id: request.projectId ?? defaults.defaultProjectId,
200
- protected: request.protected,
201
- tags: request.tags,
202
- type: request.type
203
- });
204
- const marshalCreateSecretVersionRequest = (request, defaults) => ({
205
- data: request.data,
206
- data_crc32: request.dataCrc32,
207
- description: request.description,
208
- disable_previous: request.disablePrevious
209
- });
210
- const marshalUpdateSecretRequest = (request, defaults) => ({
211
- description: request.description,
212
- ephemeral_policy: request.ephemeralPolicy !== void 0 ? marshalEphemeralPolicy(request.ephemeralPolicy) : void 0,
213
- name: request.name,
214
- path: request.path,
215
- tags: request.tags
216
- });
217
- const marshalEphemeralProperties = (request, defaults) => ({
218
- action: request.action,
219
- expires_at: request.expiresAt,
220
- expires_once_accessed: request.expiresOnceAccessed
221
- });
222
- const marshalUpdateSecretVersionRequest = (request, defaults) => ({
223
- description: request.description,
224
- ephemeral_properties: request.ephemeralProperties !== void 0 ? marshalEphemeralProperties(request.ephemeralProperties) : void 0
225
- });
226
- exports.marshalAddSecretOwnerRequest = marshalAddSecretOwnerRequest;
227
- exports.marshalCreateSecretRequest = marshalCreateSecretRequest;
228
- exports.marshalCreateSecretVersionRequest = marshalCreateSecretVersionRequest;
229
- exports.marshalUpdateSecretRequest = marshalUpdateSecretRequest;
230
- exports.marshalUpdateSecretVersionRequest = marshalUpdateSecretVersionRequest;
231
- exports.unmarshalAccessSecretVersionResponse = unmarshalAccessSecretVersionResponse;
232
- exports.unmarshalBrowseSecretsResponse = unmarshalBrowseSecretsResponse;
233
- exports.unmarshalListSecretTypesResponse = unmarshalListSecretTypesResponse;
234
- exports.unmarshalListSecretVersionsResponse = unmarshalListSecretVersionsResponse;
235
- exports.unmarshalListSecretsResponse = unmarshalListSecretsResponse;
236
- exports.unmarshalListTagsResponse = unmarshalListTagsResponse;
237
- exports.unmarshalSecret = unmarshalSecret;
238
- exports.unmarshalSecretVersion = unmarshalSecretVersion;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const DatabaseCredentials = {
4
- port: {
5
- pattern: /^[0-9]+$/
6
- }
7
- };
8
- exports.DatabaseCredentials = DatabaseCredentials;