From 2f5cddb80eb2a95027554317b5d0d11270c29f09 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Wed, 29 Mar 2023 12:00:44 +0000 Subject: [PATCH] feat: update generated APIs --- .../src/api/secret/v1alpha1/index.gen.ts | 1 + .../api/secret/v1alpha1/marshalling.gen.ts | 21 ++++++++++++++++ .../src/api/secret/v1alpha1/types.gen.ts | 24 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/packages/clients/src/api/secret/v1alpha1/index.gen.ts b/packages/clients/src/api/secret/v1alpha1/index.gen.ts index abbff8e5d..f7479b40d 100644 --- a/packages/clients/src/api/secret/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/index.gen.ts @@ -21,6 +21,7 @@ export type { ListSecretsRequest, ListSecretsRequestOrderBy, ListSecretsResponse, + PasswordGenerationParams, Secret, SecretStatus, SecretVersion, diff --git a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts index b52595acb..d564cd624 100644 --- a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts @@ -2,6 +2,7 @@ // If you have any remark or suggestion do not hesitate to open an issue. import { isJSONObject, + resolveOneOf, unmarshalArrayOfObject, unmarshalDate, } from '../../../bridge' @@ -12,6 +13,7 @@ import type { CreateSecretVersionRequest, ListSecretVersionsResponse, ListSecretsResponse, + PasswordGenerationParams, Secret, SecretVersion, UpdateSecretRequest, @@ -96,6 +98,17 @@ export const unmarshalListSecretsResponse = (data: unknown) => { } as ListSecretsResponse } +const marshalPasswordGenerationParams = ( + request: PasswordGenerationParams, + defaults: DefaultValues, +): Record => ({ + additional_chars: request.additionalChars, + length: request.length, + no_digits: request.noDigits, + no_lowercase_letters: request.noLowercaseLetters, + no_uppercase_letters: request.noUppercaseLetters, +}) + export const marshalCreateSecretRequest = ( request: CreateSecretRequest, defaults: DefaultValues, @@ -113,6 +126,14 @@ export const marshalCreateSecretVersionRequest = ( data: request.data, description: request.description, disable_previous: request.disablePrevious, + ...resolveOneOf([ + { + param: 'password_generation', + value: request.passwordGeneration + ? marshalPasswordGenerationParams(request.passwordGeneration, defaults) + : undefined, + }, + ]), }) export const marshalUpdateSecretRequest = ( diff --git a/packages/clients/src/api/secret/v1alpha1/types.gen.ts b/packages/clients/src/api/secret/v1alpha1/types.gen.ts index d4a4d4577..1d910d258 100644 --- a/packages/clients/src/api/secret/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/types.gen.ts @@ -47,6 +47,20 @@ export interface ListSecretsResponse { secrets: Secret[] } +/** Password generation params. */ +export interface PasswordGenerationParams { + /** Length of the password to generate (between 1 and 1024). */ + length: number + /** Do not include lower case letters by default in the alphabet. */ + noLowercaseLetters: boolean + /** Do not include upper case letters by default in the alphabet. */ + noUppercaseLetters: boolean + /** Do not include digits by default in the alphabet. */ + noDigits: boolean + /** Additional ascii characters to be included in the alphabet. */ + additionalChars: string +} + /** Secret. */ export interface Secret { /** ID of the secret. */ @@ -196,6 +210,16 @@ export type CreateSecretVersionRequest = { * the previous version was already disabled, does nothing. */ disablePrevious: boolean + /** + * Options to generate a password. If specified, a random password will be + * generated. The data field must be empty. By default, the generator will use + * upper and lower case letters, and digits. This behavior can be tuned using + * the generation params. + * + * One-of ('PasswordGeneration'): at most one of 'passwordGeneration' could be + * set. + */ + passwordGeneration?: PasswordGenerationParams } export type GetSecretVersionRequest = {