Skip to content

update_interruptible_capacity_reservation_allocation async

update_interruptible_capacity_reservation_allocation(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_reservation_id: Optional[CapacityReservationId] = None,
    target_instance_count: Optional[Integer] = None,
    dry_run: Optional[Boolean] = None,
    zero_size_preference: Optional[ZeroSizePreference] = None,
) -> UpdateInterruptibleCapacityReservationAllocationResult

Modifies the number of instances allocated to an interruptible reservation, allowing you to add more capacity or reclaim capacity to your source Capacity Reservation.

Parameters:

  • capacity_reservation_id (Optional[CapacityReservationId], default: None ) –

    The ID of the source Capacity Reservation containing the interruptible allocation to modify.

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

    The new number of instances to allocate. Enter a higher number to add more capacity to share, or a lower number to reclaim capacity to your source Capacity Reservation.

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

  • zero_size_preference (Optional[ZeroSizePreference], default: None ) –

    Specifies the updated behavior for the interruptible Capacity Reservation when you reduce its allocation to zero instances. Specify retain to keep the interruptible Capacity Reservation active at zero capacity so that you can allocate instances to it again later. Specify default to cancel the interruptible Capacity Reservation and return the capacity to your source Capacity Reservation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def update_interruptible_capacity_reservation_allocation(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_reservation_id: Optional[
        "capo_ec2.types.capacity_reservation_id.CapacityReservationId"
    ] = None,
    target_instance_count: Optional["capo_ec2.types.integer.Integer"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    zero_size_preference: Optional[
        "capo_ec2.types.zero_size_preference.ZeroSizePreference"
    ] = None,
) -> "capo_ec2.types.update_interruptible_capacity_reservation_allocation_result.UpdateInterruptibleCapacityReservationAllocationResult":
    """<p> Modifies the number of instances allocated to an interruptible reservation, allowing you to add more capacity or reclaim capacity to your source Capacity Reservation. </p>

    Args:
        capacity_reservation_id: <p> The ID of the source Capacity Reservation containing the interruptible allocation to modify. </p>
        target_instance_count: <p> The new number of instances to allocate. Enter a higher number to add more capacity to share, or a lower number to reclaim capacity to your source Capacity Reservation. </p>
        dry_run: <p> Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. </p>
        zero_size_preference: <p> Specifies the updated behavior for the interruptible Capacity Reservation when you reduce its allocation to zero instances. Specify <code>retain</code> to keep the interruptible Capacity Reservation active at zero capacity so that you can allocate instances to it again later. Specify <code>default</code> to cancel the interruptible Capacity Reservation and return the capacity to your source Capacity Reservation. </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.update_interruptible_capacity_reservation_allocation_request.UpdateInterruptibleCapacityReservationAllocationRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.update_interruptible_capacity_reservation_allocation_result.UpdateInterruptibleCapacityReservationAllocationResult"
    ]:
        import capo_ec2._operations.amazon_ec2.update_interruptible_capacity_reservation_allocation

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

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateInterruptibleCapacityReservationAllocation"),
    )
    input_: capo_ec2.types.update_interruptible_capacity_reservation_allocation_request.UpdateInterruptibleCapacityReservationAllocationRequest = {}
    if capacity_reservation_id is not None:
        input_["capacity_reservation_id"] = capacity_reservation_id
    if target_instance_count is not None:
        input_["target_instance_count"] = target_instance_count
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if zero_size_preference is not None:
        input_["zero_size_preference"] = zero_size_preference

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