Skip to content

cancel_declarative_policies_report

cancel_declarative_policies_report(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    report_id: Optional[DeclarativePoliciesReportId] = None,
) -> CancelDeclarativePoliciesReportResult

Cancels the generation of an account status report.

You can only cancel a report while it has the running status. Reports with other statuses (complete, cancelled, or error) can't be canceled.

For more information, see Generating the account status report for declarative policies in the Amazon Web Services Organizations User Guide.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • report_id (Optional[DeclarativePoliciesReportId], default: None ) –

    The ID of the report.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def cancel_declarative_policies_report(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    report_id: Optional[
        "capo_ec2.types.declarative_policies_report_id.DeclarativePoliciesReportId"
    ] = None,
) -> "capo_ec2.types.cancel_declarative_policies_report_result.CancelDeclarativePoliciesReportResult":
    """<p>Cancels the generation of an account status report.</p> <p>You can only cancel a report while it has the <code>running</code> status. Reports with other statuses (<code>complete</code>, <code>cancelled</code>, or <code>error</code>) can't be canceled.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_declarative_status-report.html">Generating the account status report for declarative policies</a> in the <i>Amazon Web Services Organizations User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        report_id: <p>The ID of the report.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.cancel_declarative_policies_report_request.CancelDeclarativePoliciesReportRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.cancel_declarative_policies_report_result.CancelDeclarativePoliciesReportResult"
    ]:
        import capo_ec2._operations.amazon_ec2.cancel_declarative_policies_report

        output, http_response = (
            capo_ec2._operations.amazon_ec2.cancel_declarative_policies_report.cancel_declarative_policies_report(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelDeclarativePoliciesReport")
    )
    input_: capo_ec2.types.cancel_declarative_policies_report_request.CancelDeclarativePoliciesReportRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if report_id is not None:
        input_["report_id"] = report_id

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