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

com.azure.resourcemanager.hybridcompute.fluent.models.LicenseUpdatePropertiesLicenseDetails 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 java.io.IOException;

/**
 * The LicenseUpdatePropertiesLicenseDetails model.
 */
@Fluent
public final class LicenseUpdatePropertiesLicenseDetails
    implements JsonSerializable {
    /*
     * Describes the state of the license.
     */
    private LicenseState state;

    /*
     * Describes the license target server.
     */
    private LicenseTarget target;

    /*
     * Describes the edition of the license. The values are either Standard or Datacenter.
     */
    private LicenseEdition edition;

    /*
     * Describes the license core type (pCore or vCore).
     */
    private LicenseCoreType type;

    /*
     * Describes the number of processors.
     */
    private Integer processors;

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

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

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

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

    /**
     * Set the target property: Describes the license target server.
     * 
     * @param target the target value to set.
     * @return the LicenseUpdatePropertiesLicenseDetails object itself.
     */
    public LicenseUpdatePropertiesLicenseDetails withTarget(LicenseTarget target) {
        this.target = 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.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 LicenseUpdatePropertiesLicenseDetails object itself.
     */
    public LicenseUpdatePropertiesLicenseDetails withEdition(LicenseEdition edition) {
        this.edition = edition;
        return this;
    }

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

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

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

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
        jsonWriter.writeStringField("target", this.target == null ? null : this.target.toString());
        jsonWriter.writeStringField("edition", this.edition == null ? null : this.edition.toString());
        jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
        jsonWriter.writeNumberField("processors", this.processors);
        return jsonWriter.writeEndObject();
    }

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

                if ("state".equals(fieldName)) {
                    deserializedLicenseUpdatePropertiesLicenseDetails.state
                        = LicenseState.fromString(reader.getString());
                } else if ("target".equals(fieldName)) {
                    deserializedLicenseUpdatePropertiesLicenseDetails.target
                        = LicenseTarget.fromString(reader.getString());
                } else if ("edition".equals(fieldName)) {
                    deserializedLicenseUpdatePropertiesLicenseDetails.edition
                        = LicenseEdition.fromString(reader.getString());
                } else if ("type".equals(fieldName)) {
                    deserializedLicenseUpdatePropertiesLicenseDetails.type
                        = LicenseCoreType.fromString(reader.getString());
                } else if ("processors".equals(fieldName)) {
                    deserializedLicenseUpdatePropertiesLicenseDetails.processors
                        = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLicenseUpdatePropertiesLicenseDetails;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy