Skip to content

list_policy_generations

list_policy_generations(
    *,
    config_overrides: Optional[AccessAnalyzerClientConfig] = None,
    principal_arn: Optional[PrincipalArn] = None,
    max_results: Optional[int] = None,
    next_token: Optional[Token] = None,
) -> ListPolicyGenerationsResponse

Lists all of the policy generations requested in the last seven days.

Parameters:

  • principal_arn (Optional[PrincipalArn], default: None ) –

    The ARN of the IAM entity (user or role) for which you are generating a policy. Use this with ListGeneratedPolicies to filter the results to only include results for a specific principal.

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

    The maximum number of results to return in the response.

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

    A token used for pagination of results returned.

Raises:

Source code in docs_src/capo_accessanalyzer/_services/access_analyzer.py
def list_policy_generations(
    self,
    *,
    config_overrides: Optional[AccessAnalyzerClientConfig] = None,
    principal_arn: Optional[
        "capo_accessanalyzer.types.principal_arn.PrincipalArn"
    ] = None,
    max_results: Optional[int] = None,
    next_token: Optional["capo_accessanalyzer.types.token.Token"] = None,
) -> "capo_accessanalyzer.types.list_policy_generations_response.ListPolicyGenerationsResponse":
    """<p>Lists all of the policy generations requested in the last seven days.</p>

    Args:
        principal_arn: <p>The ARN of the IAM entity (user or role) for which you are generating a policy. Use this with <code>ListGeneratedPolicies</code> to filter the results to only include results for a specific principal.</p>
        max_results: <p>The maximum number of results to return in the response.</p>
        next_token: <p>A token used for pagination of results returned.</p>

    Raises:
        capo_accessanalyzer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_accessanalyzer.errors.internal_server_exception.InternalServerException: <p>Internal server error.</p>
        capo_accessanalyzer.errors.throttling_exception.ThrottlingException: <p>Throttling limit exceeded error.</p>
        capo_accessanalyzer.errors.validation_exception.ValidationException: <p>Validation exception error.</p>
        capo_accessanalyzer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_accessanalyzer.types.list_policy_generations_request.ListPolicyGenerationsRequest]",
    ) -> OperationResponse[
        "capo_accessanalyzer.types.list_policy_generations_response.ListPolicyGenerationsResponse"
    ]:
        import capo_accessanalyzer._operations.access_analyzer.list_policy_generations

        output, http_response = (
            capo_accessanalyzer._operations.access_analyzer.list_policy_generations.list_policy_generations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPolicyGenerations")
    )
    input_: capo_accessanalyzer.types.list_policy_generations_request.ListPolicyGenerationsRequest = {}
    if principal_arn is not None:
        input_["principal_arn"] = principal_arn
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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