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

com.azure.resourcemanager.hybridcompute.fluent.models.LicenseProfileMachineInstanceViewEsuPropertiesInner 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.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.models.EsuEligibility;
import com.azure.resourcemanager.hybridcompute.models.EsuKey;
import com.azure.resourcemanager.hybridcompute.models.EsuKeyState;
import com.azure.resourcemanager.hybridcompute.models.EsuServerType;
import com.azure.resourcemanager.hybridcompute.models.LicenseAssignmentState;
import com.azure.resourcemanager.hybridcompute.models.LicenseProfileArmEsuPropertiesWithoutAssignedLicense;
import java.io.IOException;
import java.util.List;

/**
 * Properties for the Machine ESU profile.
 */
@Fluent
public final class LicenseProfileMachineInstanceViewEsuPropertiesInner
    extends LicenseProfileArmEsuPropertiesWithoutAssignedLicense {
    /*
     * The assigned license resource.
     */
    private LicenseInner assignedLicense;

    /*
     * Describes the license assignment state (Assigned or NotAssigned).
     */
    private LicenseAssignmentState licenseAssignmentState;

    /*
     * Indicates whether there is an ESU Key currently active for the machine.
     */
    private EsuKeyState esuKeyState;

    /*
     * Indicates the eligibility state of Esu.
     */
    private EsuEligibility esuEligibility;

    /*
     * The type of the Esu servers.
     */
    private EsuServerType serverType;

    /*
     * The list of ESU keys.
     */
    private List esuKeys;

    /*
     * The guid id of the license.
     */
    private String assignedLicenseImmutableId;

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

    /**
     * Get the assignedLicense property: The assigned license resource.
     * 
     * @return the assignedLicense value.
     */
    public LicenseInner assignedLicense() {
        return this.assignedLicense;
    }

    /**
     * Set the assignedLicense property: The assigned license resource.
     * 
     * @param assignedLicense the assignedLicense value to set.
     * @return the LicenseProfileMachineInstanceViewEsuPropertiesInner object itself.
     */
    public LicenseProfileMachineInstanceViewEsuPropertiesInner withAssignedLicense(LicenseInner assignedLicense) {
        this.assignedLicense = assignedLicense;
        return this;
    }

    /**
     * Get the licenseAssignmentState property: Describes the license assignment state (Assigned or NotAssigned).
     * 
     * @return the licenseAssignmentState value.
     */
    public LicenseAssignmentState licenseAssignmentState() {
        return this.licenseAssignmentState;
    }

    /**
     * Set the licenseAssignmentState property: Describes the license assignment state (Assigned or NotAssigned).
     * 
     * @param licenseAssignmentState the licenseAssignmentState value to set.
     * @return the LicenseProfileMachineInstanceViewEsuPropertiesInner object itself.
     */
    public LicenseProfileMachineInstanceViewEsuPropertiesInner
        withLicenseAssignmentState(LicenseAssignmentState licenseAssignmentState) {
        this.licenseAssignmentState = licenseAssignmentState;
        return this;
    }

    /**
     * Get the esuKeyState property: Indicates whether there is an ESU Key currently active for the machine.
     * 
     * @return the esuKeyState value.
     */
    @Override
    public EsuKeyState esuKeyState() {
        return this.esuKeyState;
    }

    /**
     * Get the esuEligibility property: Indicates the eligibility state of Esu.
     * 
     * @return the esuEligibility value.
     */
    @Override
    public EsuEligibility esuEligibility() {
        return this.esuEligibility;
    }

    /**
     * Get the serverType property: The type of the Esu servers.
     * 
     * @return the serverType value.
     */
    @Override
    public EsuServerType serverType() {
        return this.serverType;
    }

    /**
     * Get the esuKeys property: The list of ESU keys.
     * 
     * @return the esuKeys value.
     */
    @Override
    public List esuKeys() {
        return this.esuKeys;
    }

    /**
     * Get the assignedLicenseImmutableId property: The guid id of the license.
     * 
     * @return the assignedLicenseImmutableId value.
     */
    @Override
    public String assignedLicenseImmutableId() {
        return this.assignedLicenseImmutableId;
    }

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

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

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

                if ("assignedLicenseImmutableId".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.assignedLicenseImmutableId
                        = reader.getString();
                } else if ("esuKeys".equals(fieldName)) {
                    List esuKeys = reader.readArray(reader1 -> EsuKey.fromJson(reader1));
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.esuKeys = esuKeys;
                } else if ("serverType".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.serverType
                        = EsuServerType.fromString(reader.getString());
                } else if ("esuEligibility".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.esuEligibility
                        = EsuEligibility.fromString(reader.getString());
                } else if ("esuKeyState".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.esuKeyState
                        = EsuKeyState.fromString(reader.getString());
                } else if ("assignedLicense".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.assignedLicense
                        = LicenseInner.fromJson(reader);
                } else if ("licenseAssignmentState".equals(fieldName)) {
                    deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner.licenseAssignmentState
                        = LicenseAssignmentState.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLicenseProfileMachineInstanceViewEsuPropertiesInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy