Skip to content

terminate_recovery_instances

terminate_recovery_instances(
    recovery_instance_i_ds: RecoveryInstancesForTerminationRequest,
    *,
    config_overrides: Optional[drsClientConfig] = None,
) -> TerminateRecoveryInstancesResponse

Initiates a Job for terminating the EC2 resources associated with the specified Recovery Instances, and then will delete the Recovery Instances from the Elastic Disaster Recovery service.

Parameters:

Raises:

Source code in docs_src/capo_drs/_services/drs.py
def terminate_recovery_instances(
    self,
    recovery_instance_i_ds: "capo_drs.types.recovery_instances_for_termination_request.RecoveryInstancesForTerminationRequest",
    *,
    config_overrides: Optional[drsClientConfig] = None,
) -> "capo_drs.types.terminate_recovery_instances_response.TerminateRecoveryInstancesResponse":
    """<p>Initiates a Job for terminating the EC2 resources associated with the specified Recovery Instances, and then will delete the Recovery Instances from the Elastic Disaster Recovery service.</p>

    Args:
        recovery_instance_i_ds: <p>The IDs of the Recovery Instances that should be terminated.</p>

    Raises:
        capo_drs.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the target resource.</p>
        capo_drs.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_drs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request could not be completed because its exceeded the service quota.</p>
        capo_drs.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_drs.errors.uninitialized_account_exception.UninitializedAccountException: <p>The account performing the request has not been initialized.</p>
        capo_drs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_drs.types.terminate_recovery_instances_request.TerminateRecoveryInstancesRequest]",
    ) -> OperationResponse[
        "capo_drs.types.terminate_recovery_instances_response.TerminateRecoveryInstancesResponse"
    ]:
        import capo_drs._operations.elastic_disaster_recovery_service.terminate_recovery_instances

        output, http_response = (
            capo_drs._operations.elastic_disaster_recovery_service.terminate_recovery_instances.terminate_recovery_instances(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_drs.types.terminate_recovery_instances_response.TerminateRecoveryInstancesResponse",
    ) -> dict[str, Any]:
        import capo_drs.types.terminate_recovery_instances_response

        return (
            capo_drs.types.terminate_recovery_instances_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "TerminateRecoveryInstances", redact_output=_redact_output
        ),
    )
    input_: capo_drs.types.terminate_recovery_instances_request.TerminateRecoveryInstancesRequest = {
        "recovery_instance_i_ds": recovery_instance_i_ds
    }

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