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

com.azure.resourcemanager.hybridcompute.fluent.models.LicenseUpdateProperties 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.LicenseCoreType;
import com.azure.resourcemanager.hybridcompute.models.LicenseEdition;
import com.azure.resourcemanager.hybridcompute.models.LicenseState;
import com.azure.resourcemanager.hybridcompute.models.LicenseTarget;
import com.azure.resourcemanager.hybridcompute.models.LicenseType;
import java.io.IOException;

/**
 * Describes the Update properties of a License Profile.
 */
@Fluent
public final class LicenseUpdateProperties implements JsonSerializable {
    /*
     * The type of the license resource.
     */
    private LicenseType licenseType;

    /*
     * The licenseDetails property.
     */
    private LicenseUpdatePropertiesLicenseDetails innerLicenseDetails;

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

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

    /**
     * Set the licenseType property: The type of the license resource.
     * 
     * @param licenseType the licenseType value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withLicenseType(LicenseType licenseType) {
        this.licenseType = licenseType;
        return this;
    }

    /**
     * Get the innerLicenseDetails property: The licenseDetails property.
     * 
     * @return the innerLicenseDetails value.
     */
    private LicenseUpdatePropertiesLicenseDetails innerLicenseDetails() {
        return this.innerLicenseDetails;
    }

    /**
     * Get the state property: Describes the state of the license.
     * 
     * @return the state value.
     */
    public LicenseState state() {
        return this.innerLicenseDetails() == null ? null : this.innerLicenseDetails().state();
    }

    /**
     * Set the state property: Describes the state of the license.
     * 
     * @param state the state value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withState(LicenseState state) {
        if (this.innerLicenseDetails() == null) {
            this.innerLicenseDetails = new LicenseUpdatePropertiesLicenseDetails();
        }
        this.innerLicenseDetails().withState(state);
        return this;
    }

    /**
     * Get the target property: Describes the license target server.
     * 
     * @return the target value.
     */
    public LicenseTarget target() {
        return this.innerLicenseDetails() == null ? null : this.innerLicenseDetails().target();
    }

    /**
     * Set the target property: Describes the license target server.
     * 
     * @param target the target value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withTarget(LicenseTarget target) {
        if (this.innerLicenseDetails() == null) {
            this.innerLicenseDetails = new LicenseUpdatePropertiesLicenseDetails();
        }
        this.innerLicenseDetails().withTarget(target);
        return this;
    }

    /**
     * Get the edition property: Describes the edition of the license. The values are either Standard or Datacenter.
     * 
     * @return the edition value.
     */
    public LicenseEdition edition() {
        return this.innerLicenseDetails() == null ? null : this.innerLicenseDetails().edition();
    }

    /**
     * Set the edition property: Describes the edition of the license. The values are either Standard or Datacenter.
     * 
     * @param edition the edition value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withEdition(LicenseEdition edition) {
        if (this.innerLicenseDetails() == null) {
            this.innerLicenseDetails = new LicenseUpdatePropertiesLicenseDetails();
        }
        this.innerLicenseDetails().withEdition(edition);
        return this;
    }

    /**
     * Get the type property: Describes the license core type (pCore or vCore).
     * 
     * @return the type value.
     */
    public LicenseCoreType type() {
        return this.innerLicenseDetails() == null ? null : this.innerLicenseDetails().type();
    }

    /**
     * Set the type property: Describes the license core type (pCore or vCore).
     * 
     * @param type the type value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withType(LicenseCoreType type) {
        if (this.innerLicenseDetails() == null) {
            this.innerLicenseDetails = new LicenseUpdatePropertiesLicenseDetails();
        }
        this.innerLicenseDetails().withType(type);
        return this;
    }

    /**
     * Get the processors property: Describes the number of processors.
     * 
     * @return the processors value.
     */
    public Integer processors() {
        return this.innerLicenseDetails() == null ? null : this.innerLicenseDetails().processors();
    }

    /**
     * Set the processors property: Describes the number of processors.
     * 
     * @param processors the processors value to set.
     * @return the LicenseUpdateProperties object itself.
     */
    public LicenseUpdateProperties withProcessors(Integer processors) {
        if (this.innerLicenseDetails() == null) {
            this.innerLicenseDetails = new LicenseUpdatePropertiesLicenseDetails();
        }
        this.innerLicenseDetails().withProcessors(processors);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("licenseType", this.licenseType == null ? null : this.licenseType.toString());
        jsonWriter.writeJsonField("licenseDetails", this.innerLicenseDetails);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of LicenseUpdateProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of LicenseUpdateProperties 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 LicenseUpdateProperties.
     */
    public static LicenseUpdateProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            LicenseUpdateProperties deserializedLicenseUpdateProperties = new LicenseUpdateProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("licenseType".equals(fieldName)) {
                    deserializedLicenseUpdateProperties.licenseType = LicenseType.fromString(reader.getString());
                } else if ("licenseDetails".equals(fieldName)) {
                    deserializedLicenseUpdateProperties.innerLicenseDetails
                        = LicenseUpdatePropertiesLicenseDetails.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLicenseUpdateProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy