Skip to content

list_instances async

list_instances(
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResult10] = None,
) -> ListInstancesResponse

This API is in preview release for Connect Customer and is subject to change.

Return a list of instances which are in active state, creation-in-progress state, and failed state. Instances that aren't successfully created (they are in a failed state) are returned only for 24 hours after the CreateInstance API was invoked.

Parameters:

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

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

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

    The maximum number of results to return per page.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def list_instances(
    self,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    next_token: Optional["capo_connect.types.next_token.NextToken"] = None,
    max_results: Optional["capo_connect.types.max_result10.MaxResult10"] = None,
) -> "capo_connect.types.list_instances_response.ListInstancesResponse":
    """<p>This API is in preview release for Connect Customer and is subject to change.</p> <p>Return a list of instances which are in active state, creation-in-progress state, and failed state. Instances that aren't successfully created (they are in a failed state) are returned only for 24 hours after the CreateInstance API was invoked.</p>

    Args:
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
        max_results: <p>The maximum number of results to return per page.</p>

    Raises:
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.list_instances_request.ListInstancesRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.list_instances_response.ListInstancesResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.list_instances

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.list_instances.async_list_instances(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_connect.types.list_instances_response.ListInstancesResponse",
    ) -> dict[str, Any]:
        import capo_connect.types.list_instances_response

        return capo_connect.types.list_instances_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListInstances", redact_output=_redact_output),
    )
    input_: capo_connect.types.list_instances_request.ListInstancesRequest = {}
    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