Skip to content

Commit

Permalink
Merge pull request #212 from mittwald/feature/sshuser-delete
Browse files Browse the repository at this point in the history
Add "{sftp|ssh}-user delete" commands
  • Loading branch information
martin-helmich authored Feb 12, 2024
2 parents eeef309 + 12db6c5 commit 0735565
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ USAGE
* [`mw project update [PROJECT-ID]`](#mw-project-update-project-id)
* [`mw server get [SERVER-ID]`](#mw-server-get-server-id)
* [`mw server list`](#mw-server-list)
* [`mw sftp-user delete SFTP-USER-ID`](#mw-sftp-user-delete-sftp-user-id)
* [`mw sftp-user list`](#mw-sftp-user-list)
* [`mw ssh-user delete SSH-USER-ID`](#mw-ssh-user-delete-ssh-user-id)
* [`mw ssh-user list`](#mw-ssh-user-list)
* [`mw update [CHANNEL]`](#mw-update-channel)
* [`mw user api-token create`](#mw-user-api-token-create)
Expand Down Expand Up @@ -4184,6 +4186,31 @@ DESCRIPTION
List servers for an organization or user.
```

## `mw sftp-user delete SFTP-USER-ID`

Delete an SFTP user

```
USAGE
$ mw sftp-user delete SFTP-USER-ID [-q] [-f]
ARGUMENTS
SFTP-USER-ID The ID of the SFTP user to delete
FLAGS
-f, --force Do not ask for confirmation
-q, --quiet suppress process output and only display a machine-readable summary.
DESCRIPTION
Delete an SFTP user
FLAG DESCRIPTIONS
-q, --quiet suppress process output and only display a machine-readable summary.
This flag controls if you want to see the process output or only a summary. When using mw non-interactively (e.g. in
scripts), you can use this flag to easily get the IDs of created resources for further processing.
```

## `mw sftp-user list`

List all SFTP users for a project.
Expand Down Expand Up @@ -4217,6 +4244,31 @@ FLAG DESCRIPTIONS
to persistently set a default project for all commands that accept this flag.
```

## `mw ssh-user delete SSH-USER-ID`

Delete an SSH user

```
USAGE
$ mw ssh-user delete SSH-USER-ID [-q] [-f]
ARGUMENTS
SSH-USER-ID The ID of the SSH user to delete
FLAGS
-f, --force Do not ask for confirmation
-q, --quiet suppress process output and only display a machine-readable summary.
DESCRIPTION
Delete an SSH user
FLAG DESCRIPTIONS
-q, --quiet suppress process output and only display a machine-readable summary.
This flag controls if you want to see the process output or only a summary. When using mw non-interactively (e.g. in
scripts), you can use this flag to easily get the IDs of created resources for further processing.
```

## `mw ssh-user list`

List all SSH users for a project.
Expand Down
25 changes: 25 additions & 0 deletions src/commands/sftp-user/delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DeleteBaseCommand } from "../../DeleteBaseCommand.js";
import assertSuccess from "../../lib/assert_success.js";
import { Args } from "@oclif/core";

export default class Delete extends DeleteBaseCommand<typeof Delete> {
static description = "Delete an SFTP user";
static resourceName = "SFTP user";

static flags = { ...DeleteBaseCommand.baseFlags };
static args = {
"sftp-user-id": Args.string({
description: "The ID of the SFTP user to delete",
required: true,
}),
};

protected async deleteResource(): Promise<void> {
const sftpUserId = this.args["sftp-user-id"];
const response = await this.apiClient.sshsftpUser.sftpUserDeleteSftpUser({
sftpUserId,
});

assertSuccess(response);
}
}
25 changes: 25 additions & 0 deletions src/commands/ssh-user/delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DeleteBaseCommand } from "../../DeleteBaseCommand.js";
import assertSuccess from "../../lib/assert_success.js";
import { Args } from "@oclif/core";

export default class Delete extends DeleteBaseCommand<typeof Delete> {
static description = "Delete an SSH user";
static resourceName = "SSH user";

static flags = { ...DeleteBaseCommand.baseFlags };
static args = {
"ssh-user-id": Args.string({
description: "The ID of the SSH user to delete",
required: true,
}),
};

protected async deleteResource(): Promise<void> {
const sshUserId = this.args["ssh-user-id"];
const response = await this.apiClient.sshsftpUser.sshUserDeleteSshUser({
sshUserId,
});

assertSuccess(response);
}
}

0 comments on commit 0735565

Please sign in to comment.