// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.reservations.generated;

import com.azure.resourcemanager.reservations.models.AppliedScopeType;
import com.azure.resourcemanager.reservations.models.InstanceFlexibility;
import com.azure.resourcemanager.reservations.models.PurchaseRequest;
import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties;
import com.azure.resourcemanager.reservations.models.ReservationBillingPlan;
import com.azure.resourcemanager.reservations.models.ReservationTerm;
import com.azure.resourcemanager.reservations.models.ReservedResourceType;
import com.azure.resourcemanager.reservations.models.SkuName;

/** Samples for ReservationOrder Purchase. */
public final class ReservationOrderPurchaseSamples {
    /*
     * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json
     */
    /**
     * Sample code: Purchase.
     *
     * @param manager Entry point to ReservationsManager.
     */
    public static void purchase(com.azure.resourcemanager.reservations.ReservationsManager manager) {
        manager
            .reservationOrders()
            .purchase(
                "a075419f-44cc-497f-b68a-14ee811d48b9",
                new PurchaseRequest()
                    .withSku(new SkuName().withName("standard_D1"))
                    .withLocation("westus")
                    .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES)
                    .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83")
                    .withTerm(ReservationTerm.P1Y)
                    .withBillingPlan(ReservationBillingPlan.MONTHLY)
                    .withQuantity(1)
                    .withDisplayName("TestReservationOrder")
                    .withAppliedScopeType(AppliedScopeType.SHARED)
                    .withRenew(false)
                    .withReservedResourceProperties(
                        new PurchaseRequestPropertiesReservedResourceProperties()
                            .withInstanceFlexibility(InstanceFlexibility.ON)),
                com.azure.core.util.Context.NONE);
    }
}
