Skip to content

purchase_reserved_instance_offering

purchase_reserved_instance_offering(
    reserved_instance_offering_id: GUID,
    reservation_name: ReservationToken,
    *,
    config_overrides: Optional[OpenSearchClientConfig] = None,
    instance_count: Optional[InstanceCount] = None,
) -> PurchaseReservedInstanceOfferingResponse

Allows you to purchase Amazon OpenSearch Service Reserved Instances.

Parameters:

  • reserved_instance_offering_id (GUID) –

    The ID of the Reserved Instance offering to purchase.

  • reservation_name (ReservationToken) –

    A customer-specified identifier to track this reservation.

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

    The number of OpenSearch instances to reserve.

Raises:

Source code in docs_src/capo_opensearch/_services/open_search.py
def purchase_reserved_instance_offering(
    self,
    reserved_instance_offering_id: "capo_opensearch.types.guid.GUID",
    reservation_name: "capo_opensearch.types.reservation_token.ReservationToken",
    *,
    config_overrides: Optional[OpenSearchClientConfig] = None,
    instance_count: Optional[
        "capo_opensearch.types.instance_count.InstanceCount"
    ] = None,
) -> "capo_opensearch.types.purchase_reserved_instance_offering_response.PurchaseReservedInstanceOfferingResponse":
    """<p>Allows you to purchase Amazon OpenSearch Service Reserved Instances.</p>

    Args:
        reserved_instance_offering_id: <p>The ID of the Reserved Instance offering to purchase.</p>
        reservation_name: <p>A customer-specified identifier to track this reservation.</p>
        instance_count: <p>The number of OpenSearch instances to reserve.</p>

    Raises:
        capo_opensearch.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access an unsupported operation.</p>
        capo_opensearch.errors.internal_exception.InternalException: <p>Request processing failed because of an unknown error, exception, or internal failure.</p>
        capo_opensearch.errors.limit_exceeded_exception.LimitExceededException: <p>An exception for trying to create more than the allowed number of resources or sub-resources.</p>
        capo_opensearch.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>An exception for creating a resource that already exists.</p>
        capo_opensearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.validation_exception.ValidationException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_opensearch.types.purchase_reserved_instance_offering_request.PurchaseReservedInstanceOfferingRequest]",
    ) -> OperationResponse[
        "capo_opensearch.types.purchase_reserved_instance_offering_response.PurchaseReservedInstanceOfferingResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.purchase_reserved_instance_offering

        output, http_response = (
            capo_opensearch._operations.amazon_open_search_service.purchase_reserved_instance_offering.purchase_reserved_instance_offering(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PurchaseReservedInstanceOffering")
    )
    input_: capo_opensearch.types.purchase_reserved_instance_offering_request.PurchaseReservedInstanceOfferingRequest = {
        "reserved_instance_offering_id": reserved_instance_offering_id,
        "reservation_name": reservation_name,
    }
    if instance_count is not None:
        input_["instance_count"] = instance_count

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