Skip to content

modify_capacity_reservation_fleet

modify_capacity_reservation_fleet(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    capacity_reservation_fleet_id: Optional[CapacityReservationFleetId] = None,
    total_target_capacity: Optional[Integer] = None,
    end_date: Optional[MillisecondDateTime] = None,
    dry_run: Optional[Boolean] = None,
    remove_end_date: Optional[Boolean] = None,
) -> ModifyCapacityReservationFleetResult

Modifies a Capacity Reservation Fleet.

When you modify the total target capacity of a Capacity Reservation Fleet, the Fleet automatically creates new Capacity Reservations, or modifies or cancels existing Capacity Reservations in the Fleet to meet the new total target capacity. When you modify the end date for the Fleet, the end dates for all of the individual Capacity Reservations in the Fleet are updated accordingly.

Parameters:

  • capacity_reservation_fleet_id (Optional[CapacityReservationFleetId], default: None ) –

    The ID of the Capacity Reservation Fleet to modify.

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

    The total number of capacity units to be reserved by the Capacity Reservation Fleet. This value, together with the instance type weights that you assign to each instance type used by the Fleet determine the number of instances for which the Fleet reserves capacity. Both values are based on units that make sense for your workload. For more information, see Total target capacity in the Amazon EC2 User Guide.

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

    The date and time at which the Capacity Reservation Fleet expires. When the Capacity Reservation Fleet expires, its state changes to expired and all of the Capacity Reservations in the Fleet expire.

    The Capacity Reservation Fleet expires within an hour after the specified time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation Fleet is guaranteed to expire between 13:30:55 and 14:30:55 on 5/31/2019.

    You can't specify EndDate and RemoveEndDate in the same request.

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

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

    Indicates whether to remove the end date from the Capacity Reservation Fleet. If you remove the end date, the Capacity Reservation Fleet does not expire and it remains active until you explicitly cancel it using the CancelCapacityReservationFleet action.

    You can't specify RemoveEndDate and EndDate in the same request.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def modify_capacity_reservation_fleet(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    capacity_reservation_fleet_id: Optional[
        "capo_ec2.types.capacity_reservation_fleet_id.CapacityReservationFleetId"
    ] = None,
    total_target_capacity: Optional["capo_ec2.types.integer.Integer"] = None,
    end_date: Optional[
        "capo_ec2.types.millisecond_date_time.MillisecondDateTime"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    remove_end_date: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.modify_capacity_reservation_fleet_result.ModifyCapacityReservationFleetResult":
    """<p>Modifies a Capacity Reservation Fleet.</p> <p>When you modify the total target capacity of a Capacity Reservation Fleet, the Fleet automatically creates new Capacity Reservations, or modifies or cancels existing Capacity Reservations in the Fleet to meet the new total target capacity. When you modify the end date for the Fleet, the end dates for all of the individual Capacity Reservations in the Fleet are updated accordingly.</p>

    Args:
        capacity_reservation_fleet_id: <p>The ID of the Capacity Reservation Fleet to modify.</p>
        total_target_capacity: <p>The total number of capacity units to be reserved by the Capacity Reservation Fleet. This value, together with the instance type weights that you assign to each instance type used by the Fleet determine the number of instances for which the Fleet reserves capacity. Both values are based on units that make sense for your workload. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/crfleet-concepts.html#target-capacity">Total target capacity</a> in the <i>Amazon EC2 User Guide</i>.</p>
        end_date: <p>The date and time at which the Capacity Reservation Fleet expires. When the Capacity Reservation Fleet expires, its state changes to <code>expired</code> and all of the Capacity Reservations in the Fleet expire.</p> <p>The Capacity Reservation Fleet expires within an hour after the specified time. For example, if you specify <code>5/31/2019</code>, <code>13:30:55</code>, the Capacity Reservation Fleet is guaranteed to expire between <code>13:30:55</code> and <code>14:30:55</code> on <code>5/31/2019</code>.</p> <p>You can't specify <b>EndDate</b> and <b> RemoveEndDate</b> in the same request.</p>
        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>
        remove_end_date: <p>Indicates whether to remove the end date from the Capacity Reservation Fleet. If you remove the end date, the Capacity Reservation Fleet does not expire and it remains active until you explicitly cancel it using the <b>CancelCapacityReservationFleet</b> action.</p> <p>You can't specify <b>RemoveEndDate</b> and <b> EndDate</b> in the same request.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.modify_capacity_reservation_fleet_request.ModifyCapacityReservationFleetRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.modify_capacity_reservation_fleet_result.ModifyCapacityReservationFleetResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_capacity_reservation_fleet

        output, http_response = (
            capo_ec2._operations.amazon_ec2.modify_capacity_reservation_fleet.modify_capacity_reservation_fleet(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyCapacityReservationFleet")
    )
    input_: capo_ec2.types.modify_capacity_reservation_fleet_request.ModifyCapacityReservationFleetRequest = {}
    if capacity_reservation_fleet_id is not None:
        input_["capacity_reservation_fleet_id"] = capacity_reservation_fleet_id
    if total_target_capacity is not None:
        input_["total_target_capacity"] = total_target_capacity
    if end_date is not None:
        input_["end_date"] = end_date
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if remove_end_date is not None:
        input_["remove_end_date"] = remove_end_date

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output