All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.billing.fluent.models.ReservationOrderInner Maven / Gradle / Ivy

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

package com.azure.resourcemanager.billing.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.billing.models.ReservationBillingPlan;
import com.azure.resourcemanager.billing.models.ReservationExtendedStatusInfo;
import com.azure.resourcemanager.billing.models.ReservationOrderBillingPlanInformation;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/**
 * Details of a reservation order being returned.
 */
@Fluent
public final class ReservationOrderInner extends ProxyResource {
    /*
     * The etag property.
     */
    private Integer etag;

    /*
     * The properties associated to this reservation order
     */
    private ReservationOrderProperty innerProperties;

    /*
     * Tags for this reservation
     */
    private Map tags;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /**
     * Creates an instance of ReservationOrderInner class.
     */
    public ReservationOrderInner() {
    }

    /**
     * Get the etag property: The etag property.
     * 
     * @return the etag value.
     */
    public Integer etag() {
        return this.etag;
    }

    /**
     * Set the etag property: The etag property.
     * 
     * @param etag the etag value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withEtag(Integer etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the innerProperties property: The properties associated to this reservation order.
     * 
     * @return the innerProperties value.
     */
    private ReservationOrderProperty innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the tags property: Tags for this reservation.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Tags for this reservation.
     * 
     * @param tags the tags value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the displayName property: Friendly name for user to easily identified the reservation order.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Set the displayName property: Friendly name for user to easily identified the reservation order.
     * 
     * @param displayName the displayName value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the enrollmentId property: Enrollment id of the reservation order.
     * 
     * @return the enrollmentId value.
     */
    public String enrollmentId() {
        return this.innerProperties() == null ? null : this.innerProperties().enrollmentId();
    }

    /**
     * Set the enrollmentId property: Enrollment id of the reservation order.
     * 
     * @param enrollmentId the enrollmentId value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withEnrollmentId(String enrollmentId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withEnrollmentId(enrollmentId);
        return this;
    }

    /**
     * Get the customerId property: Fully-qualified identifier of the customerId where the benefit is applied. Present
     * only for Enterprise Agreement PartnerLed customers.
     * 
     * @return the customerId value.
     */
    public String customerId() {
        return this.innerProperties() == null ? null : this.innerProperties().customerId();
    }

    /**
     * Set the customerId property: Fully-qualified identifier of the customerId where the benefit is applied. Present
     * only for Enterprise Agreement PartnerLed customers.
     * 
     * @param customerId the customerId value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withCustomerId(String customerId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withCustomerId(customerId);
        return this;
    }

    /**
     * Get the billingProfileId property: Billing profile Id associated to this reservation order.
     * 
     * @return the billingProfileId value.
     */
    public String billingProfileId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingProfileId();
    }

    /**
     * Set the billingProfileId property: Billing profile Id associated to this reservation order.
     * 
     * @param billingProfileId the billingProfileId value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withBillingProfileId(String billingProfileId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withBillingProfileId(billingProfileId);
        return this;
    }

    /**
     * Get the billingAccountId property: Billing account Id associated to this reservation order.
     * 
     * @return the billingAccountId value.
     */
    public String billingAccountId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingAccountId();
    }

    /**
     * Set the billingAccountId property: Billing account Id associated to this reservation order.
     * 
     * @param billingAccountId the billingAccountId value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withBillingAccountId(String billingAccountId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withBillingAccountId(billingAccountId);
        return this;
    }

    /**
     * Get the requestDateTime property: This is the DateTime when the reservation order was initially requested for
     * purchase.
     * 
     * @return the requestDateTime value.
     */
    public OffsetDateTime requestDateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().requestDateTime();
    }

    /**
     * Set the requestDateTime property: This is the DateTime when the reservation order was initially requested for
     * purchase.
     * 
     * @param requestDateTime the requestDateTime value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withRequestDateTime(OffsetDateTime requestDateTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withRequestDateTime(requestDateTime);
        return this;
    }

    /**
     * Get the createdDateTime property: This is the DateTime when the reservation order was created.
     * 
     * @return the createdDateTime value.
     */
    public OffsetDateTime createdDateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().createdDateTime();
    }

    /**
     * Set the createdDateTime property: This is the DateTime when the reservation order was created.
     * 
     * @param createdDateTime the createdDateTime value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withCreatedDateTime(OffsetDateTime createdDateTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withCreatedDateTime(createdDateTime);
        return this;
    }

    /**
     * Get the expiryDate property: This is the date when the reservation order will expire.
     * 
     * @return the expiryDate value.
     */
    public LocalDate expiryDate() {
        return this.innerProperties() == null ? null : this.innerProperties().expiryDate();
    }

    /**
     * Set the expiryDate property: This is the date when the reservation order will expire.
     * 
     * @param expiryDate the expiryDate value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withExpiryDate(LocalDate expiryDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withExpiryDate(expiryDate);
        return this;
    }

    /**
     * Get the expiryDateTime property: This is the date-time when the reservation order will expire.
     * 
     * @return the expiryDateTime value.
     */
    public OffsetDateTime expiryDateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().expiryDateTime();
    }

    /**
     * Set the expiryDateTime property: This is the date-time when the reservation order will expire.
     * 
     * @param expiryDateTime the expiryDateTime value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withExpiryDateTime(OffsetDateTime expiryDateTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withExpiryDateTime(expiryDateTime);
        return this;
    }

    /**
     * Get the benefitStartTime property: This is the DateTime when the reservation benefit started.
     * 
     * @return the benefitStartTime value.
     */
    public OffsetDateTime benefitStartTime() {
        return this.innerProperties() == null ? null : this.innerProperties().benefitStartTime();
    }

    /**
     * Set the benefitStartTime property: This is the DateTime when the reservation benefit started.
     * 
     * @param benefitStartTime the benefitStartTime value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withBenefitStartTime(OffsetDateTime benefitStartTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withBenefitStartTime(benefitStartTime);
        return this;
    }

    /**
     * Get the originalQuantity property: Total original quantity of the skus purchased in the reservation order.
     * 
     * @return the originalQuantity value.
     */
    public Integer originalQuantity() {
        return this.innerProperties() == null ? null : this.innerProperties().originalQuantity();
    }

    /**
     * Set the originalQuantity property: Total original quantity of the skus purchased in the reservation order.
     * 
     * @param originalQuantity the originalQuantity value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withOriginalQuantity(Integer originalQuantity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withOriginalQuantity(originalQuantity);
        return this;
    }

    /**
     * Get the term property: The term of the reservation, e.g. P1Y.
     * 
     * @return the term value.
     */
    public String term() {
        return this.innerProperties() == null ? null : this.innerProperties().term();
    }

    /**
     * Get the provisioningState property: The provisioning state of the reservation, e.g. Succeeded.
     * 
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the billingPlan property: Represent the billing plans.
     * 
     * @return the billingPlan value.
     */
    public ReservationBillingPlan billingPlan() {
        return this.innerProperties() == null ? null : this.innerProperties().billingPlan();
    }

    /**
     * Set the billingPlan property: Represent the billing plans.
     * 
     * @param billingPlan the billingPlan value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withBillingPlan(ReservationBillingPlan billingPlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withBillingPlan(billingPlan);
        return this;
    }

    /**
     * Get the planInformation property: Information describing the type of billing plan for this reservation order.
     * 
     * @return the planInformation value.
     */
    public ReservationOrderBillingPlanInformation planInformation() {
        return this.innerProperties() == null ? null : this.innerProperties().planInformation();
    }

    /**
     * Set the planInformation property: Information describing the type of billing plan for this reservation order.
     * 
     * @param planInformation the planInformation value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withPlanInformation(ReservationOrderBillingPlanInformation planInformation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withPlanInformation(planInformation);
        return this;
    }

    /**
     * Get the reservations property: The reservations property.
     * 
     * @return the reservations value.
     */
    public List reservations() {
        return this.innerProperties() == null ? null : this.innerProperties().reservations();
    }

    /**
     * Set the reservations property: The reservations property.
     * 
     * @param reservations the reservations value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withReservations(List reservations) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withReservations(reservations);
        return this;
    }

    /**
     * Get the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed.
     * 
     * @return the reviewDateTime value.
     */
    public OffsetDateTime reviewDateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().reviewDateTime();
    }

    /**
     * Set the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed.
     * 
     * @param reviewDateTime the reviewDateTime value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withReviewDateTime(OffsetDateTime reviewDateTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withReviewDateTime(reviewDateTime);
        return this;
    }

    /**
     * Get the extendedStatusInfo property: Extended status information for the reservation.
     * 
     * @return the extendedStatusInfo value.
     */
    public ReservationExtendedStatusInfo extendedStatusInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().extendedStatusInfo();
    }

    /**
     * Set the extendedStatusInfo property: Extended status information for the reservation.
     * 
     * @param extendedStatusInfo the extendedStatusInfo value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withExtendedStatusInfo(ReservationExtendedStatusInfo extendedStatusInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withExtendedStatusInfo(extendedStatusInfo);
        return this;
    }

    /**
     * Get the productCode property: Represents UPN.
     * 
     * @return the productCode value.
     */
    public String productCode() {
        return this.innerProperties() == null ? null : this.innerProperties().productCode();
    }

    /**
     * Set the productCode property: Represents UPN.
     * 
     * @param productCode the productCode value to set.
     * @return the ReservationOrderInner object itself.
     */
    public ReservationOrderInner withProductCode(String productCode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ReservationOrderProperty();
        }
        this.innerProperties().withProductCode(productCode);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("etag", this.etag);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ReservationOrderInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ReservationOrderInner if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the ReservationOrderInner.
     */
    public static ReservationOrderInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ReservationOrderInner deserializedReservationOrderInner = new ReservationOrderInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedReservationOrderInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedReservationOrderInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedReservationOrderInner.type = reader.getString();
                } else if ("etag".equals(fieldName)) {
                    deserializedReservationOrderInner.etag = reader.getNullable(JsonReader::getInt);
                } else if ("properties".equals(fieldName)) {
                    deserializedReservationOrderInner.innerProperties = ReservationOrderProperty.fromJson(reader);
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedReservationOrderInner.tags = tags;
                } else if ("systemData".equals(fieldName)) {
                    deserializedReservationOrderInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedReservationOrderInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy