Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mongodb): add deleteUser route #1700

Merged
merged 2 commits into from
Dec 27, 2024
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
15 changes: 15 additions & 0 deletions packages/clients/src/api/mongodb/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type {
DeleteEndpointRequest,
DeleteInstanceRequest,
DeleteSnapshotRequest,
DeleteUserRequest,
Endpoint,
GetInstanceCertificateRequest,
GetInstanceRequest,
Expand Down Expand Up @@ -527,6 +528,20 @@ export class API extends ParentAPI {
unmarshalUser,
)

/**
* Delete a user on a Database Instance. Delete an existing user on a Database
* Instance.
*
* @param request - The request {@link DeleteUserRequest}
*/
deleteUser = (request: Readonly<DeleteUserRequest>) =>
this.client.fetch<void>({
body: '{}',
headers: jsonContentHeaders,
method: 'DELETE',
path: `/mongodb/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users/${validatePathParam('name', request.name)}`,
})

/**
* Delete a Database Instance endpoint. Delete the endpoint of a Database
* Instance. You must specify the `endpoint_id` parameter of the endpoint you
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/mongodb/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type {
DeleteEndpointRequest,
DeleteInstanceRequest,
DeleteSnapshotRequest,
DeleteUserRequest,
Endpoint,
EndpointPrivateNetworkDetails,
EndpointPublicDetails,
Expand Down
12 changes: 12 additions & 0 deletions packages/clients/src/api/mongodb/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,18 @@ export type DeleteSnapshotRequest = {
snapshotId: string
}

export type DeleteUserRequest = {
/**
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
/** UUID of the Database Instance the user belongs to. */
instanceId: string
/** Name of the database user. */
name: string
}

export type GetInstanceCertificateRequest = {
/**
* Region to target. If none is passed will use default region from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export const CreateUserRequest = {
},
}

export const DeleteUserRequest = {
name: {
maxLength: 63,
minLength: 1,
pattern: /^[a-zA-Z0-9_\-]*$/,
},
}

export const ListInstancesRequest = {
name: {
maxLength: 255,
Expand Down
Loading