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

com.azure.resourcemanager.avs.fluent.models.DatastoreProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Avs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure VMware Solution API. Package tag package-2023-09-01.

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.avs.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.avs.models.DatastoreProvisioningState;
import com.azure.resourcemanager.avs.models.DatastoreStatus;
import com.azure.resourcemanager.avs.models.DiskPoolVolume;
import com.azure.resourcemanager.avs.models.ElasticSanVolume;
import com.azure.resourcemanager.avs.models.NetAppVolume;
import java.io.IOException;

/**
 * The properties of a datastore.
 */
@Fluent
public final class DatastoreProperties implements JsonSerializable {
    /*
     * The state of the datastore provisioning
     */
    private DatastoreProvisioningState provisioningState;

    /*
     * An Azure NetApp Files volume
     */
    private NetAppVolume netAppVolume;

    /*
     * An iSCSI volume
     */
    private DiskPoolVolume diskPoolVolume;

    /*
     * An Elastic SAN volume
     */
    private ElasticSanVolume elasticSanVolume;

    /*
     * The operational status of the datastore
     */
    private DatastoreStatus status;

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

    /**
     * Get the provisioningState property: The state of the datastore provisioning.
     * 
     * @return the provisioningState value.
     */
    public DatastoreProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the netAppVolume property: An Azure NetApp Files volume.
     * 
     * @return the netAppVolume value.
     */
    public NetAppVolume netAppVolume() {
        return this.netAppVolume;
    }

    /**
     * Set the netAppVolume property: An Azure NetApp Files volume.
     * 
     * @param netAppVolume the netAppVolume value to set.
     * @return the DatastoreProperties object itself.
     */
    public DatastoreProperties withNetAppVolume(NetAppVolume netAppVolume) {
        this.netAppVolume = netAppVolume;
        return this;
    }

    /**
     * Get the diskPoolVolume property: An iSCSI volume.
     * 
     * @return the diskPoolVolume value.
     */
    public DiskPoolVolume diskPoolVolume() {
        return this.diskPoolVolume;
    }

    /**
     * Set the diskPoolVolume property: An iSCSI volume.
     * 
     * @param diskPoolVolume the diskPoolVolume value to set.
     * @return the DatastoreProperties object itself.
     */
    public DatastoreProperties withDiskPoolVolume(DiskPoolVolume diskPoolVolume) {
        this.diskPoolVolume = diskPoolVolume;
        return this;
    }

    /**
     * Get the elasticSanVolume property: An Elastic SAN volume.
     * 
     * @return the elasticSanVolume value.
     */
    public ElasticSanVolume elasticSanVolume() {
        return this.elasticSanVolume;
    }

    /**
     * Set the elasticSanVolume property: An Elastic SAN volume.
     * 
     * @param elasticSanVolume the elasticSanVolume value to set.
     * @return the DatastoreProperties object itself.
     */
    public DatastoreProperties withElasticSanVolume(ElasticSanVolume elasticSanVolume) {
        this.elasticSanVolume = elasticSanVolume;
        return this;
    }

    /**
     * Get the status property: The operational status of the datastore.
     * 
     * @return the status value.
     */
    public DatastoreStatus status() {
        return this.status;
    }

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

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

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedDatastoreProperties.provisioningState
                        = DatastoreProvisioningState.fromString(reader.getString());
                } else if ("netAppVolume".equals(fieldName)) {
                    deserializedDatastoreProperties.netAppVolume = NetAppVolume.fromJson(reader);
                } else if ("diskPoolVolume".equals(fieldName)) {
                    deserializedDatastoreProperties.diskPoolVolume = DiskPoolVolume.fromJson(reader);
                } else if ("elasticSanVolume".equals(fieldName)) {
                    deserializedDatastoreProperties.elasticSanVolume = ElasticSanVolume.fromJson(reader);
                } else if ("status".equals(fieldName)) {
                    deserializedDatastoreProperties.status = DatastoreStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDatastoreProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy