db role
The db role commands.
A role is a login on a managed instance. Creating one is how a service gets its own credential rather than sharing the first one.
Passwords are not returned by any of these commands. A role's password reaches you
inside the connection string that db url builds, and nowhere else.
db role list
List the logins a database accepts.
Usage
outplane db role list <DATABASE>Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
Output
| Field | Type | Description |
|---|---|---|
name | string | |
db | string | The instance it belongs to. |
Examples
Which logins exist
outplane db role list ordersRead the names in a pipeline
outplane db role list orders --json --fields name{
"items": [
{
"name": "app"
}
],
"total": 1,
"truncated": false
}Check whether one exists before creating it
outplane db role list orders -o textWhat to Know
- A database that is still provisioning reports none, which is a state rather than an error.
- Passwords are not here and are not anywhere else either.
db urlassembles a connection string that contains one.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The Out Plane API returned a server error. |
The code on the error object is one of db.not_found, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.
db role create
Add a login to a database.
Usage
outplane db role create <DATABASE> <ROLE>Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
ROLE | string | The role's name. Required. |
Output
| Field | Type | Description |
|---|---|---|
kind | string | One of role, database. |
name | string | |
db | string | |
dbId | string | |
changed | bool |
Examples
Check the request without creating anything
outplane db role create orders checkout --dry-run --json{
"changed": false,
"kind": "role",
"name": "checkout"
}A login for one application
outplane db role create orders checkoutCreate one and read its connection string
outplane db role create orders checkout --json --fields name,changedWhat to Know
- The password is generated and never returned by this command. It is in the connection string and nowhere else, so read it there when it is needed.
- Creating the same role twice is refused by the provider rather than being a no-op.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The Out Plane API returned a server error. |
The code on the error object is one of db.not_found, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.
db role delete
Remove a login.
Usage
outplane db role delete <DATABASE> <ROLE> [flags]Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
ROLE | string | The role's name. Required. |
Flags
| Flag | Type | Description |
|---|---|---|
-y, --yes | bool | Acknowledge the deletion. Not sufficient on its own. |
--confirm-name | string | The name, typed again. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
kind | string | One of role, database. |
name | string | |
db | string | |
changed | bool |
Examples
See what would go
outplane db role delete orders old --dry-runThe confirmed form
outplane db role delete orders old --yes --confirm-name oldRead what the name resolves to, before confirming
outplane db role delete orders old --dry-run --json{
"changed": false,
"kind": "role",
"name": "old"
}What to Know
- Never prompts. Without confirmation it exits 4 and returns the command to replay in the error's confirm_command field.
- Under a detected agent harness it exits 4 even with both flags.
- Nothing updates the applications holding a connection string. They fail on their next connection.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
4 | confirmation_required | A destructive operation stopped. Replay the command in confirm_command. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The Out Plane API returned a server error. |
The code on the error object is one of confirmation.required, db.confirm_name_mismatch, db.not_found, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.