Skip to content

start_policy_generation async

start_policy_generation(
    policy_generation_details: PolicyGenerationDetails,
    *,
    config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None,
    cloud_trail_details: Optional[CloudTrailDetails] = None,
    client_token: Optional[str] = None,
) -> StartPolicyGenerationResponse

Starts the policy generation request.

Parameters:

  • policy_generation_details (PolicyGenerationDetails) –

    Contains the ARN of the IAM entity (user or role) for which you are generating a policy.

  • cloud_trail_details (Optional[CloudTrailDetails], default: None ) –

    A CloudTrailDetails object that contains details about a Trail that you want to analyze to generate policies.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.

    If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.

Raises:

Source code in docs_src/capo_accessanalyzer/_services/async_access_analyzer.py
async def start_policy_generation(
    self,
    policy_generation_details: "capo_accessanalyzer.types.policy_generation_details.PolicyGenerationDetails",
    *,
    config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None,
    cloud_trail_details: Optional[
        "capo_accessanalyzer.types.cloud_trail_details.CloudTrailDetails"
    ] = None,
    client_token: Optional[str] = None,
) -> "capo_accessanalyzer.types.start_policy_generation_response.StartPolicyGenerationResponse":
    """<p>Starts the policy generation request.</p>

    Args:
        policy_generation_details: <p>Contains the ARN of the IAM entity (user or role) for which you are generating a policy.</p>
        cloud_trail_details: <p>A <code>CloudTrailDetails</code> object that contains details about a <code>Trail</code> that you want to analyze to generate policies.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p> <p>If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.</p>

    Raises:
        capo_accessanalyzer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_accessanalyzer.errors.conflict_exception.ConflictException: <p>A conflict exception error.</p>
        capo_accessanalyzer.errors.internal_server_exception.InternalServerException: <p>Internal server error.</p>
        capo_accessanalyzer.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Service quote met 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_accessanalyzer.types.start_policy_generation_request.StartPolicyGenerationRequest]",
    ) -> AsyncOperationResponse[
        "capo_accessanalyzer.types.start_policy_generation_response.StartPolicyGenerationResponse"
    ]:
        import capo_accessanalyzer._operations.access_analyzer.start_policy_generation

        (
            output,
            http_response,
        ) = await capo_accessanalyzer._operations.access_analyzer.start_policy_generation.async_start_policy_generation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartPolicyGeneration")
    )
    input_: capo_accessanalyzer.types.start_policy_generation_request.StartPolicyGenerationRequest = {
        "policy_generation_details": policy_generation_details
    }
    if cloud_trail_details is not None:
        input_["cloud_trail_details"] = cloud_trail_details
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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