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

com.azure.resourcemanager.databoxedge.models.SkuCost Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.databoxedge.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * The metadata for retrieving price info.
 */
@Immutable
public final class SkuCost implements JsonSerializable {
    /*
     * Used for querying price from commerce.
     */
    private String meterId;

    /*
     * The cost quantity.
     */
    private Long quantity;

    /*
     * Restriction of the SKU for the location/zone
     */
    private String extendedUnit;

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

    /**
     * Get the meterId property: Used for querying price from commerce.
     * 
     * @return the meterId value.
     */
    public String meterId() {
        return this.meterId;
    }

    /**
     * Get the quantity property: The cost quantity.
     * 
     * @return the quantity value.
     */
    public Long quantity() {
        return this.quantity;
    }

    /**
     * Get the extendedUnit property: Restriction of the SKU for the location/zone.
     * 
     * @return the extendedUnit value.
     */
    public String extendedUnit() {
        return this.extendedUnit;
    }

    /**
     * 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();
        return jsonWriter.writeEndObject();
    }

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

                if ("meterId".equals(fieldName)) {
                    deserializedSkuCost.meterId = reader.getString();
                } else if ("quantity".equals(fieldName)) {
                    deserializedSkuCost.quantity = reader.getNullable(JsonReader::getLong);
                } else if ("extendedUnit".equals(fieldName)) {
                    deserializedSkuCost.extendedUnit = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSkuCost;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy