Skip to main content

roles

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

Overview

Nameroles
TypeResource
Idgoogleadmin.directory.roles

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
etagstringETag of the resource.
isSuperAdminRolebooleanReturns true if the role is a super admin role.
isSystemRolebooleanReturns true if this is a pre-defined system role.
kindstringThe type of the API resource. This is always admin#directory#role. (default: admin#directory#role)
roleDescriptionstringA short description of the role.
roleIdstring (int64)ID of the role.
roleNamestringName of the role.
rolePrivilegesarrayThe set of privileges that are granted to this role.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcustomer, roleIdRetrieves a role.
listselectcustomermaxResults, pageTokenRetrieves a paginated list of all the roles in a domain.
insertinsertcustomerCreates a role.
patchupdatecustomer, roleIdPatches a role.
updatereplacecustomer, roleIdUpdates a role.
deletedeletecustomer, roleIdDeletes a 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.

NameDatatypeDescription
customerstring
roleIdstring
maxResultsinteger (int32)
pageTokenstring

SELECT examples

Retrieves a role.

SELECT
etag,
isSuperAdminRole,
isSystemRole,
kind,
roleDescription,
roleId,
roleName,
rolePrivileges
FROM googleadmin.directory.roles
WHERE customer = '{{ customer }}' -- required
AND roleId = '{{ roleId }}' -- required;

INSERT examples

Creates a role.

INSERT INTO googleadmin.directory.roles (
data__roleId,
data__roleName,
data__roleDescription,
data__rolePrivileges,
data__isSystemRole,
data__isSuperAdminRole,
data__kind,
data__etag,
customer
)
SELECT
'{{ roleId }}',
'{{ roleName }}',
'{{ roleDescription }}',
'{{ rolePrivileges }}',
{{ isSystemRole }},
{{ isSuperAdminRole }},
'{{ kind }}',
'{{ etag }}',
'{{ customer }}'
RETURNING
etag,
isSuperAdminRole,
isSystemRole,
kind,
roleDescription,
roleId,
roleName,
rolePrivileges
;

UPDATE examples

Patches a role.

UPDATE googleadmin.directory.roles
SET
data__roleId = '{{ roleId }}',
data__roleName = '{{ roleName }}',
data__roleDescription = '{{ roleDescription }}',
data__rolePrivileges = '{{ rolePrivileges }}',
data__isSystemRole = {{ isSystemRole }},
data__isSuperAdminRole = {{ isSuperAdminRole }},
data__kind = '{{ kind }}',
data__etag = '{{ etag }}'
WHERE
customer = '{{ customer }}' --required
AND roleId = '{{ roleId }}' --required
RETURNING
etag,
isSuperAdminRole,
isSystemRole,
kind,
roleDescription,
roleId,
roleName,
rolePrivileges;

REPLACE examples

Updates a role.

REPLACE googleadmin.directory.roles
SET
data__roleId = '{{ roleId }}',
data__roleName = '{{ roleName }}',
data__roleDescription = '{{ roleDescription }}',
data__rolePrivileges = '{{ rolePrivileges }}',
data__isSystemRole = {{ isSystemRole }},
data__isSuperAdminRole = {{ isSuperAdminRole }},
data__kind = '{{ kind }}',
data__etag = '{{ etag }}'
WHERE
customer = '{{ customer }}' --required
AND roleId = '{{ roleId }}' --required
RETURNING
etag,
isSuperAdminRole,
isSystemRole,
kind,
roleDescription,
roleId,
roleName,
rolePrivileges;

DELETE examples

Deletes a role.

DELETE FROM googleadmin.directory.roles
WHERE customer = '{{ customer }}' --required
AND roleId = '{{ roleId }}' --required;