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
22 changes: 22 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
marshalCreateGroupRequest,
marshalCreatePolicyRequest,
marshalCreateSSHKeyRequest,
marshalCreateUserRequest,
marshalRemoveGroupMemberRequest,
marshalSetGroupMembersRequest,
marshalSetRulesRequest,
Expand Down Expand Up @@ -54,6 +55,7 @@ import type {
CreateGroupRequest,
CreatePolicyRequest,
CreateSSHKeyRequest,
CreateUserRequest,
DeleteAPIKeyRequest,
DeleteApplicationRequest,
DeleteGroupRequest,
Expand Down Expand Up @@ -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<CreateUserRequest>) =>
this.client.fetch<User>(
{
body: JSON.stringify(
marshalCreateUserRequest(request, this.client.settings),
),
headers: jsonContentHeaders,
method: 'POST',
path: `/iam/v1alpha1/users`,
},
unmarshalUser,
)

protected pageOfListApplications = (
request: Readonly<ListApplicationsRequest> = {},
) =>
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/iam/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type {
CreateGroupRequest,
CreatePolicyRequest,
CreateSSHKeyRequest,
CreateUserRequest,
DeleteAPIKeyRequest,
DeleteApplicationRequest,
DeleteGroupRequest,
Expand Down
9 changes: 9 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
CreateGroupRequest,
CreatePolicyRequest,
CreateSSHKeyRequest,
CreateUserRequest,
Group,
JWT,
ListAPIKeysResponse,
Expand Down Expand Up @@ -507,6 +508,14 @@ export const marshalCreateSSHKeyRequest = (
public_key: request.publicKey,
})

export const marshalCreateUserRequest = (
request: CreateUserRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
email: request.email,
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
})

export const marshalRemoveGroupMemberRequest = (
request: RemoveGroupMemberRequest,
defaults: DefaultValues,
Expand Down
7 changes: 7 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down