Skip to content

Commit 5286709

Browse files
authored
Merge branch 'main' into v1.5892.0
2 parents 4e983fc + 04d9545 commit 5286709

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
marshalUpdateSSHKeyRequest,
2929
marshalUpdateUserPasswordRequest,
3030
marshalUpdateUserRequest,
31+
marshalUpdateUserUsernameRequest,
3132
unmarshalAPIKey,
3233
unmarshalApplication,
3334
unmarshalEncodedJWT,
@@ -129,6 +130,7 @@ import type {
129130
UpdateSSHKeyRequest,
130131
UpdateUserPasswordRequest,
131132
UpdateUserRequest,
133+
UpdateUserUsernameRequest,
132134
User,
133135
} from './types.gen'
134136

@@ -355,6 +357,26 @@ export class API extends ParentAPI {
355357
unmarshalUser,
356358
)
357359

360+
/**
361+
* Update an user's username. Private Beta feature.. Update an user's
362+
* username. Private Beta feature.
363+
*
364+
* @param request - The request {@link UpdateUserUsernameRequest}
365+
* @returns A Promise of User
366+
*/
367+
updateUserUsername = (request: Readonly<UpdateUserUsernameRequest>) =>
368+
this.client.fetch<User>(
369+
{
370+
body: JSON.stringify(
371+
marshalUpdateUserUsernameRequest(request, this.client.settings),
372+
),
373+
headers: jsonContentHeaders,
374+
method: 'POST',
375+
path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}/update-username`,
376+
},
377+
unmarshalUser,
378+
)
379+
358380
/**
359381
* Update an user's password. Private Beta feature.. Update an user's
360382
* password. Private Beta feature.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import type {
5757
UpdateSSHKeyRequest,
5858
UpdateUserPasswordRequest,
5959
UpdateUserRequest,
60+
UpdateUserUsernameRequest,
6061
User,
6162
} from './types.gen'
6263

@@ -761,3 +762,10 @@ export const marshalUpdateUserRequest = (
761762
email: request.email,
762763
tags: request.tags,
763764
})
765+
766+
export const marshalUpdateUserUsernameRequest = (
767+
request: UpdateUserUsernameRequest,
768+
defaults: DefaultValues,
769+
): Record<string, unknown> => ({
770+
username: request.username,
771+
})

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,3 +1156,10 @@ export type UpdateUserRequest = {
11561156
/** IAM member email. */
11571157
email?: string
11581158
}
1159+
1160+
export type UpdateUserUsernameRequest = {
1161+
/** ID of the user to update. */
1162+
userId: string
1163+
/** The new username. */
1164+
username: string
1165+
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,11 @@ export const UpdateUserPasswordRequest = {
261261
minLength: 1,
262262
},
263263
}
264+
265+
export const UpdateUserUsernameRequest = {
266+
username: {
267+
maxLength: 64,
268+
minLength: 2,
269+
pattern: /^[a-zA-Z0-9._-]+$/,
270+
},
271+
}

0 commit comments

Comments
 (0)