diff --git a/packages/clients/src/api/iam/v1alpha1/api.gen.ts b/packages/clients/src/api/iam/v1alpha1/api.gen.ts index cd9d46b31..f04637162 100644 --- a/packages/clients/src/api/iam/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/api.gen.ts @@ -15,6 +15,7 @@ import { marshalCreateGroupRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, + marshalCreateUserRequest, marshalRemoveGroupMemberRequest, marshalSetGroupMembersRequest, marshalSetRulesRequest, @@ -54,6 +55,7 @@ import type { CreateGroupRequest, CreatePolicyRequest, CreateSSHKeyRequest, + CreateUserRequest, DeleteAPIKeyRequest, DeleteApplicationRequest, DeleteGroupRequest, @@ -299,6 +301,26 @@ export class API extends ParentAPI { )}`, }) + /** + * Create a new user. Create a new user. You must define the `organization_id` + * and the `email` in your request. + * + * @param request - The request {@link CreateUserRequest} + * @returns A Promise of User + */ + createUser = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateUserRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/iam/v1alpha1/users`, + }, + unmarshalUser, + ) + protected pageOfListApplications = ( request: Readonly = {}, ) => diff --git a/packages/clients/src/api/iam/v1alpha1/index.gen.ts b/packages/clients/src/api/iam/v1alpha1/index.gen.ts index 4297ea6b9..7228de5a9 100644 --- a/packages/clients/src/api/iam/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/index.gen.ts @@ -13,6 +13,7 @@ export type { CreateGroupRequest, CreatePolicyRequest, CreateSSHKeyRequest, + CreateUserRequest, DeleteAPIKeyRequest, DeleteApplicationRequest, DeleteGroupRequest, diff --git a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts index 0cd6220a7..b5d44dd5e 100644 --- a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts @@ -18,6 +18,7 @@ import type { CreateGroupRequest, CreatePolicyRequest, CreateSSHKeyRequest, + CreateUserRequest, Group, JWT, ListAPIKeysResponse, @@ -507,6 +508,14 @@ export const marshalCreateSSHKeyRequest = ( public_key: request.publicKey, }) +export const marshalCreateUserRequest = ( + request: CreateUserRequest, + defaults: DefaultValues, +): Record => ({ + email: request.email, + organization_id: request.organizationId ?? defaults.defaultOrganizationId, +}) + export const marshalRemoveGroupMemberRequest = ( request: RemoveGroupMemberRequest, defaults: DefaultValues, diff --git a/packages/clients/src/api/iam/v1alpha1/types.gen.ts b/packages/clients/src/api/iam/v1alpha1/types.gen.ts index ae1de21ee..c8d5b6706 100644 --- a/packages/clients/src/api/iam/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/types.gen.ts @@ -510,6 +510,13 @@ export type DeleteUserRequest = { userId: string } +export type CreateUserRequest = { + /** ID of the Organization. */ + organizationId?: string + /** Email of the user. */ + email: string +} + export type ListApplicationsRequest = { /** Criteria for sorting results. */ orderBy?: ListApplicationsRequestOrderBy