@scaleway/sdk 2.28.0 → 2.30.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 (47) hide show
  1. package/dist/api/baremetal/v1/marshalling.gen.cjs +1 -0
  2. package/dist/api/baremetal/v1/marshalling.gen.js +1 -0
  3. package/dist/api/baremetal/v1/types.gen.d.ts +5 -0
  4. package/dist/api/index.d.ts +1 -0
  5. package/dist/api/ipam/v1/api.gen.cjs +8 -0
  6. package/dist/api/ipam/v1/api.gen.d.ts +2 -1
  7. package/dist/api/ipam/v1/api.gen.js +9 -1
  8. package/dist/api/ipam/v1/index.gen.d.ts +1 -1
  9. package/dist/api/ipam/v1/marshalling.gen.cjs +4 -0
  10. package/dist/api/ipam/v1/marshalling.gen.d.ts +2 -1
  11. package/dist/api/ipam/v1/marshalling.gen.js +4 -0
  12. package/dist/api/ipam/v1/types.gen.d.ts +8 -0
  13. package/dist/api/key_manager/index.cjs +4 -0
  14. package/dist/api/key_manager/index.d.ts +1 -0
  15. package/dist/api/key_manager/index.js +4 -0
  16. package/dist/api/key_manager/v1alpha1/api.gen.cjs +257 -0
  17. package/dist/api/key_manager/v1alpha1/api.gen.d.ts +142 -0
  18. package/dist/api/key_manager/v1alpha1/api.gen.js +257 -0
  19. package/dist/api/key_manager/v1alpha1/index.gen.cjs +4 -0
  20. package/dist/api/key_manager/v1alpha1/index.gen.d.ts +2 -0
  21. package/dist/api/key_manager/v1alpha1/index.gen.js +4 -0
  22. package/dist/api/key_manager/v1alpha1/marshalling.gen.cjs +143 -0
  23. package/dist/api/key_manager/v1alpha1/marshalling.gen.d.ts +12 -0
  24. package/dist/api/key_manager/v1alpha1/marshalling.gen.js +143 -0
  25. package/dist/api/key_manager/v1alpha1/types.gen.d.ts +268 -0
  26. package/dist/api/llm_inference/v1beta1/api.gen.cjs +1 -1
  27. package/dist/api/llm_inference/v1beta1/api.gen.d.ts +3 -3
  28. package/dist/api/llm_inference/v1beta1/api.gen.js +1 -1
  29. package/dist/api/llm_inference/v1beta1/types.gen.d.ts +4 -4
  30. package/dist/api/rdb/v1/index.gen.d.ts +1 -1
  31. package/dist/api/rdb/v1/marshalling.gen.cjs +15 -0
  32. package/dist/api/rdb/v1/marshalling.gen.js +15 -0
  33. package/dist/api/rdb/v1/types.gen.d.ts +7 -0
  34. package/dist/index.cjs +30 -28
  35. package/dist/index.js +30 -28
  36. package/dist/scw/constants.cjs +1 -1
  37. package/dist/scw/constants.d.ts +2 -2
  38. package/dist/scw/constants.js +1 -1
  39. package/node_modules/@scaleway/random-name/CHANGELOG.md +24 -0
  40. package/node_modules/@scaleway/random-name/dist/index.cjs +599 -0
  41. package/node_modules/@scaleway/random-name/dist/index.d.ts +1 -2
  42. package/node_modules/@scaleway/random-name/dist/index.js +595 -6
  43. package/node_modules/@scaleway/random-name/package.json +21 -6
  44. package/node_modules/@scaleway/random-name/tsconfig.build.json +16 -0
  45. package/node_modules/@scaleway/random-name/tsconfig.json +4 -0
  46. package/node_modules/@scaleway/random-name/vite.config.ts +10 -0
  47. package/package.json +3 -3
@@ -143,6 +143,7 @@ const unmarshalOffer = (data) => {
143
143
  fee: data.fee ? customMarshalling.unmarshalMoney(data.fee) : void 0,
144
144
  id: data.id,
145
145
  incompatibleOsIds: data.incompatible_os_ids,
146
+ maxBandwidth: data.max_bandwidth,
146
147
  memories: marshalling.unmarshalArrayOfObject(data.memories, unmarshalMemory),
147
148
  name: data.name,
148
149
  operationPath: data.operation_path,
@@ -141,6 +141,7 @@ const unmarshalOffer = (data) => {
141
141
  fee: data.fee ? unmarshalMoney(data.fee) : void 0,
142
142
  id: data.id,
143
143
  incompatibleOsIds: data.incompatible_os_ids,
144
+ maxBandwidth: data.max_bandwidth,
144
145
  memories: unmarshalArrayOfObject(data.memories, unmarshalMemory),
145
146
  name: data.name,
146
147
  operationPath: data.operation_path,
@@ -183,6 +183,11 @@ export interface Offer {
183
183
  stock: OfferStock;
184
184
  /** Public bandwidth available (in bits/s) with the offer. */
185
185
  bandwidth: number;
186
+ /**
187
+ * Maximum public bandwidth available (in bits/s) depending on available
188
+ * options.
189
+ */
190
+ maxBandwidth: number;
186
191
  /** Commercial range of the offer. */
187
192
  commercialRange: string;
188
193
  /**
@@ -17,6 +17,7 @@ export * as IPAM from './ipam';
17
17
  export * as IPFS from './ipfs';
18
18
  export * as Jobs from './jobs';
19
19
  export * as K8S from './k8s';
20
+ export * as KeyManager from './key_manager';
20
21
  export * as LB from './lb';
21
22
  export * as LLMInference from './llm_inference';
22
23
  export * as Marketplace from './marketplace';
@@ -40,6 +40,14 @@ class API extends api.API {
40
40
  method: "DELETE",
41
41
  path: `/ipam/v1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${marshalling.validatePathParam("ipId", request.ipId)}`
42
42
  });
43
+ releaseIPSet = (request = {}) => this.client.fetch({
44
+ body: JSON.stringify(
45
+ marshalling_gen.marshalReleaseIPSetRequest(request, this.client.settings)
46
+ ),
47
+ headers: jsonContentHeaders,
48
+ method: "POST",
49
+ path: `/ipam/v1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
50
+ });
43
51
  /**
44
52
  * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
45
53
  *
@@ -1,6 +1,6 @@
1
1
  import { API as ParentAPI } from '../../../bridge';
2
2
  import type { Region } from '../../../bridge';
3
- import type { BookIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsResponse, ReleaseIPRequest, UpdateIPRequest } from './types.gen';
3
+ import type { BookIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsResponse, ReleaseIPRequest, ReleaseIPSetRequest, UpdateIPRequest } from './types.gen';
4
4
  /**
5
5
  * IPAM API.
6
6
  *
@@ -25,6 +25,7 @@ export declare class API extends ParentAPI {
25
25
  * @param request - The request {@link ReleaseIPRequest}
26
26
  */
27
27
  releaseIP: (request: Readonly<ReleaseIPRequest>) => Promise<void>;
28
+ releaseIPSet: (request?: Readonly<ReleaseIPSetRequest>) => Promise<void>;
28
29
  /**
29
30
  * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
30
31
  *
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from "../../../scw/api.js";
2
2
  import { validatePathParam, urlParams, resolveOneOf } from "../../../helpers/marshalling.js";
3
3
  import { enrichForPagination } from "../../../scw/fetch/resource-paginator.js";
4
- import { marshalBookIPRequest, unmarshalIP, marshalUpdateIPRequest, unmarshalListIPsResponse } from "./marshalling.gen.js";
4
+ import { marshalBookIPRequest, unmarshalIP, marshalReleaseIPSetRequest, marshalUpdateIPRequest, unmarshalListIPsResponse } from "./marshalling.gen.js";
5
5
  const jsonContentHeaders = {
6
6
  "Content-Type": "application/json; charset=utf-8"
7
7
  };
@@ -38,6 +38,14 @@ class API extends API$1 {
38
38
  method: "DELETE",
39
39
  path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
40
40
  });
41
+ releaseIPSet = (request = {}) => this.client.fetch({
42
+ body: JSON.stringify(
43
+ marshalReleaseIPSetRequest(request, this.client.settings)
44
+ ),
45
+ headers: jsonContentHeaders,
46
+ method: "POST",
47
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
48
+ });
41
49
  /**
42
50
  * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
43
51
  *
@@ -1,3 +1,3 @@
1
1
  export { API } from './api.gen';
2
- export type { BookIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsRequestOrderBy, ListIPsResponse, ReleaseIPRequest, Resource, ResourceType, Reverse, Source, UpdateIPRequest, } from './types.gen';
2
+ export type { BookIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsRequestOrderBy, ListIPsResponse, ReleaseIPRequest, ReleaseIPSetRequest, Resource, ResourceType, Reverse, Source, UpdateIPRequest, } from './types.gen';
3
3
  export * as ValidationRules from './validation-rules.gen';
@@ -84,6 +84,9 @@ const marshalBookIPRequest = (request, defaults) => ({
84
84
  source: marshalSource(request.source),
85
85
  tags: request.tags
86
86
  });
87
+ const marshalReleaseIPSetRequest = (request, defaults) => ({
88
+ ip_ids: request.ipIds
89
+ });
87
90
  const marshalReverse = (request, defaults) => ({
88
91
  address: request.address,
89
92
  hostname: request.hostname
@@ -93,6 +96,7 @@ const marshalUpdateIPRequest = (request, defaults) => ({
93
96
  tags: request.tags
94
97
  });
95
98
  exports.marshalBookIPRequest = marshalBookIPRequest;
99
+ exports.marshalReleaseIPSetRequest = marshalReleaseIPSetRequest;
96
100
  exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
97
101
  exports.unmarshalIP = unmarshalIP;
98
102
  exports.unmarshalListIPsResponse = unmarshalListIPsResponse;
@@ -1,6 +1,7 @@
1
1
  import type { DefaultValues } from '../../../bridge';
2
- import type { BookIPRequest, IP, ListIPsResponse, UpdateIPRequest } from './types.gen';
2
+ import type { BookIPRequest, IP, ListIPsResponse, ReleaseIPSetRequest, UpdateIPRequest } from './types.gen';
3
3
  export declare const unmarshalIP: (data: unknown) => IP;
4
4
  export declare const unmarshalListIPsResponse: (data: unknown) => ListIPsResponse;
5
5
  export declare const marshalBookIPRequest: (request: BookIPRequest, defaults: DefaultValues) => Record<string, unknown>;
6
+ export declare const marshalReleaseIPSetRequest: (request: ReleaseIPSetRequest, defaults: DefaultValues) => Record<string, unknown>;
6
7
  export declare const marshalUpdateIPRequest: (request: UpdateIPRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -82,6 +82,9 @@ const marshalBookIPRequest = (request, defaults) => ({
82
82
  source: marshalSource(request.source),
83
83
  tags: request.tags
84
84
  });
85
+ const marshalReleaseIPSetRequest = (request, defaults) => ({
86
+ ip_ids: request.ipIds
87
+ });
85
88
  const marshalReverse = (request, defaults) => ({
86
89
  address: request.address,
87
90
  hostname: request.hostname
@@ -92,6 +95,7 @@ const marshalUpdateIPRequest = (request, defaults) => ({
92
95
  });
93
96
  export {
94
97
  marshalBookIPRequest,
98
+ marshalReleaseIPSetRequest,
95
99
  marshalUpdateIPRequest,
96
100
  unmarshalIP,
97
101
  unmarshalListIPsResponse
@@ -191,6 +191,14 @@ export type ReleaseIPRequest = {
191
191
  /** IP ID. */
192
192
  ipId: string;
193
193
  };
194
+ export type ReleaseIPSetRequest = {
195
+ /**
196
+ * Region to target. If none is passed will use default region from the
197
+ * config.
198
+ */
199
+ region?: Region;
200
+ ipIds?: string[];
201
+ };
194
202
  export type UpdateIPRequest = {
195
203
  /**
196
204
  * Region to target. If none is passed will use default region from the
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index_gen = require("./v1alpha1/index.gen.cjs");
4
+ exports.v1alpha1 = index_gen;
@@ -0,0 +1 @@
1
+ export * as v1alpha1 from './v1alpha1/index.gen';
@@ -0,0 +1,4 @@
1
+ import * as index_gen from "./v1alpha1/index.gen.js";
2
+ export {
3
+ index_gen as v1alpha1
4
+ };
@@ -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
+ }