Skip to content

list_policy_principals

list_policy_principals(
    policy_name: PolicyName,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    marker: Optional[Marker] = None,
    page_size: Optional[PageSize] = None,
    ascending_order: Optional[AscendingOrder] = None,
) -> ListPolicyPrincipalsResponse

Lists the principals associated with the specified policy.

Note: This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use ListTargetsForPolicy instead.

Requires permission to access the ListPolicyPrincipals action.

Parameters:

  • policy_name (PolicyName) –

    The policy name.

  • 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, the results are returned in ascending creation order.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def list_policy_principals(
    self,
    policy_name: "capo_iot.types.policy_name.PolicyName",
    *,
    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_policy_principals_response.ListPolicyPrincipalsResponse":
    """<p>Lists the principals associated with the specified policy.</p> <p> <b>Note:</b> This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use <a>ListTargetsForPolicy</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">ListPolicyPrincipals</a> action.</p>

    Args:
        policy_name: <p>The policy name.</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, the 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_policy_principals_request.ListPolicyPrincipalsRequest]",
    ) -> OperationResponse[
        "capo_iot.types.list_policy_principals_response.ListPolicyPrincipalsResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_policy_principals

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPolicyPrincipals")
    )
    input_: capo_iot.types.list_policy_principals_request.ListPolicyPrincipalsRequest = {
        "policy_name": policy_name
    }
    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