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

com.azure.resourcemanager.netapp.models.VolumeGroupMetadata Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-2024-03.

There is a newer version: 1.4.0
Show 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.netapp.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 java.io.IOException;
import java.util.List;

/**
 * Volume group properties.
 */
@Fluent
public final class VolumeGroupMetadata implements JsonSerializable {
    /*
     * Group Description
     */
    private String groupDescription;

    /*
     * Application Type
     */
    private ApplicationType applicationType;

    /*
     * Application specific identifier
     */
    private String applicationIdentifier;

    /*
     * Application specific placement rules for the volume group
     */
    private List globalPlacementRules;

    /*
     * Number of volumes in volume group
     */
    private Long volumesCount;

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

    /**
     * Get the groupDescription property: Group Description.
     * 
     * @return the groupDescription value.
     */
    public String groupDescription() {
        return this.groupDescription;
    }

    /**
     * Set the groupDescription property: Group Description.
     * 
     * @param groupDescription the groupDescription value to set.
     * @return the VolumeGroupMetadata object itself.
     */
    public VolumeGroupMetadata withGroupDescription(String groupDescription) {
        this.groupDescription = groupDescription;
        return this;
    }

    /**
     * Get the applicationType property: Application Type.
     * 
     * @return the applicationType value.
     */
    public ApplicationType applicationType() {
        return this.applicationType;
    }

    /**
     * Set the applicationType property: Application Type.
     * 
     * @param applicationType the applicationType value to set.
     * @return the VolumeGroupMetadata object itself.
     */
    public VolumeGroupMetadata withApplicationType(ApplicationType applicationType) {
        this.applicationType = applicationType;
        return this;
    }

    /**
     * Get the applicationIdentifier property: Application specific identifier.
     * 
     * @return the applicationIdentifier value.
     */
    public String applicationIdentifier() {
        return this.applicationIdentifier;
    }

    /**
     * Set the applicationIdentifier property: Application specific identifier.
     * 
     * @param applicationIdentifier the applicationIdentifier value to set.
     * @return the VolumeGroupMetadata object itself.
     */
    public VolumeGroupMetadata withApplicationIdentifier(String applicationIdentifier) {
        this.applicationIdentifier = applicationIdentifier;
        return this;
    }

    /**
     * Get the globalPlacementRules property: Application specific placement rules for the volume group.
     * 
     * @return the globalPlacementRules value.
     */
    public List globalPlacementRules() {
        return this.globalPlacementRules;
    }

    /**
     * Set the globalPlacementRules property: Application specific placement rules for the volume group.
     * 
     * @param globalPlacementRules the globalPlacementRules value to set.
     * @return the VolumeGroupMetadata object itself.
     */
    public VolumeGroupMetadata withGlobalPlacementRules(List globalPlacementRules) {
        this.globalPlacementRules = globalPlacementRules;
        return this;
    }

    /**
     * Get the volumesCount property: Number of volumes in volume group.
     * 
     * @return the volumesCount value.
     */
    public Long volumesCount() {
        return this.volumesCount;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("groupDescription", this.groupDescription);
        jsonWriter.writeStringField("applicationType",
            this.applicationType == null ? null : this.applicationType.toString());
        jsonWriter.writeStringField("applicationIdentifier", this.applicationIdentifier);
        jsonWriter.writeArrayField("globalPlacementRules", this.globalPlacementRules,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("groupDescription".equals(fieldName)) {
                    deserializedVolumeGroupMetadata.groupDescription = reader.getString();
                } else if ("applicationType".equals(fieldName)) {
                    deserializedVolumeGroupMetadata.applicationType = ApplicationType.fromString(reader.getString());
                } else if ("applicationIdentifier".equals(fieldName)) {
                    deserializedVolumeGroupMetadata.applicationIdentifier = reader.getString();
                } else if ("globalPlacementRules".equals(fieldName)) {
                    List globalPlacementRules
                        = reader.readArray(reader1 -> PlacementKeyValuePairs.fromJson(reader1));
                    deserializedVolumeGroupMetadata.globalPlacementRules = globalPlacementRules;
                } else if ("volumesCount".equals(fieldName)) {
                    deserializedVolumeGroupMetadata.volumesCount = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVolumeGroupMetadata;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy