Skip to content

list_servers async

list_servers(
    *,
    config_overrides: Optional[AsyncMigrationHubStrategyClientConfig] = None,
    server_criteria: Optional[ServerCriteria] = None,
    filter_value: Optional[String] = None,
    sort: Optional[SortOrder] = None,
    group_id_filter: Optional[GroupIds] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResult] = None,
) -> ListServersResponse

Returns a list of all the servers.

Parameters:

  • server_criteria (Optional[ServerCriteria], default: None ) –

    Criteria for filtering servers.

  • filter_value (Optional[String], default: None ) –

    Specifies the filter value, which is based on the type of server criteria. For example, if serverCriteria is OS_NAME, and the filterValue is equal to WindowsServer, then ListServers returns all of the servers matching the OS name WindowsServer.

  • sort (Optional[SortOrder], default: None ) –

    Specifies whether to sort by ascending (ASC) or descending (DESC) order.

  • group_id_filter (Optional[GroupIds], default: None ) –

    Specifies the group ID to filter on.

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

    The token from a previous call that you use to retrieve the next set of results. For example, if a previous call to this action returned 100 items, but you set maxResults to 10. You'll receive a set of 10 results along with a token. You then use the returned token to retrieve the next set of 10.

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

    The maximum number of items to include in the response. The maximum value is 100.

Raises:

Source code in docs_src/capo_migrationhubstrategy/_services/async_migration_hub_strategy.py
async def list_servers(
    self,
    *,
    config_overrides: Optional[AsyncMigrationHubStrategyClientConfig] = None,
    server_criteria: Optional[
        "capo_migrationhubstrategy.types.server_criteria.ServerCriteria"
    ] = None,
    filter_value: Optional["capo_migrationhubstrategy.types.string.String"] = None,
    sort: Optional["capo_migrationhubstrategy.types.sort_order.SortOrder"] = None,
    group_id_filter: Optional[
        "capo_migrationhubstrategy.types.group_ids.GroupIds"
    ] = None,
    next_token: Optional[
        "capo_migrationhubstrategy.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_migrationhubstrategy.types.max_result.MaxResult"
    ] = None,
) -> "capo_migrationhubstrategy.types.list_servers_response.ListServersResponse":
    """<p> Returns a list of all the servers. </p>

    Args:
        server_criteria: <p> Criteria for filtering servers. </p>
        filter_value: <p> Specifies the filter value, which is based on the type of server criteria. For example, if <code>serverCriteria</code> is <code>OS_NAME</code>, and the <code>filterValue</code> is equal to <code>WindowsServer</code>, then <code>ListServers</code> returns all of the servers matching the OS name <code>WindowsServer</code>. </p>
        sort: <p> Specifies whether to sort by ascending (<code>ASC</code>) or descending (<code>DESC</code>) order. </p>
        group_id_filter: <p> Specifies the group ID to filter on. </p>
        next_token: <p> The token from a previous call that you use to retrieve the next set of results. For example, if a previous call to this action returned 100 items, but you set <code>maxResults</code> to 10. You'll receive a set of 10 results along with a token. You then use the returned token to retrieve the next set of 10. </p>
        max_results: <p> The maximum number of items to include in the response. The maximum value is 100. </p>

    Raises:
        capo_migrationhubstrategy.errors.access_denied_exception.AccessDeniedException: <p> The user does not have permission to perform the action. Check the AWS Identity and Access Management (IAM) policy associated with this user.</p>
        capo_migrationhubstrategy.errors.internal_server_exception.InternalServerException: <p> The server experienced an internal error. Try again. </p>
        capo_migrationhubstrategy.errors.throttling_exception.ThrottlingException: <p> The request was denied due to request throttling. </p>
        capo_migrationhubstrategy.errors.validation_exception.ValidationException: <p> The request body isn't valid. </p>
        capo_migrationhubstrategy.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_migrationhubstrategy.types.list_servers_request.ListServersRequest]",
    ) -> AsyncOperationResponse[
        "capo_migrationhubstrategy.types.list_servers_response.ListServersResponse"
    ]:
        import capo_migrationhubstrategy._operations.aws_migration_hub_strategy_recommendation.list_servers

        (
            output,
            http_response,
        ) = await capo_migrationhubstrategy._operations.aws_migration_hub_strategy_recommendation.list_servers.async_list_servers(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListServers")
    )
    input_: capo_migrationhubstrategy.types.list_servers_request.ListServersRequest = {}
    if server_criteria is not None:
        input_["server_criteria"] = server_criteria
    if filter_value is not None:
        input_["filter_value"] = filter_value
    if sort is not None:
        input_["sort"] = sort
    if group_id_filter is not None:
        input_["group_id_filter"] = group_id_filter
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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