Skip to content

Commit

Permalink
feat(mongodb): add deleteUser route (#1700)
Browse files Browse the repository at this point in the history
Co-authored-by: philibeaux <[email protected]>
  • Loading branch information
scaleway-bot and philibea authored Dec 27, 2024
1 parent 506a671 commit 2738abe
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
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

0 comments on commit 2738abe

Please sign in to comment.