Skip to content

list_principal_policies

list_principal_policies(
    principal: Principal,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    marker: Optional[Marker] = None,
    page_size: Optional[PageSize] = None,
    ascending_order: Optional[AscendingOrder] = None,
) -> ListPrincipalPoliciesResponse

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.

Parameters:

  • principal (Principal) –

    The principal. Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).

  • marker (Optional[Marker], default: None ) –

    The marker for the next set of results.

  • page_size (Optional[PageSize], default: None ) –

    The result page size.

  • ascending_order (Optional[AscendingOrder], default: None ) –

    Specifies the order for results. If true, results are returned in ascending creation order.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def list_principal_policies(
    self,
    principal: "capo_iot.types.principal.Principal",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    marker: Optional["capo_iot.types.marker.Marker"] = None,
    page_size: Optional["capo_iot.types.page_size.PageSize"] = None,
    ascending_order: Optional[
        "capo_iot.types.ascending_order.AscendingOrder"
    ] = None,
) -> (
    "capo_iot.types.list_principal_policies_response.ListPrincipalPoliciesResponse"
):
    """<p>Lists the policies attached to the specified principal. If you use an Cognito identity, the ID must be in <a href="https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html#API_GetCredentialsForIdentity_RequestSyntax">AmazonCognito Identity format</a>.</p> <p> <b>Note:</b> This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use <a>ListAttachedPolicies</a> instead.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListPrincipalPolicies</a> action.</p>

    Args:
        principal: <p>The principal. Valid principals are CertificateArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:cert/<i>certificateId</i>), thingGroupArn (arn:aws:iot:<i>region</i>:<i>accountId</i>:thinggroup/<i>groupName</i>) and CognitoId (<i>region</i>:<i>id</i>).</p>
        marker: <p>The marker for the next set of results.</p>
        page_size: <p>The result page size.</p>
        ascending_order: <p>Specifies the order for results. If true, results are returned in ascending creation order.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.list_principal_policies_request.ListPrincipalPoliciesRequest]",
    ) -> OperationResponse[
        "capo_iot.types.list_principal_policies_response.ListPrincipalPoliciesResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_principal_policies

        output, http_response = (
            capo_iot._operations.aws_iot_service.list_principal_policies.list_principal_policies(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPrincipalPolicies")
    )
    input_: capo_iot.types.list_principal_policies_request.ListPrincipalPoliciesRequest = {
        "principal": principal
    }
    if marker is not None:
        input_["marker"] = marker
    if page_size is not None:
        input_["page_size"] = page_size
    if ascending_order is not None:
        input_["ascending_order"] = ascending_order

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output