Skip to main content

users

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

Overview

Nameusers
TypeResource
Idaws.ds_data.users

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
distinguished_namestringThe distinguished name of the object.
email_addressstringThe email address of the user.
enabledbooleanIndicates whether the user account is active.
given_namestringThe first name of the user.
other_attributesobjectAn expression that includes one or more attributes, data types, and values of a user.
sam_account_namestringThe name of the user. (pattern: <code>^[\w-.]+$</code>)
sidstringThe unique security identifier (SID) of the user.
surnamestringThe last name of the user.
user_principal_namestringThe UPN that is an internet-style login name for a user and based on the internet standard RFC 822. The UPN is shorter than the distinguished name and easier to remember.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
search_usersselectDirectoryId, regionSearches the specified directory for a user. You can find users that match the SearchString parameter with the value of their attributes included in the SearchString parameter. This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the SearchUsers.NextToken member contains a token that you pass in the next call to SearchUsers. This retrieves the next set of items. You can also specify a maximum number of return results with the MaxResults parameter.
describe_userselectDirectoryId, regionReturns information about a specific user.
list_usersselectDirectoryId, regionReturns user information for the specified directory. This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the ListUsers.NextToken member contains a token that you pass in the next call to ListUsers. This retrieves the next set of items. You can also specify a maximum number of return results with the MaxResults parameter.
create_userinsertDirectoryId, region, SAMAccountNameCreates a new user.
update_userupdateDirectoryId, region, SAMAccountNameUpdates user information.
delete_userdeleteDirectoryId, regionDeletes a 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
DirectoryIdstringThe identifier (ID) of the directory that's associated with the user.
regionstringAWS region (default: us-east-1)

SELECT examples

Searches the specified directory for a user. You can find users that match the SearchString parameter with the value of their attributes included in the SearchString parameter. This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the SearchUsers.NextToken member contains a token that you pass in the next call to SearchUsers. This retrieves the next set of items. You can also specify a maximum number of return results with the MaxResults parameter.

SELECT
distinguished_name,
email_address,
enabled,
given_name,
other_attributes,
sam_account_name,
sid,
surname,
user_principal_name
FROM aws.ds_data.users
WHERE DirectoryId = '{{ DirectoryId }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new user.

INSERT INTO aws.ds_data.users (
ClientToken,
EmailAddress,
GivenName,
OtherAttributes,
SAMAccountName,
Surname,
DirectoryId,
region
)
SELECT
'{{ ClientToken }}',
'{{ EmailAddress }}',
'{{ GivenName }}',
'{{ OtherAttributes }}',
'{{ SAMAccountName }}' /* required */,
'{{ Surname }}',
'{{ DirectoryId }}',
'{{ region }}'
RETURNING
directory_id,
sam_account_name,
sid
;

UPDATE examples

Updates user information.

UPDATE aws.ds_data.users
SET
ClientToken = '{{ ClientToken }}',
EmailAddress = '{{ EmailAddress }}',
GivenName = '{{ GivenName }}',
OtherAttributes = '{{ OtherAttributes }}',
SAMAccountName = '{{ SAMAccountName }}',
Surname = '{{ Surname }}',
UpdateType = '{{ UpdateType }}'
WHERE
DirectoryId = '{{ DirectoryId }}' --required
AND region = '{{ region }}' --required
AND SAMAccountName = '{{ SAMAccountName }}' --required;

DELETE examples

Deletes a user.

DELETE FROM aws.ds_data.users
WHERE DirectoryId = '{{ DirectoryId }}' --required
AND region = '{{ region }}' --required
;