Returns a list of DataSync agents that belong to an Amazon Web Services account in the Amazon Web Services Region specified in the request.
With pagination, you can reduce the number of agents returned in a response. If you get a truncated list of agents in a response, the response contains a marker that you can specify in your next request to fetch the next page of agents.
ListAgents is eventually consistent. This means the result of running the operation might not reflect that you just created or deleted an agent. For example, if you create an agent with CreateAgent and then immediately run ListAgents, that agent might not show up in the list right away. In situations like this, you can always confirm whether an agent has been created (or deleted) by using DescribeAgent.
Parameters:
-
max_results
(Optional[MaxResults], default:
None
)
–
Specifies the maximum number of DataSync agents to list in a response. By default, a response shows a maximum of 100 agents.
-
next_token
(Optional[NextToken], default:
None
)
–
Specifies an opaque string that indicates the position to begin the next list of results in the response.
Raises:
Source code in docs_src/capo_datasync/_services/async_data_sync.py
| async def list_agents(
self,
*,
config_overrides: Optional[AsyncDataSyncClientConfig] = None,
max_results: Optional["capo_datasync.types.max_results.MaxResults"] = None,
next_token: Optional["capo_datasync.types.next_token.NextToken"] = None,
) -> "capo_datasync.types.list_agents_response.ListAgentsResponse":
"""<p>Returns a list of DataSync agents that belong to an Amazon Web Services account in the Amazon Web Services Region specified in the request.</p> <p>With pagination, you can reduce the number of agents returned in a response. If you get a truncated list of agents in a response, the response contains a marker that you can specify in your next request to fetch the next page of agents.</p> <p> <code>ListAgents</code> is eventually consistent. This means the result of running the operation might not reflect that you just created or deleted an agent. For example, if you create an agent with <a href="https://docs.aws.amazon.com/datasync/latest/userguide/API_CreateAgent.html">CreateAgent</a> and then immediately run <code>ListAgents</code>, that agent might not show up in the list right away. In situations like this, you can always confirm whether an agent has been created (or deleted) by using <a href="https://docs.aws.amazon.com/datasync/latest/userguide/API_DescribeAgent.html">DescribeAgent</a>.</p>
Args:
max_results: <p>Specifies the maximum number of DataSync agents to list in a response. By default, a response shows a maximum of 100 agents.</p>
next_token: <p>Specifies an opaque string that indicates the position to begin the next list of results in the response.</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.
"""
async def _handler(
req: "AsyncOperationRequest[capo_datasync.types.list_agents_request.ListAgentsRequest]",
) -> AsyncOperationResponse[
"capo_datasync.types.list_agents_response.ListAgentsResponse"
]:
import capo_datasync._operations.fmrs_service.list_agents
(
output,
http_response,
) = await capo_datasync._operations.fmrs_service.list_agents.async_list_agents(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListAgents")
)
input_: capo_datasync.types.list_agents_request.ListAgentsRequest = {}
if max_results is not None:
input_["max_results"] = max_results
if next_token is not None:
input_["next_token"] = next_token
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|