@scaleway/sdk-key-manager 2.15.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { API as ParentAPI } from '@scaleway/sdk-client';
2
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, ListAlgorithmsRequest, ListAlgorithmsResponse, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UnwrapKeyRequest, UnwrapKeyResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse, WrapKeyRequest, WrapKeyResponse } from './types.gen.js';
3
+ import type { CreateKeyRequest, DataKey, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, ListAlgorithmsRequest, ListAlgorithmsResponse, ListKeyRotationsRequest, ListKeyRotationsResponse, ListKeysRequest, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UnwrapKeyRequest, UnwrapKeyResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse, WrapKeyRequest, WrapKeyResponse } from './types.gen.js';
4
4
  /**
5
5
  * Key Manager API.
6
6
 
@@ -95,6 +95,18 @@ export declare class API extends ParentAPI {
95
95
  all: () => Promise<Key[]>;
96
96
  [Symbol.asyncIterator]: () => AsyncGenerator<Key[], void, void>;
97
97
  };
98
+ protected pageOfListKeyRotations: (request: Readonly<ListKeyRotationsRequest>) => Promise<ListKeyRotationsResponse>;
99
+ /**
100
+ * List key rotations. Retrieve a list of all rotations associated with a specific key.
101
+ The `key_id` and `region` parameters in the path are required.
102
+ *
103
+ * @param request - The request {@link ListKeyRotationsRequest}
104
+ * @returns A Promise of ListKeyRotationsResponse
105
+ */
106
+ listKeyRotations: (request: Readonly<ListKeyRotationsRequest>) => Promise<ListKeyRotationsResponse> & {
107
+ all: () => Promise<import("./types.gen.js").KeyRotation[]>;
108
+ [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen.js").KeyRotation[], void, void>;
109
+ };
98
110
  /**
99
111
  * 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.
100
112
 
@@ -1,4 +1,4 @@
1
- import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse } from "./marshalling.gen.js";
1
+ import { marshalCreateKeyRequest, marshalDecryptRequest, marshalDeleteKeyMaterialRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeyRotationsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse } from "./marshalling.gen.js";
2
2
  import { API as API$1, enrichForPagination, toApiLocality, urlParams, validatePathParam } from "@scaleway/sdk-client";
3
3
  //#region src/v1alpha1/api.gen.ts
4
4
  const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
@@ -70,6 +70,12 @@ var API = class extends API$1 {
70
70
  urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["scheduled_for_deletion", request.scheduledForDeletion], ["tags", request.tags], ["usage", request.usage])
71
71
  }, unmarshalListKeysResponse);
72
72
  this.listKeys = (request) => enrichForPagination("keys", this.pageOfListKeys, request);
73
+ this.pageOfListKeyRotations = (request) => this.client.fetch({
74
+ method: "GET",
75
+ path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/rotations`,
76
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["status", request.status])
77
+ }, unmarshalListKeyRotationsResponse);
78
+ this.listKeyRotations = (request) => enrichForPagination("rotations", this.pageOfListKeyRotations, request);
73
79
  this.generateDataKey = (request) => this.client.fetch({
74
80
  body: JSON.stringify(marshalGenerateDataKeyRequest(request, this.client.settings)),
75
81
  headers: jsonContentHeaders,
@@ -107,7 +113,7 @@ var API = class extends API$1 {
107
113
  path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/import-key-material`
108
114
  }, unmarshalKey);
109
115
  this.deleteKeyMaterial = (request) => this.client.fetch({
110
- body: "{}",
116
+ body: JSON.stringify(marshalDeleteKeyMaterialRequest(request, this.client.settings)),
111
117
  headers: jsonContentHeaders,
112
118
  method: "POST",
113
119
  path: `/key-manager/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/keys/${validatePathParam("keyId", request.keyId)}/delete-key-material`
@@ -1,4 +1,4 @@
1
- import type { DataKeyAlgorithmSymmetricEncryption, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmKeyEncapsulation, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyState, ListAlgorithmsRequestUsage, ListKeysRequestOrderBy, ListKeysRequestUsage } from './types.gen.js';
1
+ import type { DataKeyAlgorithmSymmetricEncryption, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmKeyEncapsulation, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationStatus, KeyState, ListAlgorithmsRequestUsage, ListKeyRotationsRequestOrderBy, ListKeysRequestOrderBy, ListKeysRequestUsage } from './types.gen.js';
2
2
  /** Lists all values of the enum {@link DataKeyAlgorithmSymmetricEncryption}. */
3
3
  export declare const DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS: DataKeyAlgorithmSymmetricEncryption[];
4
4
  /** Lists all values of the enum {@link KeyAlgorithmAsymmetricEncryption}. */
@@ -11,10 +11,14 @@ export declare const KEY_ALGORITHM_KEY_ENCAPSULATIONS: KeyAlgorithmKeyEncapsulat
11
11
  export declare const KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS: KeyAlgorithmSymmetricEncryption[];
12
12
  /** Lists all values of the enum {@link KeyOrigin}. */
13
13
  export declare const KEY_ORIGINS: KeyOrigin[];
14
+ /** Lists all values of the enum {@link KeyRotationStatus}. */
15
+ export declare const KEY_ROTATION_STATUSES: KeyRotationStatus[];
14
16
  /** Lists all values of the enum {@link KeyState}. */
15
17
  export declare const KEY_STATES: KeyState[];
16
18
  /** Lists all values of the enum {@link ListAlgorithmsRequestUsage}. */
17
19
  export declare const LIST_ALGORITHMS_REQUEST_USAGES: ListAlgorithmsRequestUsage[];
20
+ /** Lists all values of the enum {@link ListKeyRotationsRequestOrderBy}. */
21
+ export declare const LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES: ListKeyRotationsRequestOrderBy[];
18
22
  /** Lists all values of the enum {@link ListKeysRequestOrderBy}. */
19
23
  export declare const LIST_KEYS_REQUEST_ORDER_BIES: ListKeysRequestOrderBy[];
20
24
  /** Lists all values of the enum {@link ListKeysRequestUsage}. */
@@ -38,6 +38,12 @@ const KEY_ORIGINS = [
38
38
  "scaleway_kms",
39
39
  "external"
40
40
  ];
41
+ /** Lists all values of the enum {@link KeyRotationStatus}. */
42
+ const KEY_ROTATION_STATUSES = [
43
+ "unknown_status",
44
+ "enabled",
45
+ "deleted"
46
+ ];
41
47
  /** Lists all values of the enum {@link KeyState}. */
42
48
  const KEY_STATES = [
43
49
  "unknown_state",
@@ -54,6 +60,8 @@ const LIST_ALGORITHMS_REQUEST_USAGES = [
54
60
  "asymmetric_signing",
55
61
  "key_encapsulation"
56
62
  ];
63
+ /** Lists all values of the enum {@link ListKeyRotationsRequestOrderBy}. */
64
+ const LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES = ["created_at_asc", "created_at_desc"];
57
65
  /** Lists all values of the enum {@link ListKeysRequestOrderBy}. */
58
66
  const LIST_KEYS_REQUEST_ORDER_BIES = [
59
67
  "name_asc",
@@ -71,4 +79,4 @@ const LIST_KEYS_REQUEST_USAGES = [
71
79
  "asymmetric_signing"
72
80
  ];
73
81
  //#endregion
74
- export { DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES };
82
+ export { DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_ROTATION_STATUSES, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES, LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES };
@@ -1,4 +1,5 @@
1
1
  export { API, } from './api.gen.js';
2
2
  export * from './constants.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmKeyEncapsulation, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotationPolicy, KeyState, KeyUsage, ListAlgorithmsRequest, ListAlgorithmsRequestUsage, ListAlgorithmsResponse, ListAlgorithmsResponseAlgorithm, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UnwrapKeyRequest, UnwrapKeyResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse, WrapKeyRequest, WrapKeyResponse, } from './types.gen.js';
4
+ export type { CreateKeyRequest, DataKey, DataKeyAlgorithmSymmetricEncryption, DecryptRequest, DecryptResponse, DeleteKeyMaterialRequest, DeleteKeyRequest, DisableKeyRequest, EnableKeyRequest, EncryptRequest, EncryptResponse, GenerateDataKeyRequest, GetKeyRequest, GetPublicKeyRequest, ImportKeyMaterialRequest, Key, KeyAlgorithmAsymmetricEncryption, KeyAlgorithmAsymmetricSigning, KeyAlgorithmKeyEncapsulation, KeyAlgorithmSymmetricEncryption, KeyOrigin, KeyRotation, KeyRotationPolicy, KeyRotationStatus, KeyState, KeyUsage, ListAlgorithmsRequest, ListAlgorithmsRequestUsage, ListAlgorithmsResponse, ListAlgorithmsResponseAlgorithm, ListKeyRotationsRequest, ListKeyRotationsRequestOrderBy, ListKeyRotationsResponse, ListKeysRequest, ListKeysRequestOrderBy, ListKeysRequestUsage, ListKeysResponse, ProtectKeyRequest, PublicKey, RestoreKeyRequest, RotateKeyRequest, SignRequest, SignResponse, UnprotectKeyRequest, UnwrapKeyRequest, UnwrapKeyResponse, UpdateKeyRequest, VerifyRequest, VerifyResponse, WrapKeyRequest, WrapKeyResponse, } from './types.gen.js';
5
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -1,7 +1,8 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse } from "./marshalling.gen.js";
2
+ import { marshalCreateKeyRequest, marshalDecryptRequest, marshalDeleteKeyMaterialRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeyRotationsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse } from "./marshalling.gen.js";
3
3
  import { API } from "./api.gen.js";
4
- import { DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES } from "./constants.gen.js";
4
+ import { DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_ROTATION_STATUSES, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES, LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES } from "./constants.gen.js";
5
+ import { validation_rules_gen_exports } from "./validation-rules.gen.js";
5
6
  //#region src/v1alpha1/index.gen.ts
6
7
  var index_gen_exports = /* @__PURE__ */ __exportAll({
7
8
  API: () => API,
@@ -11,12 +12,16 @@ var index_gen_exports = /* @__PURE__ */ __exportAll({
11
12
  KEY_ALGORITHM_KEY_ENCAPSULATIONS: () => KEY_ALGORITHM_KEY_ENCAPSULATIONS,
12
13
  KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS: () => KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS,
13
14
  KEY_ORIGINS: () => KEY_ORIGINS,
15
+ KEY_ROTATION_STATUSES: () => KEY_ROTATION_STATUSES,
14
16
  KEY_STATES: () => KEY_STATES,
15
17
  LIST_ALGORITHMS_REQUEST_USAGES: () => LIST_ALGORITHMS_REQUEST_USAGES,
16
18
  LIST_KEYS_REQUEST_ORDER_BIES: () => LIST_KEYS_REQUEST_ORDER_BIES,
17
19
  LIST_KEYS_REQUEST_USAGES: () => LIST_KEYS_REQUEST_USAGES,
20
+ LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES: () => LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES,
21
+ ValidationRules: () => validation_rules_gen_exports,
18
22
  marshalCreateKeyRequest: () => marshalCreateKeyRequest,
19
23
  marshalDecryptRequest: () => marshalDecryptRequest,
24
+ marshalDeleteKeyMaterialRequest: () => marshalDeleteKeyMaterialRequest,
20
25
  marshalEncryptRequest: () => marshalEncryptRequest,
21
26
  marshalGenerateDataKeyRequest: () => marshalGenerateDataKeyRequest,
22
27
  marshalImportKeyMaterialRequest: () => marshalImportKeyMaterialRequest,
@@ -30,6 +35,7 @@ var index_gen_exports = /* @__PURE__ */ __exportAll({
30
35
  unmarshalEncryptResponse: () => unmarshalEncryptResponse,
31
36
  unmarshalKey: () => unmarshalKey,
32
37
  unmarshalListAlgorithmsResponse: () => unmarshalListAlgorithmsResponse,
38
+ unmarshalListKeyRotationsResponse: () => unmarshalListKeyRotationsResponse,
33
39
  unmarshalListKeysResponse: () => unmarshalListKeysResponse,
34
40
  unmarshalPublicKey: () => unmarshalPublicKey,
35
41
  unmarshalSignResponse: () => unmarshalSignResponse,
@@ -38,4 +44,4 @@ var index_gen_exports = /* @__PURE__ */ __exportAll({
38
44
  unmarshalWrapKeyResponse: () => unmarshalWrapKeyResponse
39
45
  });
40
46
  //#endregion
41
- export { API, DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES, index_gen_exports, marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse };
47
+ export { API, DATA_KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_ENCRYPTIONS, KEY_ALGORITHM_ASYMMETRIC_SIGNINGS, KEY_ALGORITHM_KEY_ENCAPSULATIONS, KEY_ALGORITHM_SYMMETRIC_ENCRYPTIONS, KEY_ORIGINS, KEY_ROTATION_STATUSES, KEY_STATES, LIST_ALGORITHMS_REQUEST_USAGES, LIST_KEYS_REQUEST_ORDER_BIES, LIST_KEYS_REQUEST_USAGES, LIST_KEY_ROTATIONS_REQUEST_ORDER_BIES, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalCreateKeyRequest, marshalDecryptRequest, marshalDeleteKeyMaterialRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeyRotationsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse };
@@ -1,10 +1,11 @@
1
1
  import type { DefaultValues } from '@scaleway/sdk-client';
2
- import type { Key, DataKey, DecryptResponse, EncryptResponse, ListAlgorithmsResponse, ListKeysResponse, PublicKey, SignResponse, UnwrapKeyResponse, VerifyResponse, WrapKeyResponse, CreateKeyRequest, DecryptRequest, EncryptRequest, GenerateDataKeyRequest, ImportKeyMaterialRequest, SignRequest, UnwrapKeyRequest, UpdateKeyRequest, VerifyRequest, WrapKeyRequest } from './types.gen.js';
2
+ import type { Key, DataKey, DecryptResponse, EncryptResponse, ListAlgorithmsResponse, ListKeyRotationsResponse, ListKeysResponse, PublicKey, SignResponse, UnwrapKeyResponse, VerifyResponse, WrapKeyResponse, CreateKeyRequest, DecryptRequest, DeleteKeyMaterialRequest, EncryptRequest, GenerateDataKeyRequest, ImportKeyMaterialRequest, SignRequest, UnwrapKeyRequest, UpdateKeyRequest, VerifyRequest, WrapKeyRequest } from './types.gen.js';
3
3
  export declare const unmarshalKey: (data: unknown) => Key;
4
4
  export declare const unmarshalDataKey: (data: unknown) => DataKey;
5
5
  export declare const unmarshalDecryptResponse: (data: unknown) => DecryptResponse;
6
6
  export declare const unmarshalEncryptResponse: (data: unknown) => EncryptResponse;
7
7
  export declare const unmarshalListAlgorithmsResponse: (data: unknown) => ListAlgorithmsResponse;
8
+ export declare const unmarshalListKeyRotationsResponse: (data: unknown) => ListKeyRotationsResponse;
8
9
  export declare const unmarshalListKeysResponse: (data: unknown) => ListKeysResponse;
9
10
  export declare const unmarshalPublicKey: (data: unknown) => PublicKey;
10
11
  export declare const unmarshalSignResponse: (data: unknown) => SignResponse;
@@ -13,6 +14,7 @@ export declare const unmarshalVerifyResponse: (data: unknown) => VerifyResponse;
13
14
  export declare const unmarshalWrapKeyResponse: (data: unknown) => WrapKeyResponse;
14
15
  export declare const marshalCreateKeyRequest: (request: CreateKeyRequest, defaults: DefaultValues) => Record<string, unknown>;
15
16
  export declare const marshalDecryptRequest: (request: DecryptRequest, defaults: DefaultValues) => Record<string, unknown>;
17
+ export declare const marshalDeleteKeyMaterialRequest: (request: DeleteKeyMaterialRequest, defaults: DefaultValues) => Record<string, unknown>;
16
18
  export declare const marshalEncryptRequest: (request: EncryptRequest, defaults: DefaultValues) => Record<string, unknown>;
17
19
  export declare const marshalGenerateDataKeyRequest: (request: GenerateDataKeyRequest, defaults: DefaultValues) => Record<string, unknown>;
18
20
  export declare const marshalImportKeyMaterialRequest: (request: ImportKeyMaterialRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -32,6 +32,7 @@ const unmarshalKey = (data) => {
32
32
  rotatedAt: unmarshalDate(data.rotated_at),
33
33
  rotationCount: data.rotation_count,
34
34
  rotationPolicy: data.rotation_policy ? unmarshalKeyRotationPolicy(data.rotation_policy) : void 0,
35
+ srn: data.srn,
35
36
  state: data.state,
36
37
  tags: data.tags,
37
38
  updatedAt: unmarshalDate(data.updated_at),
@@ -75,6 +76,25 @@ const unmarshalListAlgorithmsResponse = (data) => {
75
76
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`);
76
77
  return { algorithms: unmarshalArrayOfObject(data.algorithms, unmarshalListAlgorithmsResponseAlgorithm) };
77
78
  };
79
+ const unmarshalKeyRotation = (data) => {
80
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'KeyRotation' failed as data isn't a dictionary.`);
81
+ return {
82
+ createdAt: unmarshalDate(data.created_at),
83
+ deletedAt: unmarshalDate(data.deleted_at),
84
+ index: data.index,
85
+ keyId: data.key_id,
86
+ manuallyRotated: data.manually_rotated,
87
+ status: data.status,
88
+ updatedAt: unmarshalDate(data.updated_at)
89
+ };
90
+ };
91
+ const unmarshalListKeyRotationsResponse = (data) => {
92
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListKeyRotationsResponse' failed as data isn't a dictionary.`);
93
+ return {
94
+ rotations: unmarshalArrayOfObject(data.rotations, unmarshalKeyRotation),
95
+ totalCount: data.total_count
96
+ };
97
+ };
78
98
  const unmarshalListKeysResponse = (data) => {
79
99
  if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListKeysResponse' failed as data isn't a dictionary.`);
80
100
  return {
@@ -150,6 +170,7 @@ const marshalDecryptRequest = (request, defaults) => ({
150
170
  associated_data: request.associatedData,
151
171
  ciphertext: request.ciphertext
152
172
  });
173
+ const marshalDeleteKeyMaterialRequest = (request, defaults) => ({ key_rotation_index: request.keyRotationIndex });
153
174
  const marshalEncryptRequest = (request, defaults) => ({
154
175
  associated_data: request.associatedData,
155
176
  plaintext: request.plaintext
@@ -182,4 +203,4 @@ const marshalWrapKeyRequest = (request, defaults) => ({
182
203
  plaintext: request.plaintext
183
204
  });
184
205
  //#endregion
185
- export { marshalCreateKeyRequest, marshalDecryptRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse };
206
+ export { marshalCreateKeyRequest, marshalDecryptRequest, marshalDeleteKeyMaterialRequest, marshalEncryptRequest, marshalGenerateDataKeyRequest, marshalImportKeyMaterialRequest, marshalSignRequest, marshalUnwrapKeyRequest, marshalUpdateKeyRequest, marshalVerifyRequest, marshalWrapKeyRequest, unmarshalDataKey, unmarshalDecryptResponse, unmarshalEncryptResponse, unmarshalKey, unmarshalListAlgorithmsResponse, unmarshalListKeyRotationsResponse, unmarshalListKeysResponse, unmarshalPublicKey, unmarshalSignResponse, unmarshalUnwrapKeyResponse, unmarshalVerifyResponse, unmarshalWrapKeyResponse };
@@ -37,6 +37,19 @@ export declare const queriesMetadata: {
37
37
  readonly listItemTypeNamespace: '@scaleway/sdk-key-manager/v1alpha1';
38
38
  readonly isPrivate: false;
39
39
  readonly description: '"';
40
+ }, {
41
+ readonly methodName: 'listKeyRotations';
42
+ readonly protoName: 'ListKeyRotations';
43
+ readonly paramsType: 'ListKeyRotationsRequest';
44
+ readonly returnType: 'ListKeyRotationsResponse';
45
+ readonly returnTypeNamespace: '@scaleway/sdk-key-manager/v1alpha1';
46
+ readonly isList: true;
47
+ readonly paginationType: 'offset';
48
+ readonly pageParamKey: 'page';
49
+ readonly listItemType: 'KeyRotation';
50
+ readonly listItemTypeNamespace: '@scaleway/sdk-key-manager/v1alpha1';
51
+ readonly isPrivate: false;
52
+ readonly description: '"';
40
53
  }, {
41
54
  readonly methodName: 'listAlgorithms';
42
55
  readonly protoName: 'ListAlgorithms';
@@ -42,6 +42,20 @@ const queriesMetadata = {
42
42
  isPrivate: false,
43
43
  description: "\""
44
44
  },
45
+ {
46
+ methodName: "listKeyRotations",
47
+ protoName: "ListKeyRotations",
48
+ paramsType: "ListKeyRotationsRequest",
49
+ returnType: "ListKeyRotationsResponse",
50
+ returnTypeNamespace: "@scaleway/sdk-key-manager/v1alpha1",
51
+ isList: true,
52
+ paginationType: "offset",
53
+ pageParamKey: "page",
54
+ listItemType: "KeyRotation",
55
+ listItemTypeNamespace: "@scaleway/sdk-key-manager/v1alpha1",
56
+ isPrivate: false,
57
+ description: "\""
58
+ },
45
59
  {
46
60
  methodName: "listAlgorithms",
47
61
  protoName: "ListAlgorithms",
@@ -5,8 +5,10 @@ export type KeyAlgorithmAsymmetricSigning = 'unknown_asymmetric_signing' | 'ec_p
5
5
  export type KeyAlgorithmKeyEncapsulation = 'unknown_key_encapsulation' | 'ml_kem_768' | 'ml_kem_1024';
6
6
  export type KeyAlgorithmSymmetricEncryption = 'unknown_symmetric_encryption' | 'aes_256_gcm';
7
7
  export type KeyOrigin = 'unknown_origin' | 'scaleway_kms' | 'external';
8
+ export type KeyRotationStatus = 'unknown_status' | 'enabled' | 'deleted';
8
9
  export type KeyState = 'unknown_state' | 'enabled' | 'disabled' | 'pending_key_material' | 'scheduled_for_deletion';
9
10
  export type ListAlgorithmsRequestUsage = 'unknown_usage' | 'symmetric_encryption' | 'asymmetric_encryption' | 'asymmetric_signing' | 'key_encapsulation';
11
+ export type ListKeyRotationsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
10
12
  export type ListKeysRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
11
13
  export type ListKeysRequestUsage = 'unknown_usage' | 'symmetric_encryption' | 'asymmetric_encryption' | 'asymmetric_signing';
12
14
  export interface KeyRotationPolicy {
@@ -50,11 +52,45 @@ export interface ListAlgorithmsResponseAlgorithm {
50
52
  name: string;
51
53
  recommended: boolean;
52
54
  }
55
+ export interface KeyRotation {
56
+ /**
57
+ * ID of the associated key.
58
+ */
59
+ keyId: string;
60
+ /**
61
+ * The rotation index tracks the specific version of the key material.
62
+ */
63
+ index: number;
64
+ /**
65
+ * See the `KeyRotation.Status` enum for a description of possible values.
66
+ */
67
+ status: KeyRotationStatus;
68
+ /**
69
+ * Returns `true` if the key was rotated manually, or `false` if it was rotated automatically by a rotation policy.
70
+ */
71
+ manuallyRotated: boolean;
72
+ /**
73
+ * Key rotation creation date.
74
+ */
75
+ createdAt?: Date;
76
+ /**
77
+ * Key rotation last modification date.
78
+ */
79
+ updatedAt?: Date;
80
+ /**
81
+ * Key rotation deletion date.
82
+ */
83
+ deletedAt?: Date;
84
+ }
53
85
  export interface Key {
54
86
  /**
55
87
  * ID of the key.
56
88
  */
57
89
  id: string;
90
+ /**
91
+ * The SRN of the key.
92
+ */
93
+ srn: string;
58
94
  /**
59
95
  * ID of the Project containing the key.
60
96
  */
@@ -221,6 +257,10 @@ export type DeleteKeyMaterialRequest = {
221
257
  * ID of the key of which to delete the key material.
222
258
  */
223
259
  keyId: string;
260
+ /**
261
+ * Default to latest rotation if not set.
262
+ */
263
+ keyRotationIndex?: number;
224
264
  };
225
265
  export type DeleteKeyRequest = {
226
266
  /**
@@ -353,6 +393,33 @@ export interface ListAlgorithmsResponse {
353
393
  */
354
394
  algorithms: ListAlgorithmsResponseAlgorithm[];
355
395
  }
396
+ export type ListKeyRotationsRequest = {
397
+ /**
398
+ * Region to target. If none is passed will use default region from the config.
399
+ */
400
+ region?: ScwRegion;
401
+ /**
402
+ * ID of the key to list rotations for.
403
+ */
404
+ keyId: string;
405
+ orderBy?: ListKeyRotationsRequestOrderBy;
406
+ page?: number;
407
+ pageSize?: number;
408
+ /**
409
+ * See the `KeyRotation.Status` enum for a description of possible values.
410
+ */
411
+ status?: KeyRotationStatus[];
412
+ };
413
+ export interface ListKeyRotationsResponse {
414
+ /**
415
+ * Single page of key rotations matching the requested criteria.
416
+ */
417
+ rotations: KeyRotation[];
418
+ /**
419
+ * Total count of key rotations matching the requested criteria.
420
+ */
421
+ totalCount: number;
422
+ }
356
423
  export type ListKeysRequest = {
357
424
  /**
358
425
  * Region to target. If none is passed will use default region from the config.
@@ -0,0 +1,5 @@
1
+ export declare const DeleteKeyMaterialRequest: {
2
+ keyRotationIndex: {
3
+ greaterThanOrEqual: number;
4
+ };
5
+ };
@@ -0,0 +1,6 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ //#region src/v1alpha1/validation-rules.gen.ts
3
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({ DeleteKeyMaterialRequest: () => DeleteKeyMaterialRequest });
4
+ const DeleteKeyMaterialRequest = { keyRotationIndex: { greaterThanOrEqual: 1 } };
5
+ //#endregion
6
+ export { DeleteKeyMaterialRequest, validation_rules_gen_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-key-manager",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Scaleway SDK key-manager",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -33,14 +33,14 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@scaleway/random-name": "6.0.2",
36
- "@scaleway/sdk-std": "2.8.0"
36
+ "@scaleway/sdk-std": "2.8.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@repo/configs": "^0.1.1",
40
- "@scaleway/sdk-client": "^2.8.0"
40
+ "@scaleway/sdk-client": "^2.9.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "@scaleway/sdk-client": "^2.8.0"
43
+ "@scaleway/sdk-client": "^2.9.0"
44
44
  },
45
45
  "scripts": {
46
46
  "package:check": "pnpm publint",