From fd6f8c3a75a4e57dd8826e174cd9a10190f2dffd Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 13 Apr 2023 16:04:24 +0000 Subject: [PATCH] feat: update generated APIs --- .../src/api/secret/v1alpha1/api.gen.ts | 21 +++++++++++++++++++ .../src/api/secret/v1alpha1/index.gen.ts | 1 + .../api/secret/v1alpha1/marshalling.gen.ts | 9 ++++++++ .../src/api/secret/v1alpha1/types.gen.ts | 16 ++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/packages/clients/src/api/secret/v1alpha1/api.gen.ts b/packages/clients/src/api/secret/v1alpha1/api.gen.ts index a08822789..70340e810 100644 --- a/packages/clients/src/api/secret/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/api.gen.ts @@ -8,6 +8,7 @@ import { } from '../../../bridge' import type { Region } from '../../../bridge' import { + marshalAddSecretOwnerRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalUpdateSecretRequest, @@ -22,6 +23,7 @@ import type { AccessSecretVersionByNameRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, + AddSecretOwnerRequest, CreateSecretRequest, CreateSecretVersionRequest, DeleteSecretRequest, @@ -144,6 +146,24 @@ export class API extends ParentAPI { unmarshalSecret, ) + /** + * Allow another product to use the secret. + * + * @param request - The request {@link AddSecretOwnerRequest} + */ + addSecretOwner = (request: Readonly) => + this.client.fetch({ + body: JSON.stringify( + marshalAddSecretOwnerRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/secret-manager/v1alpha1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/secrets/${validatePathParam('secretId', request.secretId)}/add-owner`, + }) + protected pageOfListSecrets = (request: Readonly = {}) => this.client.fetch( { @@ -153,6 +173,7 @@ export class API extends ParentAPI { request.region ?? this.client.settings.defaultRegion, )}/secrets`, urlParams: urlParams( + ['is_managed', request.isManaged], ['name', request.name], ['order_by', request.orderBy ?? 'name_asc'], ['organization_id', request.organizationId], diff --git a/packages/clients/src/api/secret/v1alpha1/index.gen.ts b/packages/clients/src/api/secret/v1alpha1/index.gen.ts index f7479b40d..369bbe8e8 100644 --- a/packages/clients/src/api/secret/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/index.gen.ts @@ -5,6 +5,7 @@ export type { AccessSecretVersionByNameRequest, AccessSecretVersionRequest, AccessSecretVersionResponse, + AddSecretOwnerRequest, CreateSecretRequest, CreateSecretVersionRequest, DeleteSecretRequest, diff --git a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts index 27a822411..904e68950 100644 --- a/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts @@ -9,6 +9,7 @@ import { import type { DefaultValues } from '../../../bridge' import type { AccessSecretVersionResponse, + AddSecretOwnerRequest, CreateSecretRequest, CreateSecretVersionRequest, ListSecretVersionsResponse, @@ -31,6 +32,7 @@ export const unmarshalSecret = (data: unknown) => { createdAt: unmarshalDate(data.created_at), description: data.description, id: data.id, + isManaged: data.is_managed, name: data.name, projectId: data.project_id, region: data.region, @@ -111,6 +113,13 @@ const marshalPasswordGenerationParams = ( no_uppercase_letters: request.noUppercaseLetters, }) +export const marshalAddSecretOwnerRequest = ( + request: AddSecretOwnerRequest, + defaults: DefaultValues, +): Record => ({ + product_name: request.productName, +}) + export const marshalCreateSecretRequest = ( request: CreateSecretRequest, defaults: DefaultValues, diff --git a/packages/clients/src/api/secret/v1alpha1/types.gen.ts b/packages/clients/src/api/secret/v1alpha1/types.gen.ts index 76bc97c62..456971abf 100644 --- a/packages/clients/src/api/secret/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/secret/v1alpha1/types.gen.ts @@ -91,6 +91,8 @@ export interface Secret { versionCount: number /** Updated description of the secret. */ description?: string + /** True for secrets that are managed by another product. */ + isManaged: boolean } /** Secret version. */ @@ -171,6 +173,18 @@ export type UpdateSecretRequest = { description?: string } +export type AddSecretOwnerRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the secret. */ + secretId: string + /** Name of the product to add. */ + productName: string +} + export type ListSecretsRequest = { /** * Region to target. If none is passed will use default region from the @@ -185,6 +199,8 @@ export type ListSecretsRequest = { name?: string /** List of tags to filter on (optional). */ tags?: string[] + /** Filter by managed / not managed (optional). */ + isManaged?: boolean orderBy?: ListSecretsRequestOrderBy page?: number pageSize?: number