Skip to main content

users

Creates, updates, deletes, gets or lists a users resource.

Overview​

Nameusers
TypeResource
Idgoogle.alloydb.users

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringOutput only. Name of the resource in the form of projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
databaseRolesarrayOptional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions.
keepExtraRolesbooleanInput only. If the user already exists and it has additional roles, keep them granted.
passwordstringInput only. Password for the user.
userTypestringOptional. Type of this user. (USER_TYPE_UNSPECIFIED, ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, clustersId, usersIdGets details of a single User.
listselectprojectsId, locationsId, clustersIdfilter, orderBy, pageSize, pageTokenLists Users in a given project and location.
createinsertprojectsId, locationsId, clustersIdrequestId, userId, validateOnlyCreates a new User in a given project, location, and cluster.
patchupdateprojectsId, locationsId, clustersId, usersIdallowMissing, requestId, updateMask, validateOnlyUpdates the parameters of a single User.
deletedeleteprojectsId, locationsId, clustersId, usersIdrequestId, validateOnlyDeletes a single User.

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.

NameDatatypeDescription
clustersIdstring
locationsIdstring
projectsIdstring
usersIdstring
allowMissingboolean
filterstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
updateMaskstring (google-fieldmask)
userIdstring
validateOnlyboolean

SELECT examples​

Gets details of a single User.

SELECT
name,
databaseRoles,
keepExtraRoles,
password,
userType
FROM google.alloydb.users
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND clustersId = '{{ clustersId }}' -- required
AND usersId = '{{ usersId }}' -- required
;

INSERT examples​

Creates a new User in a given project, location, and cluster.

INSERT INTO google.alloydb.users (
data__databaseRoles,
data__keepExtraRoles,
data__password,
data__userType,
projectsId,
locationsId,
clustersId,
requestId,
userId,
validateOnly
)
SELECT
'{{ databaseRoles }}',
{{ keepExtraRoles }},
'{{ password }}',
'{{ userType }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ clustersId }}',
'{{ requestId }}',
'{{ userId }}',
'{{ validateOnly }}'
RETURNING
name,
databaseRoles,
keepExtraRoles,
password,
userType
;

UPDATE examples​

Updates the parameters of a single User.

UPDATE google.alloydb.users
SET
data__databaseRoles = '{{ databaseRoles }}',
data__keepExtraRoles = {{ keepExtraRoles }},
data__password = '{{ password }}',
data__userType = '{{ userType }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND usersId = '{{ usersId }}' --required
AND allowMissing = {{ allowMissing}}
AND requestId = '{{ requestId}}'
AND updateMask = '{{ updateMask}}'
AND validateOnly = {{ validateOnly}}
RETURNING
name,
databaseRoles,
keepExtraRoles,
password,
userType;

DELETE examples​

Deletes a single User.

DELETE FROM google.alloydb.users
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND usersId = '{{ usersId }}' --required
AND requestId = '{{ requestId }}'
AND validateOnly = '{{ validateOnly }}'
;