@scaleway/sdk 2.29.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/api/applesilicon/v1alpha1/index.gen.d.ts +1 -1
  2. package/dist/api/applesilicon/v1alpha1/marshalling.gen.cjs +23 -0
  3. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +23 -0
  4. package/dist/api/applesilicon/v1alpha1/types.gen.d.ts +11 -0
  5. package/dist/api/baremetal/v1/marshalling.gen.cjs +1 -0
  6. package/dist/api/baremetal/v1/marshalling.gen.js +1 -0
  7. package/dist/api/baremetal/v1/types.gen.d.ts +5 -0
  8. package/dist/api/block/v1alpha1/content.gen.cjs +2 -1
  9. package/dist/api/block/v1alpha1/content.gen.js +2 -1
  10. package/dist/api/block/v1alpha1/types.gen.d.ts +1 -1
  11. package/dist/api/index.d.ts +1 -0
  12. package/dist/api/instance/v1/api.gen.cjs +25 -0
  13. package/dist/api/instance/v1/api.gen.d.ts +17 -1
  14. package/dist/api/instance/v1/api.gen.js +26 -1
  15. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  16. package/dist/api/instance/v1/marshalling.gen.cjs +14 -0
  17. package/dist/api/instance/v1/marshalling.gen.d.ts +2 -1
  18. package/dist/api/instance/v1/marshalling.gen.js +14 -0
  19. package/dist/api/instance/v1/types.gen.d.ts +25 -0
  20. package/dist/api/key_manager/index.cjs +4 -0
  21. package/dist/api/key_manager/index.d.ts +1 -0
  22. package/dist/api/key_manager/index.js +4 -0
  23. package/dist/api/key_manager/v1alpha1/api.gen.cjs +257 -0
  24. package/dist/api/key_manager/v1alpha1/api.gen.d.ts +142 -0
  25. package/dist/api/key_manager/v1alpha1/api.gen.js +257 -0
  26. package/dist/api/key_manager/v1alpha1/index.gen.cjs +4 -0
  27. package/dist/api/key_manager/v1alpha1/index.gen.d.ts +2 -0
  28. package/dist/api/key_manager/v1alpha1/index.gen.js +4 -0
  29. package/dist/api/key_manager/v1alpha1/marshalling.gen.cjs +143 -0
  30. package/dist/api/key_manager/v1alpha1/marshalling.gen.d.ts +12 -0
  31. package/dist/api/key_manager/v1alpha1/marshalling.gen.js +143 -0
  32. package/dist/api/key_manager/v1alpha1/types.gen.d.ts +268 -0
  33. package/dist/api/llm_inference/v1beta1/api.gen.cjs +1 -1
  34. package/dist/api/llm_inference/v1beta1/api.gen.d.ts +3 -3
  35. package/dist/api/llm_inference/v1beta1/api.gen.js +1 -1
  36. package/dist/api/llm_inference/v1beta1/types.gen.d.ts +4 -4
  37. package/dist/api/vpc/v2/api.gen.cjs +28 -1
  38. package/dist/api/vpc/v2/api.gen.d.ts +14 -2
  39. package/dist/api/vpc/v2/api.gen.js +29 -2
  40. package/dist/api/vpc/v2/index.gen.d.ts +1 -1
  41. package/dist/api/vpc/v2/marshalling.gen.cjs +16 -1
  42. package/dist/api/vpc/v2/marshalling.gen.d.ts +2 -1
  43. package/dist/api/vpc/v2/marshalling.gen.js +16 -1
  44. package/dist/api/vpc/v2/types.gen.d.ts +41 -0
  45. package/dist/index.cjs +30 -28
  46. package/dist/index.js +30 -28
  47. package/dist/scw/constants.cjs +1 -1
  48. package/dist/scw/constants.d.ts +2 -2
  49. package/dist/scw/constants.js +1 -1
  50. package/package.json +2 -2
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api = require("../../../scw/api.cjs");
4
+ const marshalling = require("../../../helpers/marshalling.cjs");
5
+ const resourcePaginator = require("../../../scw/fetch/resource-paginator.cjs");
6
+ const marshalling_gen = require("./marshalling.gen.cjs");
7
+ const jsonContentHeaders = {
8
+ "Content-Type": "application/json; charset=utf-8"
9
+ };
10
+ class API extends api.API {
11
+ /** Lists the available regions of the API. */
12
+ static LOCALITIES = ["fr-par", "nl-ams", "pl-waw"];
13
+ /**
14
+ * Create a key. Create a key in a given region specified by the `region`
15
+ * parameter. Keys only support symmetric encryption. You can use keys to
16
+ * encrypt or decrypt arbitrary payloads, or to generate data encryption keys
17
+ * that can be used without being stored in Key Manager.
18
+ *
19
+ * @param request - The request {@link CreateKeyRequest}
20
+ * @returns A Promise of Key
21
+ */
22
+ createKey = (request) => this.client.fetch(
23
+ {
24
+ body: JSON.stringify(
25
+ marshalling_gen.marshalCreateKeyRequest(request, this.client.settings)
26
+ ),
27
+ headers: jsonContentHeaders,
28
+ method: "POST",
29
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`
30
+ },
31
+ marshalling_gen.unmarshalKey
32
+ );
33
+ /**
34
+ * Get key metadata. Retrieve the metadata of a key specified by the `region`
35
+ * and `key_id` parameters.
36
+ *
37
+ * @param request - The request {@link GetKeyRequest}
38
+ * @returns A Promise of Key
39
+ */
40
+ getKey = (request) => this.client.fetch(
41
+ {
42
+ method: "GET",
43
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}`
44
+ },
45
+ marshalling_gen.unmarshalKey
46
+ );
47
+ /**
48
+ * Update a key. Update a key's metadata (name, description and tags),
49
+ * specified by the `key_id` and `region` parameters.
50
+ *
51
+ * @param request - The request {@link UpdateKeyRequest}
52
+ * @returns A Promise of Key
53
+ */
54
+ updateKey = (request) => this.client.fetch(
55
+ {
56
+ body: JSON.stringify(
57
+ marshalling_gen.marshalUpdateKeyRequest(request, this.client.settings)
58
+ ),
59
+ headers: jsonContentHeaders,
60
+ method: "PATCH",
61
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}`
62
+ },
63
+ marshalling_gen.unmarshalKey
64
+ );
65
+ /**
66
+ * Delete a key. Delete an existing key specified by the `region` and `key_id`
67
+ * parameters. Deleting a key is permanent and cannot be undone. All data
68
+ * encrypted using this key, including data encryption keys, will become
69
+ * unusable.
70
+ *
71
+ * @param request - The request {@link DeleteKeyRequest}
72
+ */
73
+ deleteKey = (request) => this.client.fetch({
74
+ method: "DELETE",
75
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}`
76
+ });
77
+ /**
78
+ * Rotate a key. Generate a new version of an existing key with randomly
79
+ * generated key material. Rotated keys can still be used to decrypt
80
+ * previously encrypted data. The key's new material will be used for
81
+ * subsequent encryption operations and data key generation.
82
+ *
83
+ * @param request - The request {@link RotateKeyRequest}
84
+ * @returns A Promise of Key
85
+ */
86
+ rotateKey = (request) => this.client.fetch(
87
+ {
88
+ body: "{}",
89
+ headers: jsonContentHeaders,
90
+ method: "POST",
91
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/rotate`
92
+ },
93
+ marshalling_gen.unmarshalKey
94
+ );
95
+ /**
96
+ * Apply key protection. Apply key protection to a given key specified by the
97
+ * `key_id` parameter. Applying key protection means that your key can be used
98
+ * and modified, but it cannot be deleted.
99
+ *
100
+ * @param request - The request {@link ProtectKeyRequest}
101
+ * @returns A Promise of Key
102
+ */
103
+ protectKey = (request) => this.client.fetch(
104
+ {
105
+ body: "{}",
106
+ headers: jsonContentHeaders,
107
+ method: "POST",
108
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/protect`
109
+ },
110
+ marshalling_gen.unmarshalKey
111
+ );
112
+ /**
113
+ * Remove key protection. Remove key protection from a given key specified by
114
+ * the `key_id` parameter. Removing key protection means that your key can be
115
+ * deleted anytime.
116
+ *
117
+ * @param request - The request {@link UnprotectKeyRequest}
118
+ * @returns A Promise of Key
119
+ */
120
+ unprotectKey = (request) => this.client.fetch(
121
+ {
122
+ body: "{}",
123
+ headers: jsonContentHeaders,
124
+ method: "POST",
125
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/unprotect`
126
+ },
127
+ marshalling_gen.unmarshalKey
128
+ );
129
+ /**
130
+ * Enable key. Enable a given key to be used for cryptographic operations.
131
+ * Enabling a key allows you to make a disabled key usable again. You must
132
+ * specify the `region` and `key_id` parameters.
133
+ *
134
+ * @param request - The request {@link EnableKeyRequest}
135
+ * @returns A Promise of Key
136
+ */
137
+ enableKey = (request) => this.client.fetch(
138
+ {
139
+ body: "{}",
140
+ headers: jsonContentHeaders,
141
+ method: "POST",
142
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/enable`
143
+ },
144
+ marshalling_gen.unmarshalKey
145
+ );
146
+ /**
147
+ * Disable key. Disable a given key to be used for cryptographic operations.
148
+ * Disabling a key renders it unusable. You must specify the `region` and
149
+ * `key_id` parameters.
150
+ *
151
+ * @param request - The request {@link DisableKeyRequest}
152
+ * @returns A Promise of Key
153
+ */
154
+ disableKey = (request) => this.client.fetch(
155
+ {
156
+ body: "{}",
157
+ headers: jsonContentHeaders,
158
+ method: "POST",
159
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/disable`
160
+ },
161
+ marshalling_gen.unmarshalKey
162
+ );
163
+ pageOfListKeys = (request = {}) => this.client.fetch(
164
+ {
165
+ method: "GET",
166
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
167
+ urlParams: marshalling.urlParams(
168
+ ["name", request.name],
169
+ ["order_by", request.orderBy],
170
+ ["organization_id", request.organizationId],
171
+ ["page", request.page],
172
+ [
173
+ "page_size",
174
+ request.pageSize ?? this.client.settings.defaultPageSize
175
+ ],
176
+ ["project_id", request.projectId],
177
+ ["tags", request.tags]
178
+ )
179
+ },
180
+ marshalling_gen.unmarshalListKeysResponse
181
+ );
182
+ /**
183
+ * List keys. Retrieve the list of keys created within all Projects of an
184
+ * Organization or in a given Project. You must specify the `region`, and
185
+ * either the `organization_id` or the `project_id`.
186
+ *
187
+ * @param request - The request {@link ListKeysRequest}
188
+ * @returns A Promise of ListKeysResponse
189
+ */
190
+ listKeys = (request = {}) => resourcePaginator.enrichForPagination("keys", this.pageOfListKeys, request);
191
+ /**
192
+ * Generate a data encryption key. Generate a new data encryption key to use
193
+ * for cryptographic operations outside of Key Manager. Note that Key Manager
194
+ * does not store your data encryption key. The data encryption key is
195
+ * encrypted and must be decrypted using the key you have created in Key
196
+ * Manager. The data encryption key's plaintext is returned in the response
197
+ * object, for immediate usage.
198
+ *
199
+ * Always store the data encryption key's ciphertext, rather than its
200
+ * plaintext, which must not be stored. To retrieve your key's plaintext, call
201
+ * the Decrypt endpoint with your key's ID and ciphertext.
202
+ *
203
+ * @param request - The request {@link GenerateDataKeyRequest}
204
+ * @returns A Promise of DataKey
205
+ */
206
+ generateDataKey = (request) => this.client.fetch(
207
+ {
208
+ body: JSON.stringify(
209
+ marshalling_gen.marshalGenerateDataKeyRequest(request, this.client.settings)
210
+ ),
211
+ headers: jsonContentHeaders,
212
+ method: "POST",
213
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/generate-data-key`
214
+ },
215
+ marshalling_gen.unmarshalDataKey
216
+ );
217
+ /**
218
+ * Encrypt data. Encrypt data using an existing key, specified by the `key_id`
219
+ * parameter. Only keys with a usage set to **symmetric_encryption** are
220
+ * supported by this method. The maximum payload size that can be encrypted is
221
+ * 64KB of plaintext.
222
+ *
223
+ * @param request - The request {@link EncryptRequest}
224
+ * @returns A Promise of EncryptResponse
225
+ */
226
+ encrypt = (request) => this.client.fetch(
227
+ {
228
+ body: JSON.stringify(
229
+ marshalling_gen.marshalEncryptRequest(request, this.client.settings)
230
+ ),
231
+ headers: jsonContentHeaders,
232
+ method: "POST",
233
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/encrypt`
234
+ },
235
+ marshalling_gen.unmarshalEncryptResponse
236
+ );
237
+ /**
238
+ * Decrypt data. Decrypt data using an existing key, specified by the `key_id`
239
+ * parameter. The maximum payload size that can be decrypted is the result of
240
+ * the encryption of 64KB of data (around 131KB).
241
+ *
242
+ * @param request - The request {@link DecryptRequest}
243
+ * @returns A Promise of DecryptResponse
244
+ */
245
+ decrypt = (request) => this.client.fetch(
246
+ {
247
+ body: JSON.stringify(
248
+ marshalling_gen.marshalDecryptRequest(request, this.client.settings)
249
+ ),
250
+ headers: jsonContentHeaders,
251
+ method: "POST",
252
+ path: `/key-manager/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${marshalling.validatePathParam("keyId", request.keyId)}/decrypt`
253
+ },
254
+ marshalling_gen.unmarshalDecryptResponse
255
+ );
256
+ }
257
+ exports.API = API;
@@ -0,0 +1,142 @@
1
+ import { API as ParentAPI } from '../../../bridge';
2
+ import type { Region } from '../../../bridge';
3
+ import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, Key, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, RotateKeyRequest, UnprotectKeyRequest, UpdateKeyRequest } from './types.gen';
4
+ /**
5
+ * Key Manager API.
6
+ *
7
+ * This API allows you to create, manage and use cryptographic keys in a
8
+ * centralized and secure service.
9
+ */
10
+ export declare class API extends ParentAPI {
11
+ /** Lists the available regions of the API. */
12
+ static readonly LOCALITIES: Region[];
13
+ /**
14
+ * Create a key. Create a key in a given region specified by the `region`
15
+ * parameter. Keys only support symmetric encryption. You can use keys to
16
+ * encrypt or decrypt arbitrary payloads, or to generate data encryption keys
17
+ * that can be used without being stored in Key Manager.
18
+ *
19
+ * @param request - The request {@link CreateKeyRequest}
20
+ * @returns A Promise of Key
21
+ */
22
+ createKey: (request: Readonly<CreateKeyRequest>) => Promise<Key>;
23
+ /**
24
+ * Get key metadata. Retrieve the metadata of a key specified by the `region`
25
+ * and `key_id` parameters.
26
+ *
27
+ * @param request - The request {@link GetKeyRequest}
28
+ * @returns A Promise of Key
29
+ */
30
+ getKey: (request: Readonly<GetKeyRequest>) => Promise<Key>;
31
+ /**
32
+ * Update a key. Update a key's metadata (name, description and tags),
33
+ * specified by the `key_id` and `region` parameters.
34
+ *
35
+ * @param request - The request {@link UpdateKeyRequest}
36
+ * @returns A Promise of Key
37
+ */
38
+ updateKey: (request: Readonly<UpdateKeyRequest>) => Promise<Key>;
39
+ /**
40
+ * Delete a key. Delete an existing key specified by the `region` and `key_id`
41
+ * parameters. Deleting a key is permanent and cannot be undone. All data
42
+ * encrypted using this key, including data encryption keys, will become
43
+ * unusable.
44
+ *
45
+ * @param request - The request {@link DeleteKeyRequest}
46
+ */
47
+ deleteKey: (request: Readonly<DeleteKeyRequest>) => Promise<void>;
48
+ /**
49
+ * Rotate a key. Generate a new version of an existing key with randomly
50
+ * generated key material. Rotated keys can still be used to decrypt
51
+ * previously encrypted data. The key's new material will be used for
52
+ * subsequent encryption operations and data key generation.
53
+ *
54
+ * @param request - The request {@link RotateKeyRequest}
55
+ * @returns A Promise of Key
56
+ */
57
+ rotateKey: (request: Readonly<RotateKeyRequest>) => Promise<Key>;
58
+ /**
59
+ * Apply key protection. Apply key protection to a given key specified by the
60
+ * `key_id` parameter. Applying key protection means that your key can be used
61
+ * and modified, but it cannot be deleted.
62
+ *
63
+ * @param request - The request {@link ProtectKeyRequest}
64
+ * @returns A Promise of Key
65
+ */
66
+ protectKey: (request: Readonly<ProtectKeyRequest>) => Promise<Key>;
67
+ /**
68
+ * Remove key protection. Remove key protection from a given key specified by
69
+ * the `key_id` parameter. Removing key protection means that your key can be
70
+ * deleted anytime.
71
+ *
72
+ * @param request - The request {@link UnprotectKeyRequest}
73
+ * @returns A Promise of Key
74
+ */
75
+ unprotectKey: (request: Readonly<UnprotectKeyRequest>) => Promise<Key>;
76
+ /**
77
+ * Enable key. Enable a given key to be used for cryptographic operations.
78
+ * Enabling a key allows you to make a disabled key usable again. You must
79
+ * specify the `region` and `key_id` parameters.
80
+ *
81
+ * @param request - The request {@link EnableKeyRequest}
82
+ * @returns A Promise of Key
83
+ */
84
+ enableKey: (request: Readonly<EnableKeyRequest>) => Promise<Key>;
85
+ /**
86
+ * Disable key. Disable a given key to be used for cryptographic operations.
87
+ * Disabling a key renders it unusable. You must specify the `region` and
88
+ * `key_id` parameters.
89
+ *
90
+ * @param request - The request {@link DisableKeyRequest}
91
+ * @returns A Promise of Key
92
+ */
93
+ disableKey: (request: Readonly<DisableKeyRequest>) => Promise<Key>;
94
+ protected pageOfListKeys: (request?: Readonly<ListKeysRequest>) => Promise<ListKeysResponse>;
95
+ /**
96
+ * List keys. Retrieve the list of keys created within all Projects of an
97
+ * Organization or in a given Project. You must specify the `region`, and
98
+ * either the `organization_id` or the `project_id`.
99
+ *
100
+ * @param request - The request {@link ListKeysRequest}
101
+ * @returns A Promise of ListKeysResponse
102
+ */
103
+ listKeys: (request?: Readonly<ListKeysRequest>) => Promise<ListKeysResponse> & {
104
+ all: () => Promise<Key[]>;
105
+ [Symbol.asyncIterator]: () => AsyncGenerator<Key[], void, void>;
106
+ };
107
+ /**
108
+ * Generate a data encryption key. Generate a new data encryption key to use
109
+ * for cryptographic operations outside of Key Manager. Note that Key Manager
110
+ * does not store your data encryption key. The data encryption key is
111
+ * encrypted and must be decrypted using the key you have created in Key
112
+ * Manager. The data encryption key's plaintext is returned in the response
113
+ * object, for immediate usage.
114
+ *
115
+ * Always store the data encryption key's ciphertext, rather than its
116
+ * plaintext, which must not be stored. To retrieve your key's plaintext, call
117
+ * the Decrypt endpoint with your key's ID and ciphertext.
118
+ *
119
+ * @param request - The request {@link GenerateDataKeyRequest}
120
+ * @returns A Promise of DataKey
121
+ */
122
+ generateDataKey: (request: Readonly<GenerateDataKeyRequest>) => Promise<DataKey>;
123
+ /**
124
+ * Encrypt data. Encrypt data using an existing key, specified by the `key_id`
125
+ * parameter. Only keys with a usage set to **symmetric_encryption** are
126
+ * supported by this method. The maximum payload size that can be encrypted is
127
+ * 64KB of plaintext.
128
+ *
129
+ * @param request - The request {@link EncryptRequest}
130
+ * @returns A Promise of EncryptResponse
131
+ */
132
+ encrypt: (request: Readonly<EncryptRequest>) => Promise<EncryptResponse>;
133
+ /**
134
+ * Decrypt data. Decrypt data using an existing key, specified by the `key_id`
135
+ * parameter. The maximum payload size that can be decrypted is the result of
136
+ * the encryption of 64KB of data (around 131KB).
137
+ *
138
+ * @param request - The request {@link DecryptRequest}
139
+ * @returns A Promise of DecryptResponse
140
+ */
141
+ decrypt: (request: Readonly<DecryptRequest>) => Promise<DecryptResponse>;
142
+ }
@@ -0,0 +1,257 @@
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 { marshalCreateKeyRequest, unmarshalKey, marshalUpdateKeyRequest, unmarshalListKeysResponse, marshalGenerateDataKeyRequest, unmarshalDataKey, marshalEncryptRequest, unmarshalEncryptResponse, marshalDecryptRequest, unmarshalDecryptResponse } from "./marshalling.gen.js";
5
+ const jsonContentHeaders = {
6
+ "Content-Type": "application/json; charset=utf-8"
7
+ };
8
+ class API extends API$1 {
9
+ /** Lists the available regions of the API. */
10
+ static LOCALITIES = ["fr-par", "nl-ams", "pl-waw"];
11
+ /**
12
+ * Create a key. Create a key in a given region specified by the `region`
13
+ * parameter. Keys only support symmetric encryption. You can use keys to
14
+ * encrypt or decrypt arbitrary payloads, or to generate data encryption keys
15
+ * that can be used without being stored in Key Manager.
16
+ *
17
+ * @param request - The request {@link CreateKeyRequest}
18
+ * @returns A Promise of Key
19
+ */
20
+ createKey = (request) => this.client.fetch(
21
+ {
22
+ body: JSON.stringify(
23
+ marshalCreateKeyRequest(request, this.client.settings)
24
+ ),
25
+ headers: jsonContentHeaders,
26
+ method: "POST",
27
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`
28
+ },
29
+ unmarshalKey
30
+ );
31
+ /**
32
+ * Get key metadata. Retrieve the metadata of a key specified by the `region`
33
+ * and `key_id` parameters.
34
+ *
35
+ * @param request - The request {@link GetKeyRequest}
36
+ * @returns A Promise of Key
37
+ */
38
+ getKey = (request) => this.client.fetch(
39
+ {
40
+ method: "GET",
41
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
42
+ },
43
+ unmarshalKey
44
+ );
45
+ /**
46
+ * Update a key. Update a key's metadata (name, description and tags),
47
+ * specified by the `key_id` and `region` parameters.
48
+ *
49
+ * @param request - The request {@link UpdateKeyRequest}
50
+ * @returns A Promise of Key
51
+ */
52
+ updateKey = (request) => this.client.fetch(
53
+ {
54
+ body: JSON.stringify(
55
+ marshalUpdateKeyRequest(request, this.client.settings)
56
+ ),
57
+ headers: jsonContentHeaders,
58
+ method: "PATCH",
59
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
60
+ },
61
+ unmarshalKey
62
+ );
63
+ /**
64
+ * Delete a key. Delete an existing key specified by the `region` and `key_id`
65
+ * parameters. Deleting a key is permanent and cannot be undone. All data
66
+ * encrypted using this key, including data encryption keys, will become
67
+ * unusable.
68
+ *
69
+ * @param request - The request {@link DeleteKeyRequest}
70
+ */
71
+ deleteKey = (request) => this.client.fetch({
72
+ method: "DELETE",
73
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}`
74
+ });
75
+ /**
76
+ * Rotate a key. Generate a new version of an existing key with randomly
77
+ * generated key material. Rotated keys can still be used to decrypt
78
+ * previously encrypted data. The key's new material will be used for
79
+ * subsequent encryption operations and data key generation.
80
+ *
81
+ * @param request - The request {@link RotateKeyRequest}
82
+ * @returns A Promise of Key
83
+ */
84
+ rotateKey = (request) => this.client.fetch(
85
+ {
86
+ body: "{}",
87
+ headers: jsonContentHeaders,
88
+ method: "POST",
89
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/rotate`
90
+ },
91
+ unmarshalKey
92
+ );
93
+ /**
94
+ * Apply key protection. Apply key protection to a given key specified by the
95
+ * `key_id` parameter. Applying key protection means that your key can be used
96
+ * and modified, but it cannot be deleted.
97
+ *
98
+ * @param request - The request {@link ProtectKeyRequest}
99
+ * @returns A Promise of Key
100
+ */
101
+ protectKey = (request) => this.client.fetch(
102
+ {
103
+ body: "{}",
104
+ headers: jsonContentHeaders,
105
+ method: "POST",
106
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/protect`
107
+ },
108
+ unmarshalKey
109
+ );
110
+ /**
111
+ * Remove key protection. Remove key protection from a given key specified by
112
+ * the `key_id` parameter. Removing key protection means that your key can be
113
+ * deleted anytime.
114
+ *
115
+ * @param request - The request {@link UnprotectKeyRequest}
116
+ * @returns A Promise of Key
117
+ */
118
+ unprotectKey = (request) => this.client.fetch(
119
+ {
120
+ body: "{}",
121
+ headers: jsonContentHeaders,
122
+ method: "POST",
123
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/unprotect`
124
+ },
125
+ unmarshalKey
126
+ );
127
+ /**
128
+ * Enable key. Enable a given key to be used for cryptographic operations.
129
+ * Enabling a key allows you to make a disabled key usable again. You must
130
+ * specify the `region` and `key_id` parameters.
131
+ *
132
+ * @param request - The request {@link EnableKeyRequest}
133
+ * @returns A Promise of Key
134
+ */
135
+ enableKey = (request) => this.client.fetch(
136
+ {
137
+ body: "{}",
138
+ headers: jsonContentHeaders,
139
+ method: "POST",
140
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/enable`
141
+ },
142
+ unmarshalKey
143
+ );
144
+ /**
145
+ * Disable key. Disable a given key to be used for cryptographic operations.
146
+ * Disabling a key renders it unusable. You must specify the `region` and
147
+ * `key_id` parameters.
148
+ *
149
+ * @param request - The request {@link DisableKeyRequest}
150
+ * @returns A Promise of Key
151
+ */
152
+ disableKey = (request) => this.client.fetch(
153
+ {
154
+ body: "{}",
155
+ headers: jsonContentHeaders,
156
+ method: "POST",
157
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/disable`
158
+ },
159
+ unmarshalKey
160
+ );
161
+ pageOfListKeys = (request = {}) => this.client.fetch(
162
+ {
163
+ method: "GET",
164
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
165
+ urlParams: urlParams(
166
+ ["name", request.name],
167
+ ["order_by", request.orderBy],
168
+ ["organization_id", request.organizationId],
169
+ ["page", request.page],
170
+ [
171
+ "page_size",
172
+ request.pageSize ?? this.client.settings.defaultPageSize
173
+ ],
174
+ ["project_id", request.projectId],
175
+ ["tags", request.tags]
176
+ )
177
+ },
178
+ unmarshalListKeysResponse
179
+ );
180
+ /**
181
+ * List keys. Retrieve the list of keys created within all Projects of an
182
+ * Organization or in a given Project. You must specify the `region`, and
183
+ * either the `organization_id` or the `project_id`.
184
+ *
185
+ * @param request - The request {@link ListKeysRequest}
186
+ * @returns A Promise of ListKeysResponse
187
+ */
188
+ listKeys = (request = {}) => enrichForPagination("keys", this.pageOfListKeys, request);
189
+ /**
190
+ * Generate a data encryption key. Generate a new data encryption key to use
191
+ * for cryptographic operations outside of Key Manager. Note that Key Manager
192
+ * does not store your data encryption key. The data encryption key is
193
+ * encrypted and must be decrypted using the key you have created in Key
194
+ * Manager. The data encryption key's plaintext is returned in the response
195
+ * object, for immediate usage.
196
+ *
197
+ * Always store the data encryption key's ciphertext, rather than its
198
+ * plaintext, which must not be stored. To retrieve your key's plaintext, call
199
+ * the Decrypt endpoint with your key's ID and ciphertext.
200
+ *
201
+ * @param request - The request {@link GenerateDataKeyRequest}
202
+ * @returns A Promise of DataKey
203
+ */
204
+ generateDataKey = (request) => this.client.fetch(
205
+ {
206
+ body: JSON.stringify(
207
+ marshalGenerateDataKeyRequest(request, this.client.settings)
208
+ ),
209
+ headers: jsonContentHeaders,
210
+ method: "POST",
211
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/generate-data-key`
212
+ },
213
+ unmarshalDataKey
214
+ );
215
+ /**
216
+ * Encrypt data. Encrypt data using an existing key, specified by the `key_id`
217
+ * parameter. Only keys with a usage set to **symmetric_encryption** are
218
+ * supported by this method. The maximum payload size that can be encrypted is
219
+ * 64KB of plaintext.
220
+ *
221
+ * @param request - The request {@link EncryptRequest}
222
+ * @returns A Promise of EncryptResponse
223
+ */
224
+ encrypt = (request) => this.client.fetch(
225
+ {
226
+ body: JSON.stringify(
227
+ marshalEncryptRequest(request, this.client.settings)
228
+ ),
229
+ headers: jsonContentHeaders,
230
+ method: "POST",
231
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/encrypt`
232
+ },
233
+ unmarshalEncryptResponse
234
+ );
235
+ /**
236
+ * Decrypt data. Decrypt data using an existing key, specified by the `key_id`
237
+ * parameter. The maximum payload size that can be decrypted is the result of
238
+ * the encryption of 64KB of data (around 131KB).
239
+ *
240
+ * @param request - The request {@link DecryptRequest}
241
+ * @returns A Promise of DecryptResponse
242
+ */
243
+ decrypt = (request) => this.client.fetch(
244
+ {
245
+ body: JSON.stringify(
246
+ marshalDecryptRequest(request, this.client.settings)
247
+ ),
248
+ headers: jsonContentHeaders,
249
+ method: "POST",
250
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/decrypt`
251
+ },
252
+ unmarshalDecryptResponse
253
+ );
254
+ }
255
+ export {
256
+ API
257
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api_gen = require("./api.gen.cjs");
4
+ exports.API = api_gen.API;
@@ -0,0 +1,2 @@
1
+ export { API } from './api.gen';
2
+ export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, Key, KeyAlgorithmSymmetricEncryption, KeyRotationPolicy, KeyState, KeyUsage, ListKeysRequest, ListKeysRequestOrderBy, ListKeysResponse, ProtectKeyRequest, RotateKeyRequest, UnprotectKeyRequest, UpdateKeyRequest, } from './types.gen';
@@ -0,0 +1,4 @@
1
+ import { API } from "./api.gen.js";
2
+ export {
3
+ API
4
+ };