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
32 changes: 32 additions & 0 deletions packages/clients/src/api/secret/v1beta1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
unmarshalBrowseSecretsResponse,
unmarshalListSecretVersionsResponse,
unmarshalListSecretsResponse,
unmarshalListTagsResponse,
unmarshalSecret,
unmarshalSecretVersion,
} from './marshalling.gen'
Expand All @@ -38,6 +39,8 @@ import type {
ListSecretVersionsResponse,
ListSecretsRequest,
ListSecretsResponse,
ListTagsRequest,
ListTagsResponse,
ProtectSecretRequest,
Secret,
SecretVersion,
Expand Down Expand Up @@ -393,4 +396,33 @@ export class API extends ParentAPI {
},
unmarshalSecretVersion,
)

protected pageOfListTags = (request: Readonly<ListTagsRequest> = {}) =>
this.client.fetch<ListTagsResponse>(
{
method: 'GET',
path: `/secret-manager/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tags`,
urlParams: urlParams(
['page', request.page],
[
'page_size',
request.pageSize ?? this.client.settings.defaultPageSize,
],
[
'project_id',
request.projectId ?? this.client.settings.defaultProjectId,
],
),
},
unmarshalListTagsResponse,
)

/**
* List tags. List all tags associated with secrets within a given Project.
*
* @param request - The request {@link ListTagsRequest}
* @returns A Promise of ListTagsResponse
*/
listTags = (request: Readonly<ListTagsRequest> = {}) =>
enrichForPagination('tags', this.pageOfListTags, request)
}
2 changes: 2 additions & 0 deletions packages/clients/src/api/secret/v1beta1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export type {
ListSecretsRequest,
ListSecretsRequestOrderBy,
ListSecretsResponse,
ListTagsRequest,
ListTagsResponse,
Product,
ProtectSecretRequest,
Secret,
Expand Down
14 changes: 14 additions & 0 deletions packages/clients/src/api/secret/v1beta1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
EphemeralProperties,
ListSecretVersionsResponse,
ListSecretsResponse,
ListTagsResponse,
Secret,
SecretVersion,
UpdateSecretRequest,
Expand Down Expand Up @@ -222,6 +223,19 @@ export const unmarshalListSecretsResponse = (
} as ListSecretsResponse
}

export const unmarshalListTagsResponse = (data: unknown): ListTagsResponse => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`,
)
}

return {
tags: data.tags,
totalCount: data.total_count,
} as ListTagsResponse
}

export const marshalAddSecretOwnerRequest = (
request: AddSecretOwnerRequest,
defaults: DefaultValues,
Expand Down
19 changes: 19 additions & 0 deletions packages/clients/src/api/secret/v1beta1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,25 @@ export interface ListSecretsResponse {
totalCount: number
}

export type ListTagsRequest = {
/**
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
/** ID of the Project to target. */
projectId?: string
page?: number
pageSize?: number
}

export interface ListTagsResponse {
/** List of tags. */
tags: string[]
/** Count of all tags matching the requested criteria. */
totalCount: number
}

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