Skip to content

list_principals_for_policy async

list_principals_for_policy(
    account_id: AwsAccountId,
    policy_arn: PolicyArn,
    *,
    config_overrides: Optional[AsyncQuickSightClientConfig] = None,
    principal_type: Optional[PrincipalType] = None,
    max_results: Optional[ListPrincipalsForPolicyRequestMaxResultsInteger] = None,
    next_token: Optional[ListPrincipalsForPolicyRequestNextTokenString] = None,
) -> ListPrincipalsForPolicyResponse

Lists the Amazon Quick Sight principals that have a governance policy. This operation returns paginated results. A page can contain fewer results than MaxResults, or none, and still include a NextToken. Continue to call the operation until the response doesn't include a NextToken. We recommend that you use pagination to make sure that the operation returns quickly and successfully.

Results are eventually consistent and might not reflect recent changes. If the policy has no assignments, the response contains an empty Principals list. If the policy doesn't exist, the request fails with a ResourceNotFoundException.

Parameters:

  • account_id (AwsAccountId) –

    The ID of the Amazon Web Services account that contains the policy.

  • policy_arn (PolicyArn) –

    The ARN of the policy.

  • principal_type (Optional[PrincipalType], default: None ) –

    An optional filter that limits the results to principals of the specified type. If you don't specify a value, the operation returns principals of all types. You can specify one of the following values:

    • USER – An Amazon Quick Sight user.

    • GROUP – An Amazon Quick Sight group.

    • ACCOUNT – The Amazon Quick Sight account.

  • max_results (Optional[ListPrincipalsForPolicyRequestMaxResultsInteger], default: None ) –

    The maximum number of results to return in a single call. Valid range is 1–100. If you don't specify a value, the operation returns up to 100 results.

  • next_token (Optional[ListPrincipalsForPolicyRequestNextTokenString], default: None ) –

    The token returned by a previous call. Use it to get the next page of results.

Raises:

  • AccessDeniedException –

    You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.

  • InternalFailureException –

    An internal failure occurred.

  • ResourceNotFoundException –

    One or more resources can't be found.

  • ThrottlingException –

    Access is throttled.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_quicksight/_services/async_quick_sight.py
async def list_principals_for_policy(
    self,
    account_id: "capo_quicksight.types.aws_account_id.AwsAccountId",
    policy_arn: "capo_quicksight.types.policy_arn.PolicyArn",
    *,
    config_overrides: Optional[AsyncQuickSightClientConfig] = None,
    principal_type: Optional[
        "capo_quicksight.types.principal_type.PrincipalType"
    ] = None,
    max_results: Optional[
        "capo_quicksight.types.list_principals_for_policy_request_max_results_integer.ListPrincipalsForPolicyRequestMaxResultsInteger"
    ] = None,
    next_token: Optional[
        "capo_quicksight.types.list_principals_for_policy_request_next_token_string.ListPrincipalsForPolicyRequestNextTokenString"
    ] = None,
) -> "capo_quicksight.types.list_principals_for_policy_response.ListPrincipalsForPolicyResponse":
    """<p>Lists the Amazon Quick Sight principals that have a governance policy. This operation returns paginated results. A page can contain fewer results than <code>MaxResults</code>, or none, and still include a <code>NextToken</code>. Continue to call the operation until the response doesn't include a <code>NextToken</code>. We recommend that you use pagination to make sure that the operation returns quickly and successfully.</p> <p>Results are eventually consistent and might not reflect recent changes. If the policy has no assignments, the response contains an empty <code>Principals</code> list. If the policy doesn't exist, the request fails with a <code>ResourceNotFoundException</code>.</p>

    Args:
        account_id: <p>The ID of the Amazon Web Services account that contains the policy.</p>
        policy_arn: <p>The ARN of the policy.</p>
        principal_type: <p>An optional filter that limits the results to principals of the specified type. If you don't specify a value, the operation returns principals of all types. You can specify one of the following values:</p> <ul> <li> <p> <code>USER</code> – An Amazon Quick Sight user.</p> </li> <li> <p> <code>GROUP</code> – An Amazon Quick Sight group.</p> </li> <li> <p> <code>ACCOUNT</code> – The Amazon Quick Sight account.</p> </li> </ul>
        max_results: <p>The maximum number of results to return in a single call. Valid range is 1–100. If you don't specify a value, the operation returns up to 100 results.</p>
        next_token: <p>The token returned by a previous call. Use it to get the next page of results.</p>

    Raises:
        capo_quicksight.errors.access_denied_exception.AccessDeniedException: <p>You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.</p>
        capo_quicksight.errors.internal_failure_exception.InternalFailureException: <p>An internal failure occurred.</p>
        capo_quicksight.errors.resource_not_found_exception.ResourceNotFoundException: <p>One or more resources can't be found.</p>
        capo_quicksight.errors.throttling_exception.ThrottlingException: <p>Access is throttled.</p>
        capo_quicksight.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_quicksight.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_quicksight.types.list_principals_for_policy_request.ListPrincipalsForPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_quicksight.types.list_principals_for_policy_response.ListPrincipalsForPolicyResponse"
    ]:
        import capo_quicksight._operations.quick_sight_20180401.list_principals_for_policy

        (
            output,
            http_response,
        ) = await capo_quicksight._operations.quick_sight_20180401.list_principals_for_policy.async_list_principals_for_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPrincipalsForPolicy")
    )
    input_: capo_quicksight.types.list_principals_for_policy_request.ListPrincipalsForPolicyRequest = {
        "account_id": account_id,
        "policy_arn": policy_arn,
    }
    if principal_type is not None:
        input_["principal_type"] = principal_type
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output