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

com.azure.resourcemanager.hybridcompute.fluent.models.LicenseProfileArmProductProfileProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileProductType;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileSubscriptionStatus;
import com.azure.resourcemanager.hybridcompute.models.ProductFeature;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Describes the properties of a Product License Profile ARM model.
 */
@Fluent
public final class LicenseProfileArmProductProfileProperties
    implements JsonSerializable {
    /*
     * Indicates the subscription status of the product.
     */
    private LicenseProfileSubscriptionStatus subscriptionStatus;

    /*
     * Indicates the product type of the license.
     */
    private LicenseProfileProductType productType;

    /*
     * The timestamp in UTC when the user enrolls the feature.
     */
    private OffsetDateTime enrollmentDate;

    /*
     * The timestamp in UTC when the billing starts.
     */
    private OffsetDateTime billingStartDate;

    /*
     * The timestamp in UTC when the user disenrolled the feature.
     */
    private OffsetDateTime disenrollmentDate;

    /*
     * The timestamp in UTC when the billing ends.
     */
    private OffsetDateTime billingEndDate;

    /*
     * The errors that were encountered during the feature enrollment or disenrollment.
     */
    private ManagementError error;

    /*
     * The list of product features.
     */
    private List productFeatures;

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

    /**
     * Get the subscriptionStatus property: Indicates the subscription status of the product.
     * 
     * @return the subscriptionStatus value.
     */
    public LicenseProfileSubscriptionStatus subscriptionStatus() {
        return this.subscriptionStatus;
    }

    /**
     * Set the subscriptionStatus property: Indicates the subscription status of the product.
     * 
     * @param subscriptionStatus the subscriptionStatus value to set.
     * @return the LicenseProfileArmProductProfileProperties object itself.
     */
    public LicenseProfileArmProductProfileProperties
        withSubscriptionStatus(LicenseProfileSubscriptionStatus subscriptionStatus) {
        this.subscriptionStatus = subscriptionStatus;
        return this;
    }

    /**
     * Get the productType property: Indicates the product type of the license.
     * 
     * @return the productType value.
     */
    public LicenseProfileProductType productType() {
        return this.productType;
    }

    /**
     * Set the productType property: Indicates the product type of the license.
     * 
     * @param productType the productType value to set.
     * @return the LicenseProfileArmProductProfileProperties object itself.
     */
    public LicenseProfileArmProductProfileProperties withProductType(LicenseProfileProductType productType) {
        this.productType = productType;
        return this;
    }

    /**
     * Get the enrollmentDate property: The timestamp in UTC when the user enrolls the feature.
     * 
     * @return the enrollmentDate value.
     */
    public OffsetDateTime enrollmentDate() {
        return this.enrollmentDate;
    }

    /**
     * Get the billingStartDate property: The timestamp in UTC when the billing starts.
     * 
     * @return the billingStartDate value.
     */
    public OffsetDateTime billingStartDate() {
        return this.billingStartDate;
    }

    /**
     * Get the disenrollmentDate property: The timestamp in UTC when the user disenrolled the feature.
     * 
     * @return the disenrollmentDate value.
     */
    public OffsetDateTime disenrollmentDate() {
        return this.disenrollmentDate;
    }

    /**
     * Get the billingEndDate property: The timestamp in UTC when the billing ends.
     * 
     * @return the billingEndDate value.
     */
    public OffsetDateTime billingEndDate() {
        return this.billingEndDate;
    }

    /**
     * Get the error property: The errors that were encountered during the feature enrollment or disenrollment.
     * 
     * @return the error value.
     */
    public ManagementError error() {
        return this.error;
    }

    /**
     * Get the productFeatures property: The list of product features.
     * 
     * @return the productFeatures value.
     */
    public List productFeatures() {
        return this.productFeatures;
    }

    /**
     * Set the productFeatures property: The list of product features.
     * 
     * @param productFeatures the productFeatures value to set.
     * @return the LicenseProfileArmProductProfileProperties object itself.
     */
    public LicenseProfileArmProductProfileProperties withProductFeatures(List productFeatures) {
        this.productFeatures = productFeatures;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("subscriptionStatus",
            this.subscriptionStatus == null ? null : this.subscriptionStatus.toString());
        jsonWriter.writeStringField("productType", this.productType == null ? null : this.productType.toString());
        jsonWriter.writeArrayField("productFeatures", this.productFeatures,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("subscriptionStatus".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.subscriptionStatus
                        = LicenseProfileSubscriptionStatus.fromString(reader.getString());
                } else if ("productType".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.productType
                        = LicenseProfileProductType.fromString(reader.getString());
                } else if ("enrollmentDate".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.enrollmentDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("billingStartDate".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.billingStartDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("disenrollmentDate".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.disenrollmentDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("billingEndDate".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.billingEndDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("error".equals(fieldName)) {
                    deserializedLicenseProfileArmProductProfileProperties.error = ManagementError.fromJson(reader);
                } else if ("productFeatures".equals(fieldName)) {
                    List productFeatures
                        = reader.readArray(reader1 -> ProductFeature.fromJson(reader1));
                    deserializedLicenseProfileArmProductProfileProperties.productFeatures = productFeatures;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLicenseProfileArmProductProfileProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy