@scaleway/sdk-key-manager 1.2.1 → 1.2.2

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.
@@ -6,12 +6,13 @@ const jsonContentHeaders = {
6
6
  "Content-Type": "application/json; charset=utf-8"
7
7
  };
8
8
  class API extends sdkClient.API {
9
- /** Lists the available regions of the API. */
10
- static LOCALITIES = [
11
- "fr-par",
12
- "nl-ams",
13
- "pl-waw"
14
- ];
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
+ });
15
16
  /**
16
17
  * Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
17
18
  *
@@ -156,7 +157,7 @@ class API extends sdkClient.API {
156
157
  },
157
158
  marshalling_gen.unmarshalKey
158
159
  );
159
- pageOfListKeys = (request = {}) => this.client.fetch(
160
+ pageOfListKeys = (request) => this.client.fetch(
160
161
  {
161
162
  method: "GET",
162
163
  path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
@@ -170,6 +171,7 @@ class API extends sdkClient.API {
170
171
  request.pageSize ?? this.client.settings.defaultPageSize
171
172
  ],
172
173
  ["project_id", request.projectId],
174
+ ["scheduled_for_deletion", request.scheduledForDeletion],
173
175
  ["tags", request.tags],
174
176
  ["usage", request.usage]
175
177
  )
@@ -182,7 +184,7 @@ class API extends sdkClient.API {
182
184
  * @param request - The request {@link ListKeysRequest}
183
185
  * @returns A Promise of ListKeysResponse
184
186
  */
185
- listKeys = (request = {}) => sdkClient.enrichForPagination("keys", this.pageOfListKeys, request);
187
+ listKeys = (request) => sdkClient.enrichForPagination("keys", this.pageOfListKeys, request);
186
188
  /**
187
189
  * Create a data encryption key. Create a new data encryption key for cryptographic operations outside of Key Manager. The data encryption key is encrypted and must be decrypted using the key you have created in Key Manager.
188
190
 
@@ -296,5 +298,20 @@ class API extends sdkClient.API {
296
298
  method: "POST",
297
299
  path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${sdkClient.validatePathParam("keyId", request.keyId)}/delete-key-material`
298
300
  });
301
+ /**
302
+ * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
303
+ *
304
+ * @param request - The request {@link RestoreKeyRequest}
305
+ * @returns A Promise of Key
306
+ */
307
+ restoreKey = (request) => this.client.fetch(
308
+ {
309
+ body: "{}",
310
+ headers: jsonContentHeaders,
311
+ method: "POST",
312
+ path: `/key-manager/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${sdkClient.validatePathParam("keyId", request.keyId)}/restore`
313
+ },
314
+ marshalling_gen.unmarshalKey
315
+ );
299
316
  }
300
317
  exports.API = API;
@@ -1,14 +1,17 @@
1
1
  import { API as ParentAPI } from '@scaleway/sdk-client';
2
- import type { Region as ScwRegion } from '@scaleway/sdk-client';
3
- import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
2
+ import type { ApiLocality } from '@scaleway/sdk-client';
3
+ import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse } from './types.gen';
4
4
  /**
5
5
  * Key Manager API.
6
6
 
7
7
  This API allows you to create, manage and use cryptographic keys in a centralized and secure service.
8
8
  */
9
9
  export declare class API extends ParentAPI {
10
- /** Lists the available regions of the API. */
11
- static readonly LOCALITIES: ScwRegion[];
10
+ /**
11
+ * Locality of this API.
12
+ * type ∈ {'zone','region','global','unspecified'}
13
+ */
14
+ static readonly LOCALITY: ApiLocality;
12
15
  /**
13
16
  * Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
14
17
  *
@@ -78,14 +81,14 @@ export declare class API extends ParentAPI {
78
81
  * @returns A Promise of Key
79
82
  */
80
83
  disableKey: (request: Readonly<DisableKeyRequest>) => Promise<Key>;
81
- protected pageOfListKeys: (request?: Readonly<ListKeysRequest>) => Promise<ListKeysResponse>;
84
+ protected pageOfListKeys: (request: Readonly<ListKeysRequest>) => Promise<ListKeysResponse>;
82
85
  /**
83
86
  * List keys. Retrieve a list of keys across all Projects in an Organization or within a specific Project. You must specify the `region`, and either the `organization_id` or the `project_id`.
84
87
  *
85
88
  * @param request - The request {@link ListKeysRequest}
86
89
  * @returns A Promise of ListKeysResponse
87
90
  */
88
- listKeys: (request?: Readonly<ListKeysRequest>) => Promise<ListKeysResponse> & {
91
+ listKeys: (request: Readonly<ListKeysRequest>) => Promise<ListKeysResponse> & {
89
92
  all: () => Promise<Key[]>;
90
93
  [Symbol.asyncIterator]: () => AsyncGenerator<Key[], void, void>;
91
94
  };
@@ -139,4 +142,11 @@ export declare class API extends ParentAPI {
139
142
  * @param request - The request {@link DeleteKeyMaterialRequest}
140
143
  */
141
144
  deleteKeyMaterial: (request: Readonly<DeleteKeyMaterialRequest>) => Promise<void>;
145
+ /**
146
+ * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
147
+ *
148
+ * @param request - The request {@link RestoreKeyRequest}
149
+ * @returns A Promise of Key
150
+ */
151
+ restoreKey: (request: Readonly<RestoreKeyRequest>) => Promise<Key>;
142
152
  }
@@ -1,15 +1,16 @@
1
- import { API as API$1, validatePathParam, urlParams, enrichForPagination } from "@scaleway/sdk-client";
1
+ import { API as API$1, toApiLocality, validatePathParam, urlParams, enrichForPagination } from "@scaleway/sdk-client";
2
2
  import { marshalCreateKeyRequest, unmarshalKey, unmarshalPublicKey, marshalUpdateKeyRequest, unmarshalListKeysResponse, marshalGenerateDataKeyRequest, unmarshalDataKey, marshalEncryptRequest, unmarshalEncryptResponse, marshalDecryptRequest, unmarshalDecryptResponse, marshalSignRequest, unmarshalSignResponse, marshalVerifyRequest, unmarshalVerifyResponse, marshalImportKeyMaterialRequest } from "./marshalling.gen.js";
3
3
  const jsonContentHeaders = {
4
4
  "Content-Type": "application/json; charset=utf-8"
5
5
  };
6
6
  class API extends API$1 {
7
- /** Lists the available regions of the API. */
8
- static LOCALITIES = [
9
- "fr-par",
10
- "nl-ams",
11
- "pl-waw"
12
- ];
7
+ /**
8
+ * Locality of this API.
9
+ * type ∈ {'zone','region','global','unspecified'}
10
+ */
11
+ static LOCALITY = toApiLocality({
12
+ regions: ["fr-par", "nl-ams", "pl-waw"]
13
+ });
13
14
  /**
14
15
  * Create a key. Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
15
16
  *
@@ -154,7 +155,7 @@ class API extends API$1 {
154
155
  },
155
156
  unmarshalKey
156
157
  );
157
- pageOfListKeys = (request = {}) => this.client.fetch(
158
+ pageOfListKeys = (request) => this.client.fetch(
158
159
  {
159
160
  method: "GET",
160
161
  path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys`,
@@ -168,6 +169,7 @@ class API extends API$1 {
168
169
  request.pageSize ?? this.client.settings.defaultPageSize
169
170
  ],
170
171
  ["project_id", request.projectId],
172
+ ["scheduled_for_deletion", request.scheduledForDeletion],
171
173
  ["tags", request.tags],
172
174
  ["usage", request.usage]
173
175
  )
@@ -180,7 +182,7 @@ class API extends API$1 {
180
182
  * @param request - The request {@link ListKeysRequest}
181
183
  * @returns A Promise of ListKeysResponse
182
184
  */
183
- listKeys = (request = {}) => enrichForPagination("keys", this.pageOfListKeys, request);
185
+ listKeys = (request) => enrichForPagination("keys", this.pageOfListKeys, request);
184
186
  /**
185
187
  * Create a data encryption key. Create a new data encryption key for cryptographic operations outside of Key Manager. The data encryption key is encrypted and must be decrypted using the key you have created in Key Manager.
186
188
 
@@ -294,6 +296,21 @@ class API extends API$1 {
294
296
  method: "POST",
295
297
  path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/delete-key-material`
296
298
  });
299
+ /**
300
+ * Restore a key. Restore a key and all its rotations scheduled for deletion specified by the `region` and `key_id` parameters.
301
+ *
302
+ * @param request - The request {@link RestoreKeyRequest}
303
+ * @returns A Promise of Key
304
+ */
305
+ restoreKey = (request) => this.client.fetch(
306
+ {
307
+ body: "{}",
308
+ headers: jsonContentHeaders,
309
+ method: "POST",
310
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/restore`
311
+ },
312
+ unmarshalKey
313
+ );
297
314
  }
298
315
  export {
299
316
  API
@@ -1,3 +1,3 @@
1
1
  export { API } from './api.gen';
2
2
  export * from './marshalling.gen';
3
- export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationPolicy, KeyState, KeyUsage, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse, } from './types.gen';
3
+ export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationPolicy, KeyState, KeyUsage, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UpdateKeyRequest, VerifyRequest, VerifyResponse, } from './types.gen';
@@ -32,6 +32,7 @@ const unmarshalKey = (data) => {
32
32
  }
33
33
  return {
34
34
  createdAt: sdkClient.unmarshalDate(data.created_at),
35
+ deletionRequestedAt: sdkClient.unmarshalDate(data.deletion_requested_at),
35
36
  description: data.description,
36
37
  id: data.id,
37
38
  locked: data.locked,
@@ -30,6 +30,7 @@ const unmarshalKey = (data) => {
30
30
  }
31
31
  return {
32
32
  createdAt: unmarshalDate(data.created_at),
33
+ deletionRequestedAt: unmarshalDate(data.deletion_requested_at),
33
34
  description: data.description,
34
35
  id: data.id,
35
36
  locked: data.locked,
@@ -96,6 +96,10 @@ export interface Key {
96
96
  * Refer to the `Key.Origin` enum for a description of values.
97
97
  */
98
98
  origin: KeyOrigin;
99
+ /**
100
+ * Returns the time at which deletion was requested.
101
+ */
102
+ deletionRequestedAt?: Date;
99
103
  /**
100
104
  * Region where the key is stored.
101
105
  */
@@ -346,6 +350,10 @@ export type ListKeysRequest = {
346
350
  * Select from symmetric encryption, asymmetric encryption, or asymmetric signing.
347
351
  */
348
352
  usage?: ListKeysRequestUsage;
353
+ /**
354
+ * Filter keys based on their deletion status. By default, only keys not scheduled for deletion are returned in the output.
355
+ */
356
+ scheduledForDeletion: boolean;
349
357
  };
350
358
  export interface ListKeysResponse {
351
359
  /**
@@ -370,6 +378,13 @@ export type ProtectKeyRequest = {
370
378
  export interface PublicKey {
371
379
  pem: string;
372
380
  }
381
+ export type RestoreKeyRequest = {
382
+ /**
383
+ * Region to target. If none is passed will use default region from the config.
384
+ */
385
+ region?: ScwRegion;
386
+ keyId: string;
387
+ };
373
388
  export type RotateKeyRequest = {
374
389
  /**
375
390
  * Region to target. If none is passed will use default region from the config.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-key-manager",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Scaleway SDK key-manager",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -30,13 +30,13 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@scaleway/random-name": "5.1.1",
33
- "@scaleway/sdk-std": "1.0.4"
33
+ "@scaleway/sdk-std": "1.0.5"
34
34
  },
35
35
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.2.3"
36
+ "@scaleway/sdk-client": "^1.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.2.3"
39
+ "@scaleway/sdk-client": "^1.3.0"
40
40
  },
41
41
  "scripts": {
42
42
  "package:check": "pnpm publint",