roles
Creates, updates, deletes, gets or lists a roles resource.
Overview
| Name | roles |
| Type | Resource |
| Id | databricks_workspace.postgres.roles |
Fields
The following fields are returned by SELECT queries:
- list
- get
| Name | Datatype | Description |
|---|---|---|
name | string | Output only. The full resource path of the role. Format: projects/{project_id}/branches/{branch_id}/roles/{role_id} |
create_time | string (date-time) | |
parent | string | The Branch where this Role exists. Format: projects/{project_id}/branches/{branch_id} |
spec | object | The spec contains the role configuration, including identity type, authentication method, and role attributes. |
status | object | Current status of the role, including its identity type, authentication method, and role attributes. |
update_time | string (date-time) |
| Name | Datatype | Description |
|---|---|---|
name | string | Output only. The full resource path of the role. Format: projects/{project_id}/branches/{branch_id}/roles/{role_id} |
create_time | string (date-time) | |
parent | string | The Branch where this Role exists. Format: projects/{project_id}/branches/{branch_id} |
spec | object | The spec contains the role configuration, including identity type, authentication method, and role attributes. |
status | object | Current status of the role, including its identity type, authentication method, and role attributes. |
update_time | string (date-time) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | project_id, branch_id, deployment_name | page_size, page_token | Returns a paginated list of Postgres roles in the branch. |
get | select | project_id, branch_id, role_id, deployment_name | Retrieves information about the specified Postgres role, including its authentication method and | |
create | insert | project_id, branch_id, deployment_name, role | role_id | Creates a new Postgres role in the branch. |
delete | delete | project_id, branch_id, role_id, deployment_name | reassign_owned_to | Deletes the specified Postgres role. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
branch_id | string | The unique identifier of the branch. Format: projects/{project_id}/branches/{branch_id} |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
project_id | string | The unique identifier of the Postgres project. Format: projects/{project_id} |
role_id | string | The unique identifier of the role to delete. Format: projects/{project_id}/branches/{branch_id}/roles/{role_id} |
page_size | integer | Upper bound for items returned. Cannot be negative. |
page_token | string | Page token from a previous response. If not provided, returns the first page. |
reassign_owned_to | string | Reassign objects. If this is set, all objects owned by the role are reassigned to the role specified in this parameter. NOTE: setting this requires spinning up a compute to succeed, since it involves running SQL queries. |
role_id | string | The ID to use for the Role, which will become the final component of the role's resource name. This ID becomes the role in Postgres. This value should be 4-63 characters, and valid characters are lowercase letters, numbers, and hyphens, as defined by RFC 1123. If role_id is not specified in the request, it is generated automatically. |
SELECT examples
- list
- get
Returns a paginated list of Postgres roles in the branch.
SELECT
name,
create_time,
parent,
spec,
status,
update_time
FROM databricks_workspace.postgres.roles
WHERE project_id = '{{ project_id }}' -- required
AND branch_id = '{{ branch_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;
Retrieves information about the specified Postgres role, including its authentication method and
SELECT
name,
create_time,
parent,
spec,
status,
update_time
FROM databricks_workspace.postgres.roles
WHERE project_id = '{{ project_id }}' -- required
AND branch_id = '{{ branch_id }}' -- required
AND role_id = '{{ role_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
INSERT examples
- create
- Manifest
Creates a new Postgres role in the branch.
INSERT INTO databricks_workspace.postgres.roles (
role,
project_id,
branch_id,
deployment_name,
role_id
)
SELECT
'{{ role }}' /* required */,
'{{ project_id }}',
'{{ branch_id }}',
'{{ deployment_name }}',
'{{ role_id }}'
;
# Description fields are for documentation purposes
- name: roles
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the roles resource.
- name: branch_id
value: "{{ branch_id }}"
description: Required parameter for the roles resource.
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the roles resource.
- name: role
description: |
The desired specification of a Role.
value:
create_time: "{{ create_time }}"
name: "{{ name }}"
parent: "{{ parent }}"
spec:
attributes:
bypassrls: {{ bypassrls }}
createdb: {{ createdb }}
createrole: {{ createrole }}
auth_method: "{{ auth_method }}"
identity_type: "{{ identity_type }}"
membership_roles:
- "{{ membership_roles }}"
postgres_role: "{{ postgres_role }}"
status:
attributes:
bypassrls: {{ bypassrls }}
createdb: {{ createdb }}
createrole: {{ createrole }}
auth_method: "{{ auth_method }}"
identity_type: "{{ identity_type }}"
membership_roles:
- "{{ membership_roles }}"
postgres_role: "{{ postgres_role }}"
update_time: "{{ update_time }}"
- name: role_id
value: "{{ role_id }}"
description: The ID to use for the Role, which will become the final component of the role's resource name. This ID becomes the role in Postgres. This value should be 4-63 characters, and valid characters are lowercase letters, numbers, and hyphens, as defined by RFC 1123. If role_id is not specified in the request, it is generated automatically.
DELETE examples
- delete
Deletes the specified Postgres role.
DELETE FROM databricks_workspace.postgres.roles
WHERE project_id = '{{ project_id }}' --required
AND branch_id = '{{ branch_id }}' --required
AND role_id = '{{ role_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND reassign_owned_to = '{{ reassign_owned_to }}'
;