Skip to content

delete_agent

delete_agent(
    agent_arn: AgentArn, *, config_overrides: Optional[DataSyncClientConfig] = None
) -> DeleteAgentResponse

Removes an DataSync agent resource from your Amazon Web Services account.

Keep in mind that this operation (which can't be undone) doesn't remove the agent's virtual machine (VM) or Amazon EC2 instance from your storage environment. For next steps, you can delete the VM or instance from your storage environment or reuse it to activate a new agent.

Parameters:

  • agent_arn (AgentArn) –

    The Amazon Resource Name (ARN) of the agent to delete. Use the ListAgents operation to return a list of agents for your account and Amazon Web Services Region.

Raises:

Source code in docs_src/capo_datasync/_services/data_sync.py
def delete_agent(
    self,
    agent_arn: "capo_datasync.types.agent_arn.AgentArn",
    *,
    config_overrides: Optional[DataSyncClientConfig] = None,
) -> "capo_datasync.types.delete_agent_response.DeleteAgentResponse":
    """<p>Removes an DataSync agent resource from your Amazon Web Services account.</p> <p>Keep in mind that this operation (which can't be undone) doesn't remove the agent's virtual machine (VM) or Amazon EC2 instance from your storage environment. For next steps, you can delete the VM or instance from your storage environment or reuse it to <a href="https://docs.aws.amazon.com/datasync/latest/userguide/activate-agent.html">activate a new agent</a>.</p>

    Args:
        agent_arn: <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>

    Raises:
        capo_datasync.errors.internal_exception.InternalException: <p>This exception is thrown when an error occurs in the DataSync service.</p>
        capo_datasync.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_datasync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_datasync.types.delete_agent_request.DeleteAgentRequest]",
    ) -> OperationResponse[
        "capo_datasync.types.delete_agent_response.DeleteAgentResponse"
    ]:
        import capo_datasync._operations.fmrs_service.delete_agent

        output, http_response = (
            capo_datasync._operations.fmrs_service.delete_agent.delete_agent(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAgent")
    )
    input_: capo_datasync.types.delete_agent_request.DeleteAgentRequest = {
        "agent_arn": agent_arn
    }

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