Skip to content

list_locations async

list_locations(
    *,
    config_overrides: Optional[AsyncDataSyncClientConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
    filters: Optional[LocationFilters] = None,
) -> ListLocationsResponse

Returns a list of source and destination locations.

If you have more locations than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a token that you can specify in your next request to fetch the next page of locations.

Parameters:

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of locations to return.

  • next_token (Optional[NextToken], default: None ) –

    An opaque string that indicates the position at which to begin the next list of locations.

  • filters (Optional[LocationFilters], default: None ) –

    You can use API filters to narrow down the list of resources returned by ListLocations. For example, to retrieve all tasks on a specific source location, you can use ListLocations with filter name LocationType S3 and Operator Equals.

Raises:

Source code in docs_src/capo_datasync/_services/async_data_sync.py
async def list_locations(
    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,
    filters: Optional[
        "capo_datasync.types.location_filters.LocationFilters"
    ] = None,
) -> "capo_datasync.types.list_locations_response.ListLocationsResponse":
    """<p>Returns a list of source and destination locations.</p> <p>If you have more locations than are returned in a response (that is, the response returns only a truncated list of your agents), the response contains a token that you can specify in your next request to fetch the next page of locations.</p>

    Args:
        max_results: <p>The maximum number of locations to return.</p>
        next_token: <p>An opaque string that indicates the position at which to begin the next list of locations.</p>
        filters: <p>You can use API filters to narrow down the list of resources returned by <code>ListLocations</code>. For example, to retrieve all tasks on a specific source location, you can use <code>ListLocations</code> with filter name <code>LocationType S3</code> and <code>Operator Equals</code>.</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_locations_request.ListLocationsRequest]",
    ) -> AsyncOperationResponse[
        "capo_datasync.types.list_locations_response.ListLocationsResponse"
    ]:
        import capo_datasync._operations.fmrs_service.list_locations

        (
            output,
            http_response,
        ) = await capo_datasync._operations.fmrs_service.list_locations.async_list_locations(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListLocations")
    )
    input_: capo_datasync.types.list_locations_request.ListLocationsRequest = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if filters is not None:
        input_["filters"] = filters

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