Skip to content

describe_capacity_block_offerings async

describe_capacity_block_offerings(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    instance_type: Optional[String] = None,
    instance_count: Optional[Integer] = None,
    start_date_range: Optional[MillisecondDateTime] = None,
    end_date_range: Optional[MillisecondDateTime] = None,
    capacity_duration_hours: Optional[Integer] = None,
    next_token: Optional[String] = None,
    max_results: Optional[DescribeCapacityBlockOfferingsMaxResults] = None,
    ultraserver_type: Optional[String] = None,
    ultraserver_count: Optional[Integer] = None,
    all_availability_zones: Optional[Boolean] = None,
) -> DescribeCapacityBlockOfferingsResult

Describes Capacity Block offerings available for purchase in the Amazon Web Services Region that you're currently using. With Capacity Blocks, you can purchase a specific GPU instance type or EC2 UltraServer for a period of time.

To search for an available Capacity Block offering, you specify a reservation duration and instance count.

Parameters:

  • 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.

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

    The type of instance for which the Capacity Block offering reserves capacity.

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

    The number of instances for which to reserve capacity. Each Capacity Block can have up to 64 instances, and you can have up to 256 instances across Capacity Blocks.

  • start_date_range (Optional[MillisecondDateTime], default: None ) –

    The earliest start date for the Capacity Block offering.

  • end_date_range (Optional[MillisecondDateTime], default: None ) –

    The latest end date for the Capacity Block offering.

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

    The reservation duration for the Capacity Block, in hours. You must specify the duration in 1-day increments up 14 days, and in 7-day increments up to 182 days.

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

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

  • max_results (Optional[DescribeCapacityBlockOfferingsMaxResults], 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.

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

    The EC2 UltraServer type of the Capacity Block offerings.

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

    The number of EC2 UltraServers in the offerings.

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

    Include all Availability Zones and Local Zones, regardless of your opt-in status. If you do not use this parameter, the results include available offerings from all Availability Zones in the Amazon Web Services Region and Local Zones you are opted into.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_capacity_block_offerings(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    instance_type: Optional["capo_ec2.types.string.String"] = None,
    instance_count: Optional["capo_ec2.types.integer.Integer"] = None,
    start_date_range: Optional[
        "capo_ec2.types.millisecond_date_time.MillisecondDateTime"
    ] = None,
    end_date_range: Optional[
        "capo_ec2.types.millisecond_date_time.MillisecondDateTime"
    ] = None,
    capacity_duration_hours: Optional["capo_ec2.types.integer.Integer"] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    max_results: Optional[
        "capo_ec2.types.describe_capacity_block_offerings_max_results.DescribeCapacityBlockOfferingsMaxResults"
    ] = None,
    ultraserver_type: Optional["capo_ec2.types.string.String"] = None,
    ultraserver_count: Optional["capo_ec2.types.integer.Integer"] = None,
    all_availability_zones: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.describe_capacity_block_offerings_result.DescribeCapacityBlockOfferingsResult":
    """<p>Describes Capacity Block offerings available for purchase in the Amazon Web Services Region that you're currently using. With Capacity Blocks, you can purchase a specific GPU instance type or EC2 UltraServer for a period of time.</p> <p>To search for an available Capacity Block offering, you specify a reservation duration and instance count.</p>

    Args:
        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>
        instance_type: <p>The type of instance for which the Capacity Block offering reserves capacity.</p>
        instance_count: <p>The number of instances for which to reserve capacity. Each Capacity Block can have up to 64 instances, and you can have up to 256 instances across Capacity Blocks.</p>
        start_date_range: <p>The earliest start date for the Capacity Block offering.</p>
        end_date_range: <p>The latest end date for the Capacity Block offering.</p>
        capacity_duration_hours: <p>The reservation duration for the Capacity Block, in hours. You must specify the duration in 1-day increments up 14 days, and in 7-day increments up to 182 days.</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>
        ultraserver_type: <p>The EC2 UltraServer type of the Capacity Block offerings.</p>
        ultraserver_count: <p>The number of EC2 UltraServers in the offerings.</p>
        all_availability_zones: <p> Include all Availability Zones and Local Zones, regardless of your opt-in status. If you do not use this parameter, the results include available offerings from all Availability Zones in the Amazon Web Services Region and Local Zones you are opted into. </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_block_offerings_request.DescribeCapacityBlockOfferingsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_capacity_block_offerings_result.DescribeCapacityBlockOfferingsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_capacity_block_offerings

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeCapacityBlockOfferings")
    )
    input_: capo_ec2.types.describe_capacity_block_offerings_request.DescribeCapacityBlockOfferingsRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if instance_type is not None:
        input_["instance_type"] = instance_type
    if instance_count is not None:
        input_["instance_count"] = instance_count
    if start_date_range is not None:
        input_["start_date_range"] = start_date_range
    if end_date_range is not None:
        input_["end_date_range"] = end_date_range
    if capacity_duration_hours is not None:
        input_["capacity_duration_hours"] = capacity_duration_hours
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if ultraserver_type is not None:
        input_["ultraserver_type"] = ultraserver_type
    if ultraserver_count is not None:
        input_["ultraserver_count"] = ultraserver_count
    if all_availability_zones is not None:
        input_["all_availability_zones"] = all_availability_zones

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