Skip to content

list_consumable_resources async

list_consumable_resources(
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    filters: Optional[ListConsumableResourcesFilterList] = None,
    max_results: Optional[Integer] = None,
    next_token: Optional[String] = None,
) -> ListConsumableResourcesResponse

Returns a list of Batch consumable resources.

Parameters:

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

    The filters to apply to the consumable resource list query. If used, only those consumable resources that match the filter are listed. Filter names and values can be:

    • name: CONSUMABLE_RESOURCE_NAME

      values: case-insensitive matches for the consumable resource name. If a filter value ends with an asterisk (*), it matches any consumable resource name that begins with the string before the '*'.

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

    The maximum number of results returned by ListConsumableResources in paginated output. When this parameter is used, ListConsumableResources only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another ListConsumableResources request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListConsumableResources returns up to 100 results and a nextToken value if applicable.

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

    The nextToken value returned from a previous paginated ListConsumableResources request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

    Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.

Raises:

  • ClientException –

    These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To get a list of a consumable resources Returns a list of the consumable resources for your account.

>>> await client.list_consumable_resources(filters=[{'name': 'CONSUMABLE_RESOURCE_NAME', 'values': ['my*']}], max_results=123)
Source code in docs_src/capo_batch/_services/async_batch.py
async def list_consumable_resources(
    self,
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    filters: Optional[
        "capo_batch.types.list_consumable_resources_filter_list.ListConsumableResourcesFilterList"
    ] = None,
    max_results: Optional["capo_batch.types.integer.Integer"] = None,
    next_token: Optional["capo_batch.types.string.String"] = None,
) -> "capo_batch.types.list_consumable_resources_response.ListConsumableResourcesResponse":
    """<p>Returns a list of Batch consumable resources.</p>

    Args:
        filters: <p>The filters to apply to the consumable resource list query. If used, only those consumable resources that match the filter are listed. Filter names and values can be:</p> <ul> <li> <p>name: <code>CONSUMABLE_RESOURCE_NAME </code> </p> <p>values: case-insensitive matches for the consumable resource name. If a filter value ends with an asterisk (*), it matches any consumable resource name that begins with the string before the '*'.</p> </li> </ul>
        max_results: <p>The maximum number of results returned by <code>ListConsumableResources</code> in paginated output. When this parameter is used, <code>ListConsumableResources</code> only returns <code>maxResults</code> results in a single page and a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListConsumableResources</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>ListConsumableResources</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
        next_token: <p>The <code>nextToken</code> value returned from a previous paginated <code>ListConsumableResources</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. This value is <code>null</code> when there are no more results to return.</p> <note> <p>Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>

    Raises:
        capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
        capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get a list of a consumable resources
        Returns a list of the consumable resources for your account.

        >>> await client.list_consumable_resources(filters=[{'name': 'CONSUMABLE_RESOURCE_NAME', 'values': ['my*']}], max_results=123)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_batch.types.list_consumable_resources_request.ListConsumableResourcesRequest]",
    ) -> AsyncOperationResponse[
        "capo_batch.types.list_consumable_resources_response.ListConsumableResourcesResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.list_consumable_resources

        (
            output,
            http_response,
        ) = await capo_batch._operations.aws_batch_v20160810.list_consumable_resources.async_list_consumable_resources(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListConsumableResources")
    )
    input_: capo_batch.types.list_consumable_resources_request.ListConsumableResourcesRequest = {}
    if filters is not None:
        input_["filters"] = filters
    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