Skip to content

Commit f2afda2

Browse files
authored
feat(iam): add UpdateUserPassword method (#1514)
1 parent 8ec5042 commit f2afda2

File tree

5 files changed

+57
-19
lines changed

5 files changed

+57
-19
lines changed

packages/clients/src/api/iam/v1alpha1/api.gen.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
marshalUpdateGroupRequest,
2626
marshalUpdatePolicyRequest,
2727
marshalUpdateSSHKeyRequest,
28+
marshalUpdateUserPasswordRequest,
2829
marshalUpdateUserRequest,
2930
unmarshalAPIKey,
3031
unmarshalApplication,
@@ -116,6 +117,7 @@ import type {
116117
UpdateGroupRequest,
117118
UpdatePolicyRequest,
118119
UpdateSSHKeyRequest,
120+
UpdateUserPasswordRequest,
119121
UpdateUserRequest,
120122
User,
121123
} from './types.gen'
@@ -343,6 +345,19 @@ export class API extends ParentAPI {
343345
unmarshalUser,
344346
)
345347

348+
updateUserPassword = (request: Readonly<UpdateUserPasswordRequest>) =>
349+
this.client.fetch<User>(
350+
{
351+
body: JSON.stringify(
352+
marshalUpdateUserPasswordRequest(request, this.client.settings),
353+
),
354+
headers: jsonContentHeaders,
355+
method: 'POST',
356+
path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}/update-password`,
357+
},
358+
unmarshalUser,
359+
)
360+
346361
protected pageOfListApplications = (
347362
request: Readonly<ListApplicationsRequest> = {},
348363
) =>

packages/clients/src/api/iam/v1alpha1/index.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export type {
8686
UpdateGroupRequest,
8787
UpdatePolicyRequest,
8888
UpdateSSHKeyRequest,
89+
UpdateUserPasswordRequest,
8990
UpdateUserRequest,
9091
User,
9192
UserStatus,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type {
5151
UpdateGroupRequest,
5252
UpdatePolicyRequest,
5353
UpdateSSHKeyRequest,
54+
UpdateUserPasswordRequest,
5455
UpdateUserRequest,
5556
User,
5657
} from './types.gen'
@@ -684,6 +685,14 @@ export const marshalUpdateSSHKeyRequest = (
684685
name: request.name,
685686
})
686687

688+
export const marshalUpdateUserPasswordRequest = (
689+
request: UpdateUserPasswordRequest,
690+
defaults: DefaultValues,
691+
): Record<string, unknown> => ({
692+
password: request.password,
693+
send_email: request.sendEmail,
694+
})
695+
687696
export const marshalUpdateUserRequest = (
688697
request: UpdateUserRequest,
689698
defaults: DefaultValues,

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,25 @@ export type UserStatus = 'unknown_status' | 'invitation_pending' | 'activated'
8989

9090
export type UserType = 'unknown_type' | 'guest' | 'owner' | 'member'
9191

92+
export interface JWT {
93+
/** JWT ID. */
94+
jti: string
95+
/** ID of the user who issued the JWT. */
96+
issuerId: string
97+
/** ID of the user targeted by the JWT. */
98+
audienceId: string
99+
/** Creation date of the JWT. */
100+
createdAt?: Date
101+
/** Last update date of the JWT. */
102+
updatedAt?: Date
103+
/** Expiration date of the JWT. */
104+
expiresAt?: Date
105+
/** IP address used during the creation of the JWT. */
106+
ip: string
107+
/** User-agent used during the creation of the JWT. */
108+
userAgent: string
109+
}
110+
92111
export interface RuleSpecs {
93112
/** Names of permission sets bound to the rule. */
94113
permissionSetNames?: string[]
@@ -121,25 +140,6 @@ export interface CreateUserRequestMember {
121140
password: string
122141
}
123142

124-
export interface JWT {
125-
/** JWT ID. */
126-
jti: string
127-
/** ID of the user who issued the JWT. */
128-
issuerId: string
129-
/** ID of the user targeted by the JWT. */
130-
audienceId: string
131-
/** Creation date of the JWT. */
132-
createdAt?: Date
133-
/** Last update date of the JWT. */
134-
updatedAt?: Date
135-
/** Expiration date of the JWT. */
136-
expiresAt?: Date
137-
/** IP address used during the creation of the JWT. */
138-
ip: string
139-
/** User-agent used during the creation of the JWT. */
140-
userAgent: string
141-
}
142-
143143
export interface APIKey {
144144
/** Access key of the API key. */
145145
accessKey: string
@@ -1070,6 +1070,12 @@ export type UpdateSSHKeyRequest = {
10701070
disabled?: boolean
10711071
}
10721072

1073+
export type UpdateUserPasswordRequest = {
1074+
userId: string
1075+
password: string
1076+
sendEmail: boolean
1077+
}
1078+
10731079
export type UpdateUserRequest = {
10741080
/** ID of the user to update. */
10751081
userId: string

packages/clients/src/api/iam/v1alpha1/validation-rules.gen.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,10 @@ export const UpdateSSHKeyRequest = {
254254
maxLength: 1000,
255255
},
256256
}
257+
258+
export const UpdateUserPasswordRequest = {
259+
password: {
260+
maxLength: 72,
261+
minLength: 1,
262+
},
263+
}

0 commit comments

Comments
 (0)