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

com.azure.resourcemanager.qumulo.models.MarketplaceDetails Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Qumulo Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-06-19.

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.qumulo.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * MarketplaceDetails of Qumulo FileSystem resource.
 */
@Fluent
public final class MarketplaceDetails implements JsonSerializable {
    /*
     * Marketplace Subscription Id
     */
    private String marketplaceSubscriptionId;

    /*
     * Plan Id
     */
    private String planId;

    /*
     * Offer Id
     */
    private String offerId;

    /*
     * Publisher Id
     */
    private String publisherId;

    /*
     * Term Unit
     */
    private String termUnit;

    /*
     * Marketplace subscription status
     */
    private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus;

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

    /**
     * Get the marketplaceSubscriptionId property: Marketplace Subscription Id.
     * 
     * @return the marketplaceSubscriptionId value.
     */
    public String marketplaceSubscriptionId() {
        return this.marketplaceSubscriptionId;
    }

    /**
     * Set the marketplaceSubscriptionId property: Marketplace Subscription Id.
     * 
     * @param marketplaceSubscriptionId the marketplaceSubscriptionId value to set.
     * @return the MarketplaceDetails object itself.
     */
    public MarketplaceDetails withMarketplaceSubscriptionId(String marketplaceSubscriptionId) {
        this.marketplaceSubscriptionId = marketplaceSubscriptionId;
        return this;
    }

    /**
     * Get the planId property: Plan Id.
     * 
     * @return the planId value.
     */
    public String planId() {
        return this.planId;
    }

    /**
     * Set the planId property: Plan Id.
     * 
     * @param planId the planId value to set.
     * @return the MarketplaceDetails object itself.
     */
    public MarketplaceDetails withPlanId(String planId) {
        this.planId = planId;
        return this;
    }

    /**
     * Get the offerId property: Offer Id.
     * 
     * @return the offerId value.
     */
    public String offerId() {
        return this.offerId;
    }

    /**
     * Set the offerId property: Offer Id.
     * 
     * @param offerId the offerId value to set.
     * @return the MarketplaceDetails object itself.
     */
    public MarketplaceDetails withOfferId(String offerId) {
        this.offerId = offerId;
        return this;
    }

    /**
     * Get the publisherId property: Publisher Id.
     * 
     * @return the publisherId value.
     */
    public String publisherId() {
        return this.publisherId;
    }

    /**
     * Set the publisherId property: Publisher Id.
     * 
     * @param publisherId the publisherId value to set.
     * @return the MarketplaceDetails object itself.
     */
    public MarketplaceDetails withPublisherId(String publisherId) {
        this.publisherId = publisherId;
        return this;
    }

    /**
     * Get the termUnit property: Term Unit.
     * 
     * @return the termUnit value.
     */
    public String termUnit() {
        return this.termUnit;
    }

    /**
     * Set the termUnit property: Term Unit.
     * 
     * @param termUnit the termUnit value to set.
     * @return the MarketplaceDetails object itself.
     */
    public MarketplaceDetails withTermUnit(String termUnit) {
        this.termUnit = termUnit;
        return this;
    }

    /**
     * Get the marketplaceSubscriptionStatus property: Marketplace subscription status.
     * 
     * @return the marketplaceSubscriptionStatus value.
     */
    public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() {
        return this.marketplaceSubscriptionStatus;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (planId() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property planId in model MarketplaceDetails"));
        }
        if (offerId() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property offerId in model MarketplaceDetails"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(MarketplaceDetails.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("planId", this.planId);
        jsonWriter.writeStringField("offerId", this.offerId);
        jsonWriter.writeStringField("marketplaceSubscriptionId", this.marketplaceSubscriptionId);
        jsonWriter.writeStringField("publisherId", this.publisherId);
        jsonWriter.writeStringField("termUnit", this.termUnit);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of MarketplaceDetails from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MarketplaceDetails if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the MarketplaceDetails.
     */
    public static MarketplaceDetails fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MarketplaceDetails deserializedMarketplaceDetails = new MarketplaceDetails();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("planId".equals(fieldName)) {
                    deserializedMarketplaceDetails.planId = reader.getString();
                } else if ("offerId".equals(fieldName)) {
                    deserializedMarketplaceDetails.offerId = reader.getString();
                } else if ("marketplaceSubscriptionId".equals(fieldName)) {
                    deserializedMarketplaceDetails.marketplaceSubscriptionId = reader.getString();
                } else if ("publisherId".equals(fieldName)) {
                    deserializedMarketplaceDetails.publisherId = reader.getString();
                } else if ("termUnit".equals(fieldName)) {
                    deserializedMarketplaceDetails.termUnit = reader.getString();
                } else if ("marketplaceSubscriptionStatus".equals(fieldName)) {
                    deserializedMarketplaceDetails.marketplaceSubscriptionStatus
                        = MarketplaceSubscriptionStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMarketplaceDetails;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy