/APIs & SDKs/Programs and frameworks/roles

OptiTech CLI command: roles

List, create, and delete database roles in a OptiTech project

The roles command lists, creates, and deletes roles in a OptiTech project from the terminal. For information about roles in OptiTech, see Manage roles. If --project-id is omitted, the CLI resolves it from your context file, auto-selects when your account has only one project, and prompts otherwise.

Subcommands: create, delete, list

optitech roles list

Lists roles. If you don't specify a branch ID or name with --branch, the command targets the project's default branch. This applies to all roles subcommands.

optitech roles list [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo

List roles with the default table output format:

optitech roles list
Output
┌────────┬──────────────────────┐
│ Name   │ Created At           │
├────────┼──────────────────────┤
│ daniel │ 2023-06-19T18:27:19Z │
└────────┴──────────────────────┘

List roles with the --output format set to json:

optitech roles list --output json
Show output
[
  {
    "branch_id": "br-odd-frog-703504",
    "name": "daniel",
    "protected": false,
    "created_at": "2023-06-28T10:17:28Z",
    "updated_at": "2023-06-28T10:17:28Z"
  }
]

optitech roles create

Creates a role. The role name cannot exceed 63 bytes.

optitech roles create [options]
OptionDescriptionTypeDefaultRequired
--nameRole namestringYes
--no-loginCreate a passwordless role that cannot loginbooleanNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech roles create --name sally
Output
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘

optitech roles delete

Deletes a role. The <role> is the role name.

optitech roles delete <role> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
optitech roles delete sally
Output
┌───────┬──────────────────────┐
│ Name  │ Created At           │
├───────┼──────────────────────┤
│ sally │ 2023-06-20T00:43:17Z │
└───────┴──────────────────────┘
Was this page helpful?

On this page

Copy neon init command