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

com.azure.resourcemanager.hybridcompute.fluent.models.ProductProfileUpdateProperties 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.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.LicenseProfileSubscriptionStatusUpdate;
import com.azure.resourcemanager.hybridcompute.models.ProductFeatureUpdate;
import java.io.IOException;
import java.util.List;

/**
 * Describes the Update properties of a Product Profile.
 */
@Fluent
public final class ProductProfileUpdateProperties implements JsonSerializable {
    /*
     * Indicates the subscription status of the product.
     */
    private LicenseProfileSubscriptionStatusUpdate subscriptionStatus;

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

    /*
     * The list of product feature updates.
     */
    private List productFeatures;

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

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

    /**
     * Set the subscriptionStatus property: Indicates the subscription status of the product.
     * 
     * @param subscriptionStatus the subscriptionStatus value to set.
     * @return the ProductProfileUpdateProperties object itself.
     */
    public ProductProfileUpdateProperties
        withSubscriptionStatus(LicenseProfileSubscriptionStatusUpdate 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 ProductProfileUpdateProperties object itself.
     */
    public ProductProfileUpdateProperties withProductType(LicenseProfileProductType productType) {
        this.productType = productType;
        return this;
    }

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

    /**
     * Set the productFeatures property: The list of product feature updates.
     * 
     * @param productFeatures the productFeatures value to set.
     * @return the ProductProfileUpdateProperties object itself.
     */
    public ProductProfileUpdateProperties 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 ProductProfileUpdateProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ProductProfileUpdateProperties 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 ProductProfileUpdateProperties.
     */
    public static ProductProfileUpdateProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ProductProfileUpdateProperties deserializedProductProfileUpdateProperties
                = new ProductProfileUpdateProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("subscriptionStatus".equals(fieldName)) {
                    deserializedProductProfileUpdateProperties.subscriptionStatus
                        = LicenseProfileSubscriptionStatusUpdate.fromString(reader.getString());
                } else if ("productType".equals(fieldName)) {
                    deserializedProductProfileUpdateProperties.productType
                        = LicenseProfileProductType.fromString(reader.getString());
                } else if ("productFeatures".equals(fieldName)) {
                    List productFeatures
                        = reader.readArray(reader1 -> ProductFeatureUpdate.fromJson(reader1));
                    deserializedProductProfileUpdateProperties.productFeatures = productFeatures;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedProductProfileUpdateProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy