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
28 changes: 28 additions & 0 deletions packages/clients/src/api/secret/v1beta1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
unmarshalSecretVersion,
} from './marshalling.gen'
import type {
AccessSecretVersionByPathRequest,
AccessSecretVersionRequest,
AccessSecretVersionResponse,
AddSecretOwnerRequest,
Expand Down Expand Up @@ -364,6 +365,33 @@ export class API extends ParentAPI {
unmarshalAccessSecretVersionResponse,
)

/**
* Access a secret's version using the secret's name and path. Access
* sensitive data in a secret's version specified by the `region`,
* `secret_name`, `secret_path` and `revision` parameters.
*
* @param request - The request {@link AccessSecretVersionByPathRequest}
* @returns A Promise of AccessSecretVersionResponse
*/
accessSecretVersionByPath = (
request: Readonly<AccessSecretVersionByPathRequest>,
) =>
this.client.fetch<AccessSecretVersionResponse>(
{
method: 'GET',
path: `/secret-manager/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-path/versions/${validatePathParam('revision', request.revision)}/access`,
urlParams: urlParams(
[
'project_id',
request.projectId ?? this.client.settings.defaultProjectId,
],
['secret_name', request.secretName],
['secret_path', request.secretPath],
),
},
unmarshalAccessSecretVersionResponse,
)

/**
* Enable a version. Make a specific version accessible. You must specify the
* `region`, `secret_id` and `revision` parameters.
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/secret/v1beta1/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 {
AccessSecretVersionByPathRequest,
AccessSecretVersionRequest,
AccessSecretVersionResponse,
AddSecretOwnerRequest,
Expand Down
23 changes: 23 additions & 0 deletions packages/clients/src/api/secret/v1beta1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@ export interface Secret {
region: Region
}

export type AccessSecretVersionByPathRequest = {
/**
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
/**
* The first version of the secret is numbered 1, and all subsequent revisions
* augment by 1. Value can be either:
*
* - An integer (the revision number)
* - "latest" (the latest revision)
* - "latest_enabled" (the latest enabled revision).
*/
revision: string
/** Secret's path. */
secretPath: string
/** Secret's name. */
secretName: string
/** ID of the Project to target. */
projectId?: string
}

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