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

com.azure.resourcemanager.machinelearning.fluent.models.SkuResourceInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.

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.machinelearning.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.machinelearning.models.SkuCapacity;
import com.azure.resourcemanager.machinelearning.models.SkuSetting;
import java.io.IOException;

/**
 * Fulfills ARM Contract requirement to list all available SKUS for a resource.
 */
@Fluent
public final class SkuResourceInner implements JsonSerializable {
    /*
     * The resource type name.
     */
    private String resourceType;

    /*
     * Gets or sets the Sku.
     */
    private SkuSetting sku;

    /*
     * Gets or sets the Sku Capacity.
     */
    private SkuCapacity capacity;

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

    /**
     * Get the resourceType property: The resource type name.
     * 
     * @return the resourceType value.
     */
    public String resourceType() {
        return this.resourceType;
    }

    /**
     * Get the sku property: Gets or sets the Sku.
     * 
     * @return the sku value.
     */
    public SkuSetting sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Gets or sets the Sku.
     * 
     * @param sku the sku value to set.
     * @return the SkuResourceInner object itself.
     */
    public SkuResourceInner withSku(SkuSetting sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the capacity property: Gets or sets the Sku Capacity.
     * 
     * @return the capacity value.
     */
    public SkuCapacity capacity() {
        return this.capacity;
    }

    /**
     * Set the capacity property: Gets or sets the Sku Capacity.
     * 
     * @param capacity the capacity value to set.
     * @return the SkuResourceInner object itself.
     */
    public SkuResourceInner withCapacity(SkuCapacity capacity) {
        this.capacity = capacity;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("sku", this.sku);
        jsonWriter.writeJsonField("capacity", this.capacity);
        return jsonWriter.writeEndObject();
    }

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

                if ("resourceType".equals(fieldName)) {
                    deserializedSkuResourceInner.resourceType = reader.getString();
                } else if ("sku".equals(fieldName)) {
                    deserializedSkuResourceInner.sku = SkuSetting.fromJson(reader);
                } else if ("capacity".equals(fieldName)) {
                    deserializedSkuResourceInner.capacity = SkuCapacity.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSkuResourceInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy