Skip to content

get_host_reservation_purchase_preview

get_host_reservation_purchase_preview(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    host_id_set: Optional[RequestHostIdSet] = None,
    offering_id: Optional[OfferingId] = None,
) -> GetHostReservationPurchasePreviewResult

Preview a reservation purchase with configurations that match those of your Dedicated Host. You must have active Dedicated Hosts in your account before you purchase a reservation.

This is a preview of the PurchaseHostReservation action and does not result in the offering being purchased.

Parameters:

  • host_id_set (Optional[RequestHostIdSet], default: None ) –

    The IDs of the Dedicated Hosts with which the reservation is associated.

  • offering_id (Optional[OfferingId], default: None ) –

    The offering ID of the reservation.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def get_host_reservation_purchase_preview(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    host_id_set: Optional[
        "capo_ec2.types.request_host_id_set.RequestHostIdSet"
    ] = None,
    offering_id: Optional["capo_ec2.types.offering_id.OfferingId"] = None,
) -> "capo_ec2.types.get_host_reservation_purchase_preview_result.GetHostReservationPurchasePreviewResult":
    """<p>Preview a reservation purchase with configurations that match those of your Dedicated Host. You must have active Dedicated Hosts in your account before you purchase a reservation.</p> <p>This is a preview of the <a>PurchaseHostReservation</a> action and does not result in the offering being purchased.</p>

    Args:
        host_id_set: <p>The IDs of the Dedicated Hosts with which the reservation is associated.</p>
        offering_id: <p>The offering ID of the reservation.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.get_host_reservation_purchase_preview_request.GetHostReservationPurchasePreviewRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.get_host_reservation_purchase_preview_result.GetHostReservationPurchasePreviewResult"
    ]:
        import capo_ec2._operations.amazon_ec2.get_host_reservation_purchase_preview

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetHostReservationPurchasePreview")
    )
    input_: capo_ec2.types.get_host_reservation_purchase_preview_request.GetHostReservationPurchasePreviewRequest = {}
    if host_id_set is not None:
        input_["host_id_set"] = host_id_set
    if offering_id is not None:
        input_["offering_id"] = offering_id

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