Skip to main content

principal_policies

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

Overview

Nameprincipal_policies
TypeResource
Idaws.iot.principal_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policy_arnstringThe policy ARN.
policy_namestringThe policy name. (pattern: <code>[\w+=,.@-]+</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_principal_policiesselectx-amzn-iot-principal, regionmarker, pageSize, isAscendingOrderLists the policies attached to the specified principal. If you use an Cognito identity, the ID must be in AmazonCognito Identity format. Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use ListAttachedPolicies instead. Requires permission to access the ListPrincipalPolicies action.
attach_principal_policyupdatepolicy_name, x-amzn-iot-principal, regionAttaches the specified policy to the specified principal (certificate or other credential). Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use AttachPolicy instead. Requires permission to access the AttachPrincipalPolicy action.
detach_principal_policyexecpolicy_name, x-amzn-iot-principal, regionRemoves the specified policy from the specified certificate. Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use DetachPolicy instead. Requires permission to access the DetachPrincipalPolicy 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
policy_namestringThe name of the policy to detach.
regionstringAWS region (default: us-east-1)
x-amzn-iot-principalstringThe principal. Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
isAscendingOrderbooleanSpecifies the order for results. If true, results are returned in ascending creation order.
markerstringThe marker for the next set of results.
pageSizeintegerThe result page size.

SELECT examples

Lists the policies attached to the specified principal. If you use an Cognito identity, the ID must be in AmazonCognito Identity format. Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use ListAttachedPolicies instead. Requires permission to access the ListPrincipalPolicies action.

SELECT
policy_arn,
policy_name
FROM aws.iot.principal_policies
WHERE `x-amzn-iot-principal` = '{{ x-amzn-iot-principal }}' -- required
AND region = '{{ region }}' -- required
AND marker = '{{ marker }}'
AND pageSize = '{{ pageSize }}'
AND isAscendingOrder = '{{ isAscendingOrder }}'
;

UPDATE examples

Attaches the specified policy to the specified principal (certificate or other credential). Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use AttachPolicy instead. Requires permission to access the AttachPrincipalPolicy action.

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

Lifecycle Methods

Removes the specified policy from the specified certificate. Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use DetachPolicy instead. Requires permission to access the DetachPrincipalPolicy action.

EXEC aws.iot.principal_policies.detach_principal_policy
@policy_name='{{ policy_name }}' --required,
@x-amzn-iot-principal='{{ x-amzn-iot-principal }}' --required,
@region='{{ region }}' --required
;