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
121 changes: 112 additions & 9 deletions packages/clients/src/api/secret/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
unmarshalSecretVersion,
} from './marshalling.gen'
import type {
AccessSecretVersionByNameRequest,
AccessSecretVersionRequest,
AccessSecretVersionResponse,
CreateSecretRequest,
Expand All @@ -27,8 +28,11 @@ import type {
DestroySecretVersionRequest,
DisableSecretVersionRequest,
EnableSecretVersionRequest,
GetSecretByNameRequest,
GetSecretRequest,
GetSecretVersionByNameRequest,
GetSecretVersionRequest,
ListSecretVersionsByNameRequest,
ListSecretVersionsRequest,
ListSecretVersionsResponse,
ListSecretsRequest,
Expand Down Expand Up @@ -92,6 +96,27 @@ export class API extends ParentAPI {
unmarshalSecret,
)

/**
* Get metadata of a Secret
*
* @param request - The request {@link GetSecretByNameRequest}
* @returns A Promise of Secret
*/
getSecretByName = (request: Readonly<GetSecretByNameRequest>) =>
this.client.fetch<Secret>(
{
method: 'GET',
path: `/secret-manager/v1alpha1/regions/${validatePathParam(
'region',
request.region ?? this.client.settings.defaultRegion,
)}/secrets-by-name/${validatePathParam(
'secretName',
request.secretName,
)}`,
},
unmarshalSecret,
)

/**
* Update metadata of a Secret
*
Expand Down Expand Up @@ -123,21 +148,15 @@ export class API extends ParentAPI {
request.region ?? this.client.settings.defaultRegion,
)}/secrets`,
urlParams: urlParams(
['name', request.name],
['order_by', request.orderBy ?? 'name_asc'],
[
'organization_id',
request.organizationId ??
this.client.settings.defaultOrganizationId,
],
['organization_id', request.organizationId],
['page', request.page],
[
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
[
'project_id',
request.projectId ?? this.client.settings.defaultProjectId,
],
['project_id', request.projectId],
['tags', request.tags],
),
},
Expand Down Expand Up @@ -210,6 +229,27 @@ export class API extends ParentAPI {
unmarshalSecretVersion,
)

/**
* Get metadata of a SecretVersion
*
* @param request - The request {@link GetSecretVersionByNameRequest}
* @returns A Promise of SecretVersion
*/
getSecretVersionByName = (request: Readonly<GetSecretVersionByNameRequest>) =>
this.client.fetch<SecretVersion>(
{
method: 'GET',
path: `/secret-manager/v1alpha1/regions/${validatePathParam(
'region',
request.region ?? this.client.settings.defaultRegion,
)}/secrets-by-name/${validatePathParam(
'secretName',
request.secretName,
)}/versions/${validatePathParam('revision', request.revision)}`,
},
unmarshalSecretVersion,
)

/**
* Update metadata of a SecretVersion
*
Expand Down Expand Up @@ -266,6 +306,46 @@ export class API extends ParentAPI {
listSecretVersions = (request: Readonly<ListSecretVersionsRequest>) =>
enrichForPagination('versions', this.pageOfListSecretVersions, request)

protected pageOfListSecretVersionsByName = (
request: Readonly<ListSecretVersionsByNameRequest>,
) =>
this.client.fetch<ListSecretVersionsResponse>(
{
method: 'GET',
path: `/secret-manager/v1alpha1/regions/${validatePathParam(
'region',
request.region ?? this.client.settings.defaultRegion,
)}/secrets-by-name/${validatePathParam(
'secretName',
request.secretName,
)}/versions`,
urlParams: urlParams(
['page', request.page],
[
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
['status', request.status],
),
},
unmarshalListSecretVersionsResponse,
)

/**
* List versions of a secret, not returning any sensitive data
*
* @param request - The request {@link ListSecretVersionsByNameRequest}
* @returns A Promise of ListSecretVersionsResponse
*/
listSecretVersionsByName = (
request: Readonly<ListSecretVersionsByNameRequest>,
) =>
enrichForPagination(
'versions',
this.pageOfListSecretVersionsByName,
request,
)

/**
* Destroy a SecretVersion, permanently destroying the sensitive data
*
Expand Down Expand Up @@ -355,4 +435,27 @@ export class API extends ParentAPI {
},
unmarshalAccessSecretVersionResponse,
)

/**
* Access a SecretVersion, returning the sensitive data
*
* @param request - The request {@link AccessSecretVersionByNameRequest}
* @returns A Promise of AccessSecretVersionResponse
*/
accessSecretVersionByName = (
request: Readonly<AccessSecretVersionByNameRequest>,
) =>
this.client.fetch<AccessSecretVersionResponse>(
{
method: 'GET',
path: `/secret-manager/v1alpha1/regions/${validatePathParam(
'region',
request.region ?? this.client.settings.defaultRegion,
)}/secrets-by-name/${validatePathParam(
'secretName',
request.secretName,
)}/versions/${validatePathParam('revision', request.revision)}/access`,
},
unmarshalAccessSecretVersionResponse,
)
}
4 changes: 4 additions & 0 deletions packages/clients/src/api/secret/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// If you have any remark or suggestion do not hesitate to open an issue.
export { API } from './api.gen'
export type {
AccessSecretVersionByNameRequest,
AccessSecretVersionRequest,
AccessSecretVersionResponse,
CreateSecretRequest,
Expand All @@ -10,8 +11,11 @@ export type {
DestroySecretVersionRequest,
DisableSecretVersionRequest,
EnableSecretVersionRequest,
GetSecretByNameRequest,
GetSecretRequest,
GetSecretVersionByNameRequest,
GetSecretVersionRequest,
ListSecretVersionsByNameRequest,
ListSecretVersionsRequest,
ListSecretVersionsResponse,
ListSecretsRequest,
Expand Down
38 changes: 38 additions & 0 deletions packages/clients/src/api/secret/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export type GetSecretRequest = {
secretId: string
}

export type GetSecretByNameRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
/** Name of the Secret */
secretName: string
}

export type UpdateSecretRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
Expand All @@ -129,6 +136,8 @@ export type ListSecretsRequest = {
organizationId?: string
/** ID of a project to filter on (optional) */
projectId?: string
/** Secret name to filter on (optional) */
name?: string
/** List of tags to filter on (optional) */
tags?: string[]
orderBy?: ListSecretsRequestOrderBy
Expand Down Expand Up @@ -163,6 +172,15 @@ export type GetSecretVersionRequest = {
revision: string
}

export type GetSecretVersionByNameRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
/** Name of the Secret */
secretName: string
/** Revision of the SecretVersion (may be a number or "latest") */
revision: string
}

export type UpdateSecretVersionRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
Expand All @@ -185,6 +203,17 @@ export type ListSecretVersionsRequest = {
status?: SecretVersionStatus[]
}

export type ListSecretVersionsByNameRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
/** Name of the Secret */
secretName: string
page?: number
pageSize?: number
/** Filter results by status */
status?: SecretVersionStatus[]
}

export type DestroySecretVersionRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
Expand Down Expand Up @@ -220,3 +249,12 @@ export type AccessSecretVersionRequest = {
/** Revision of the SecretVersion (may be a number or "latest") */
revision: string
}

export type AccessSecretVersionByNameRequest = {
/** Region to target. If none is passed will use default region from the config */
region?: Region
/** Name of the Secret */
secretName: string
/** Revision of the SecretVersion (may be a number or "latest") */
revision: string
}