Skip to main content

thing_principals

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

Overview

Namething_principals
TypeResource
Idaws.iot.thing_principals

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
principalstringThe principals associated with the thing.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_thing_principalsselectthing_name, regionnextToken, maxResultsLists the principals associated with the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities. Requires permission to access the ListThingPrincipals action.
attach_thing_principalupdatething_name, x-amzn-principal, regionthingPrincipalTypeAttaches the specified principal to the specified thing. A principal can be X.509 certificates, Amazon Cognito identities or federated identities. Requires permission to access the AttachThingPrincipal action.
detach_thing_principalexecthing_name, x-amzn-principal, regionDetaches the specified principal from the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities. This call is asynchronous. It might take several seconds for the detachment to propagate. Requires permission to access the DetachThingPrincipal action.

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
regionstringAWS region (default: us-east-1)
thing_namestringThe name of the thing.
x-amzn-principalstringIf the principal is a certificate, this value must be ARN of the certificate. If the principal is an Amazon Cognito identity, this value must be the ID of the Amazon Cognito identity.
maxResultsintegerThe maximum number of results to return in this operation.
nextTokenstringTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
thingPrincipalTypestringThe type of the relation you want to specify when you attach a principal to a thing. EXCLUSIVE_THING - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal. NON_EXCLUSIVE_THING - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.

SELECT examples

Lists the principals associated with the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities. Requires permission to access the ListThingPrincipals action.

SELECT
principal
FROM aws.iot.thing_principals
WHERE thing_name = '{{ thing_name }}' -- required
AND region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;

UPDATE examples

Attaches the specified principal to the specified thing. A principal can be X.509 certificates, Amazon Cognito identities or federated identities. Requires permission to access the AttachThingPrincipal action.

UPDATE aws.iot.thing_principals
SET
-- No updatable properties
WHERE
thing_name = '{{ thing_name }}' --required
AND `x-amzn-principal` = '{{ x-amzn-principal }}' --required
AND region = '{{ region }}' --required
AND thingPrincipalType = '{{ thingPrincipalType}}';

Lifecycle Methods

Detaches the specified principal from the specified thing. A principal can be X.509 certificates, IAM users, groups, and roles, Amazon Cognito identities or federated identities. This call is asynchronous. It might take several seconds for the detachment to propagate. Requires permission to access the DetachThingPrincipal action.

EXEC aws.iot.thing_principals.detach_thing_principal
@thing_name='{{ thing_name }}' --required,
@x-amzn-principal='{{ x-amzn-principal }}' --required,
@region='{{ region }}' --required
;