Skip to content

Commit de11a07

Browse files
authored
feat(secret): add back passwordGeneration field (#676)
1 parent 1035a22 commit de11a07

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

packages/clients/src/api/secret/v1alpha1/marshalling.gen.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
import {
44
isJSONObject,
5+
resolveOneOf,
56
unmarshalArrayOfObject,
67
unmarshalDate,
78
} from '../../../bridge'
@@ -14,6 +15,7 @@ import type {
1415
GeneratePasswordRequest,
1516
ListSecretVersionsResponse,
1617
ListSecretsResponse,
18+
PasswordGenerationParams,
1719
Secret,
1820
SecretVersion,
1921
UpdateSecretRequest,
@@ -101,6 +103,17 @@ export const unmarshalListSecretsResponse = (data: unknown) => {
101103
} as ListSecretsResponse
102104
}
103105

106+
const marshalPasswordGenerationParams = (
107+
request: PasswordGenerationParams,
108+
defaults: DefaultValues,
109+
): Record<string, unknown> => ({
110+
additional_chars: request.additionalChars,
111+
length: request.length,
112+
no_digits: request.noDigits,
113+
no_lowercase_letters: request.noLowercaseLetters,
114+
no_uppercase_letters: request.noUppercaseLetters,
115+
})
116+
104117
export const marshalAddSecretOwnerRequest = (
105118
request: AddSecretOwnerRequest,
106119
defaults: DefaultValues,
@@ -126,6 +139,14 @@ export const marshalCreateSecretVersionRequest = (
126139
data_crc32: request.dataCrc32,
127140
description: request.description,
128141
disable_previous: request.disablePrevious,
142+
...resolveOneOf([
143+
{
144+
param: 'password_generation',
145+
value: request.passwordGeneration
146+
? marshalPasswordGenerationParams(request.passwordGeneration, defaults)
147+
: undefined,
148+
},
149+
]),
129150
})
130151

131152
export const marshalGeneratePasswordRequest = (

packages/clients/src/api/secret/v1alpha1/types.gen.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ export type CreateSecretVersionRequest = {
238238
* version or if the previous version was already disabled, does nothing.
239239
*/
240240
disablePrevious?: boolean
241+
/**
242+
* @deprecated Options to generate a password. (Optional.) If specified, a
243+
* random password will be generated. The `data` and `data_crc32` fields
244+
* must be empty. By default, the generator will use upper and lower case
245+
* letters, and digits. This behavior can be tuned using the generation
246+
* parameters.
247+
*
248+
* One-of ('PasswordGeneration'): at most one of 'passwordGeneration' could be
249+
* set.
250+
*/
251+
passwordGeneration?: PasswordGenerationParams
241252
/**
242253
* (Optional.) The CRC32 checksum of the data as a base-10 integer. If
243254
* specified, Secret Manager will verify the integrity of the data received

0 commit comments

Comments
 (0)