Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages_generated/key_manager/src/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
unmarshalDecryptResponse,
unmarshalEncryptResponse,
unmarshalKey,
unmarshalListAlgorithmsResponse,
unmarshalListKeysResponse,
unmarshalPublicKey,
unmarshalSignResponse,
Expand All @@ -43,6 +44,8 @@ import type {
GetPublicKeyRequest,
ImportKeyMaterialRequest,
Key,
ListAlgorithmsRequest,
ListAlgorithmsResponse,
ListKeysRequest,
ListKeysResponse,
ProtectKeyRequest,
Expand Down Expand Up @@ -414,4 +417,20 @@ The data encryption key is returned in plaintext and ciphertext but it should on
},
unmarshalKey,
)

/**
* List all available algorithms. Lists all cryptographic algorithms supported by the Key Manager service.
*
* @param request - The request {@link ListAlgorithmsRequest}
* @returns A Promise of ListAlgorithmsResponse
*/
listAlgorithms = (request: Readonly<ListAlgorithmsRequest> = {}) =>
this.client.fetch<ListAlgorithmsResponse>(
{
method: 'GET',
path: `/key-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/algorithms`,
urlParams: urlParams(['usages', request.usages]),
},
unmarshalListAlgorithmsResponse,
)
}
4 changes: 4 additions & 0 deletions packages_generated/key_manager/src/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export type {
KeyRotationPolicy,
KeyState,
KeyUsage,
ListAlgorithmsRequest,
ListAlgorithmsRequestUsage,
ListAlgorithmsResponse,
ListAlgorithmsResponseAlgorithm,
ListKeysRequest,
ListKeysRequestOrderBy,
ListKeysRequestUsage,
Expand Down
35 changes: 35 additions & 0 deletions packages_generated/key_manager/src/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import type {
Key,
KeyRotationPolicy,
KeyUsage,
ListAlgorithmsResponse,
ListAlgorithmsResponseAlgorithm,
ListKeysResponse,
PublicKey,
SignRequest,
Expand Down Expand Up @@ -135,6 +137,39 @@ export const unmarshalEncryptResponse = (data: unknown): EncryptResponse => {
} as EncryptResponse
}

const unmarshalListAlgorithmsResponseAlgorithm = (
data: unknown,
): ListAlgorithmsResponseAlgorithm => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary.`,
)
}

return {
name: data.name,
recommended: data.recommended,
usage: data.usage,
} as ListAlgorithmsResponseAlgorithm
}

export const unmarshalListAlgorithmsResponse = (
data: unknown,
): ListAlgorithmsResponse => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary.`,
)
}

return {
algorithms: unmarshalArrayOfObject(
data.algorithms,
unmarshalListAlgorithmsResponseAlgorithm,
),
} as ListAlgorithmsResponse
}

export const unmarshalListKeysResponse = (data: unknown): ListKeysResponse => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand Down
30 changes: 30 additions & 0 deletions packages_generated/key_manager/src/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export type KeyState =
| 'pending_key_material'
| 'scheduled_for_deletion'

export type ListAlgorithmsRequestUsage =
| 'unknown_usage'
| 'symmetric_encryption'
| 'asymmetric_encryption'
| 'asymmetric_signing'

export type ListKeysRequestOrderBy =
| 'name_asc'
| 'name_desc'
Expand Down Expand Up @@ -80,6 +86,12 @@ export interface KeyUsage {
asymmetricSigning?: KeyAlgorithmAsymmetricSigning
}

export interface ListAlgorithmsResponseAlgorithm {
usage: string
name: string
recommended: boolean
}

export interface Key {
/**
* ID of the key.
Expand Down Expand Up @@ -382,6 +394,24 @@ export type ImportKeyMaterialRequest = {
salt?: string
}

export type ListAlgorithmsRequest = {
/**
* Region to target. If none is passed will use default region from the config.
*/
region?: ScwRegion
/**
* Filter by key usage.
*/
usages?: ListAlgorithmsRequestUsage[]
}

export interface ListAlgorithmsResponse {
/**
* Returns a list of algorithms matching the requested criteria.
*/
algorithms: ListAlgorithmsResponseAlgorithm[]
}

export type ListKeysRequest = {
/**
* Region to target. If none is passed will use default region from the config.
Expand Down
Loading