From d9b771e03a04ba7c48e2ef4cecd115de9fafba9e Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 20 Feb 2025 15:10:38 +0000 Subject: [PATCH] feat: update generated APIs --- .../clients/src/api/cockpit/v1/index.gen.ts | 6 +-- .../clients/src/api/secret/v1beta1/api.gen.ts | 39 +++++++++++++++++++ .../src/api/secret/v1beta1/index.gen.ts | 2 + .../src/api/secret/v1beta1/marshalling.gen.ts | 2 + .../src/api/secret/v1beta1/types.gen.ts | 34 +++++++++++++++- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/packages/clients/src/api/cockpit/v1/index.gen.ts b/packages/clients/src/api/cockpit/v1/index.gen.ts index 38b032127..36ef92f90 100644 --- a/packages/clients/src/api/cockpit/v1/index.gen.ts +++ b/packages/clients/src/api/cockpit/v1/index.gen.ts @@ -4,8 +4,7 @@ export { GlobalAPI, RegionalAPI } from './api.gen' export type { Alert, AlertManager, - AnyAlert, - AnyAlertState, + AlertState, ContactPoint, ContactPointEmail, DataSource, @@ -35,8 +34,6 @@ export type { ListGrafanaProductDashboardsResponse, ListGrafanaUsersRequestOrderBy, ListGrafanaUsersResponse, - ListManagedAlertsRequestOrderBy, - ListManagedAlertsResponse, ListPlansRequestOrderBy, ListPlansResponse, ListTokensRequestOrderBy, @@ -61,7 +58,6 @@ export type { RegionalApiListAlertsRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, - RegionalApiListManagedAlertsRequest, RegionalApiListTokensRequest, RegionalApiTriggerTestAlertRequest, RegionalApiUpdateContactPointRequest, diff --git a/packages/clients/src/api/secret/v1beta1/api.gen.ts b/packages/clients/src/api/secret/v1beta1/api.gen.ts index c118c7c66..73d8889db 100644 --- a/packages/clients/src/api/secret/v1beta1/api.gen.ts +++ b/packages/clients/src/api/secret/v1beta1/api.gen.ts @@ -46,6 +46,8 @@ import type { ListTagsRequest, ListTagsResponse, ProtectSecretRequest, + RestoreSecretRequest, + RestoreSecretVersionRequest, Secret, SecretVersion, UnprotectSecretRequest, @@ -158,6 +160,7 @@ export class API extends ParentAPI { ], ['path', request.path], ['project_id', request.projectId], + ['scheduled_for_deletion', request.scheduledForDeletion], ['tags', request.tags], ['type', request.type], ), @@ -496,4 +499,40 @@ export class API extends ParentAPI { */ listSecretTypes = (request: Readonly = {}) => enrichForPagination('types', this.pageOfListSecretTypes, request) + + /** + * Restore a version.. Restore a secret's version specified by the `region`, + * `secret_id` and `revision` parameters. + * + * @param request - The request {@link RestoreSecretVersionRequest} + * @returns A Promise of SecretVersion + */ + restoreSecretVersion = (request: Readonly) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/secret-manager/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/restore`, + }, + unmarshalSecretVersion, + ) + + /** + * Restore a secret.. Restore a secret and all its versions scheduled for + * deletion specified by the `region` and `secret_id` parameters. + * + * @param request - The request {@link RestoreSecretRequest} + * @returns A Promise of Secret + */ + restoreSecret = (request: Readonly) => + this.client.fetch( + { + body: '{}', + headers: jsonContentHeaders, + method: 'POST', + path: `/secret-manager/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/restore`, + }, + unmarshalSecret, + ) } diff --git a/packages/clients/src/api/secret/v1beta1/index.gen.ts b/packages/clients/src/api/secret/v1beta1/index.gen.ts index b54f53655..6a798365c 100644 --- a/packages/clients/src/api/secret/v1beta1/index.gen.ts +++ b/packages/clients/src/api/secret/v1beta1/index.gen.ts @@ -36,6 +36,8 @@ export type { ListTagsResponse, Product, ProtectSecretRequest, + RestoreSecretRequest, + RestoreSecretVersionRequest, SSHKey, Secret, SecretStatus, diff --git a/packages/clients/src/api/secret/v1beta1/marshalling.gen.ts b/packages/clients/src/api/secret/v1beta1/marshalling.gen.ts index 4b308fd56..2ec7ce38b 100644 --- a/packages/clients/src/api/secret/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/secret/v1beta1/marshalling.gen.ts @@ -51,6 +51,7 @@ export const unmarshalSecretVersion = (data: unknown): SecretVersion => { return { createdAt: unmarshalDate(data.created_at), deletedAt: unmarshalDate(data.deleted_at), + deletionRequestedAt: unmarshalDate(data.deletion_requested_at), description: data.description, ephemeralProperties: data.ephemeral_properties ? unmarshalEphemeralProperties(data.ephemeral_properties) @@ -86,6 +87,7 @@ export const unmarshalSecret = (data: unknown): Secret => { return { createdAt: unmarshalDate(data.created_at), + deletionRequestedAt: unmarshalDate(data.deletion_requested_at), description: data.description, ephemeralPolicy: data.ephemeral_policy ? unmarshalEphemeralPolicy(data.ephemeral_policy) diff --git a/packages/clients/src/api/secret/v1beta1/types.gen.ts b/packages/clients/src/api/secret/v1beta1/types.gen.ts index 1d4f5a970..074fde508 100644 --- a/packages/clients/src/api/secret/v1beta1/types.gen.ts +++ b/packages/clients/src/api/secret/v1beta1/types.gen.ts @@ -38,6 +38,7 @@ export type SecretVersionStatus = | 'enabled' | 'disabled' | 'deleted' + | 'scheduled_for_deletion' export interface EphemeralPolicy { /** @@ -95,8 +96,9 @@ export interface SecretVersion { /** * - `unknown_status`: the version is in an invalid state. `enabled`: the * version is accessible. `disabled`: the version is not accessible but can - * be enabled. `deleted`: the version is permanently deleted. It is not - * possible to recover it. + * be enabled. `scheduled_for_deletion`: the version is scheduled for + * deletion. It will be deleted in 7 days. `deleted`: the version is + * permanently deleted. It is not possible to recover it. */ status: SecretVersionStatus /** Date and time of the version's creation. */ @@ -115,6 +117,8 @@ export interface SecretVersion { * version expires. */ ephemeralProperties?: EphemeralProperties + /** Returns the time at which deletion was requested. */ + deletionRequestedAt?: Date } export interface Secret { @@ -155,6 +159,8 @@ export interface Secret { ephemeralPolicy?: EphemeralPolicy /** List of Scaleway resources that can access and manage the secret. */ usedBy: Product[] + /** Returns the time at which deletion was requested. */ + deletionRequestedAt?: Date /** Region of the secret. */ region: ScwRegion } @@ -500,6 +506,11 @@ export type ListSecretsRequest = { ephemeral?: boolean /** Filter by secret type (optional). */ type?: SecretType + /** + * Filter by whether the secret was scheduled for deletion / not scheduled for + * deletion (optional). + */ + scheduledForDeletion?: boolean } export interface ListSecretsResponse { @@ -538,6 +549,25 @@ export type ProtectSecretRequest = { secretId: string } +export type RestoreSecretRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: ScwRegion + secretId: string +} + +export type RestoreSecretVersionRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: ScwRegion + secretId: string + revision: string +} + export interface SSHKey { /** The private SSH key. */ sshPrivateKey: string