Skip to content

cancel_policy_generation async

cancel_policy_generation(
    job_id: JobId, *, config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None
) -> CancelPolicyGenerationResponse

Cancels the requested policy generation.

Parameters:

  • job_id (JobId) –

    The JobId that is returned by the StartPolicyGeneration operation. The JobId can be used with GetGeneratedPolicy to retrieve the generated policies or used with CancelPolicyGeneration to cancel the policy generation request.

Raises:

Source code in docs_src/capo_accessanalyzer/_services/async_access_analyzer.py
async def cancel_policy_generation(
    self,
    job_id: "capo_accessanalyzer.types.job_id.JobId",
    *,
    config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None,
) -> "capo_accessanalyzer.types.cancel_policy_generation_response.CancelPolicyGenerationResponse":
    """<p>Cancels the requested policy generation.</p>

    Args:
        job_id: <p>The <code>JobId</code> that is returned by the <code>StartPolicyGeneration</code> operation. The <code>JobId</code> can be used with <code>GetGeneratedPolicy</code> to retrieve the generated policies or used with <code>CancelPolicyGeneration</code> to cancel the policy generation request.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_accessanalyzer.types.cancel_policy_generation_request.CancelPolicyGenerationRequest]",
    ) -> AsyncOperationResponse[
        "capo_accessanalyzer.types.cancel_policy_generation_response.CancelPolicyGenerationResponse"
    ]:
        import capo_accessanalyzer._operations.access_analyzer.cancel_policy_generation

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelPolicyGeneration")
    )
    input_: capo_accessanalyzer.types.cancel_policy_generation_request.CancelPolicyGenerationRequest = {
        "job_id": job_id
    }

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