users
Creates, updates, deletes, gets or lists a users
resource.
Overview
Name | users |
Type | Resource |
Id | google.alloydb.users |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Output only. Name of the resource in the form of projects/{project}/locations/{location}/cluster/{cluster}/users/{user}. |
databaseRoles | array | Optional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions. |
keepExtraRoles | boolean | Input only. If the user already exists and it has additional roles, keep them granted. |
password | string | Input only. Password for the user. |
userType | string | Optional. Type of this user. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | clustersId, locationsId, projectsId, usersId | Gets details of a single User. |
list | SELECT | clustersId, locationsId, projectsId | Lists Users in a given project and location. |
create | INSERT | clustersId, locationsId, projectsId | Creates a new User in a given project, location, and cluster. |
delete | DELETE | clustersId, locationsId, projectsId, usersId | Deletes a single User. |
patch | UPDATE | clustersId, locationsId, projectsId, usersId | Updates the parameters of a single User. |
SELECT
examples
Lists Users in a given project and location.
SELECT
name,
databaseRoles,
keepExtraRoles,
password,
userType
FROM google.alloydb.users
WHERE clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new users
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.alloydb.users (
clustersId,
locationsId,
projectsId,
password,
databaseRoles,
userType,
keepExtraRoles
)
SELECT
'{{ clustersId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ password }}',
'{{ databaseRoles }}',
'{{ userType }}',
{{ keepExtraRoles }}
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: password
value: string
- name: databaseRoles
value:
- string
- name: userType
value: string
- name: keepExtraRoles
value: boolean
UPDATE
example
Updates a users
resource.
/*+ update */
UPDATE google.alloydb.users
SET
password = '{{ password }}',
databaseRoles = '{{ databaseRoles }}',
userType = '{{ userType }}',
keepExtraRoles = true|false
WHERE
clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND usersId = '{{ usersId }}';
DELETE
example
Deletes the specified users
resource.
/*+ delete */
DELETE FROM google.alloydb.users
WHERE clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND usersId = '{{ usersId }}';