Skip to content

describe_capacity_blocks async

describe_capacity_blocks(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_block_ids: Optional[CapacityBlockIds] = None,
    next_token: Optional[String] = None,
    max_results: Optional[DescribeCapacityBlocksMaxResults] = None,
    filters: Optional[FilterList] = None,
    dry_run: Optional[Boolean] = None,
) -> DescribeCapacityBlocksResult

Describes details about Capacity Blocks in the Amazon Web Services Region that you're currently using.

Parameters:

  • capacity_block_ids (Optional[CapacityBlockIds], default: None ) –

    The IDs of the Capacity Blocks.

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

    The token to use to retrieve the next page of results.

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

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

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

    One or more filters.

    • capacity-block-id - The ID of the Capacity Block.

    • ultraserver-type - The Capacity Block type. The type can be instances or ultraservers.

    • availability-zone - The Availability Zone of the Capacity Block.

    • start-date - The date and time at which the Capacity Block was started.

    • end-date - The date and time at which the Capacity Block expires. When a Capacity Block expires, all instances in the Capacity Block are terminated.

    • create-date - The date and time at which the Capacity Block was created.

    • state - The state of the Capacity Block (active | expired | unavailable | cancelled | failed | scheduled | payment-pending | payment-failed).

    • tags - The tags assigned to the Capacity Block.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_capacity_blocks(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_block_ids: Optional[
        "capo_ec2.types.capacity_block_ids.CapacityBlockIds"
    ] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    max_results: Optional[
        "capo_ec2.types.describe_capacity_blocks_max_results.DescribeCapacityBlocksMaxResults"
    ] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.describe_capacity_blocks_result.DescribeCapacityBlocksResult":
    """<p>Describes details about Capacity Blocks in the Amazon Web Services Region that you're currently using.</p>

    Args:
        capacity_block_ids: <p>The IDs of the Capacity Blocks.</p>
        next_token: <p>The token to use to retrieve the next page of results.</p>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        filters: <p> One or more filters. </p> <ul> <li> <p> <code>capacity-block-id</code> - The ID of the Capacity Block.</p> </li> <li> <p> <code>ultraserver-type</code> - The Capacity Block type. The type can be <code>instances</code> or <code>ultraservers</code>.</p> </li> <li> <p> <code>availability-zone</code> - The Availability Zone of the Capacity Block.</p> </li> <li> <p> <code>start-date</code> - The date and time at which the Capacity Block was started.</p> </li> <li> <p> <code>end-date</code> - The date and time at which the Capacity Block expires. When a Capacity Block expires, all instances in the Capacity Block are terminated.</p> </li> <li> <p> <code>create-date</code> - The date and time at which the Capacity Block was created.</p> </li> <li> <p> <code>state</code> - The state of the Capacity Block (<code>active</code> | <code>expired</code> | <code>unavailable</code> | <code>cancelled</code> | <code>failed</code> | <code>scheduled</code> | <code>payment-pending</code> | <code>payment-failed</code>).</p> </li> <li> <p> <code>tags</code> - The tags assigned to the Capacity Block.</p> </li> </ul>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_capacity_blocks_request.DescribeCapacityBlocksRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_capacity_blocks_result.DescribeCapacityBlocksResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_capacity_blocks

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_capacity_blocks.async_describe_capacity_blocks(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeCapacityBlocks")
    )
    input_: capo_ec2.types.describe_capacity_blocks_request.DescribeCapacityBlocksRequest = {}
    if capacity_block_ids is not None:
        input_["capacity_block_ids"] = capacity_block_ids
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters
    if dry_run is not None:
        input_["dry_run"] = dry_run

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