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:

Successful response

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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, clustersId, usersIdGets details of a single User.
listselectprojectsId, locationsId, clustersIdpageSize, pageToken, filter, orderByLists Users in a given project and location.
createinsertprojectsId, locationsId, clustersIduserId, requestId, validateOnlyCreates a new User in a given project, location, and cluster.
patchupdateprojectsId, locationsId, clustersId, usersIdupdateMask, requestId, validateOnly, allowMissingUpdates 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__password,
data__databaseRoles,
data__userType,
data__keepExtraRoles,
projectsId,
locationsId,
clustersId,
userId,
requestId,
validateOnly
)
SELECT
'{{ password }}',
'{{ databaseRoles }}',
'{{ userType }}',
{{ keepExtraRoles }},
'{{ projectsId }}',
'{{ locationsId }}',
'{{ clustersId }}',
'{{ userId }}',
'{{ requestId }}',
'{{ validateOnly }}'
RETURNING
name,
databaseRoles,
keepExtraRoles,
password,
userType
;

UPDATE examples

Updates the parameters of a single User.

UPDATE google.alloydb.users
SET
data__password = '{{ password }}',
data__databaseRoles = '{{ databaseRoles }}',
data__userType = '{{ userType }}',
data__keepExtraRoles = {{ keepExtraRoles }}
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND usersId = '{{ usersId }}' --required
AND updateMask = '{{ updateMask}}'
AND requestId = '{{ requestId}}'
AND validateOnly = {{ validateOnly}}
AND allowMissing = {{ allowMissing}}
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 }}';