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

com.azure.resourcemanager.avs.models.AvailabilityProperties 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.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;

/**
 * The properties describing private cloud availability zone distribution.
 */
@Fluent
public final class AvailabilityProperties implements JsonSerializable {
    /*
     * The availability strategy for the private cloud
     */
    private AvailabilityStrategy strategy;

    /*
     * The primary availability zone for the private cloud
     */
    private Integer zone;

    /*
     * The secondary availability zone for the private cloud
     */
    private Integer secondaryZone;

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

    /**
     * Get the strategy property: The availability strategy for the private cloud.
     * 
     * @return the strategy value.
     */
    public AvailabilityStrategy strategy() {
        return this.strategy;
    }

    /**
     * Set the strategy property: The availability strategy for the private cloud.
     * 
     * @param strategy the strategy value to set.
     * @return the AvailabilityProperties object itself.
     */
    public AvailabilityProperties withStrategy(AvailabilityStrategy strategy) {
        this.strategy = strategy;
        return this;
    }

    /**
     * Get the zone property: The primary availability zone for the private cloud.
     * 
     * @return the zone value.
     */
    public Integer zone() {
        return this.zone;
    }

    /**
     * Set the zone property: The primary availability zone for the private cloud.
     * 
     * @param zone the zone value to set.
     * @return the AvailabilityProperties object itself.
     */
    public AvailabilityProperties withZone(Integer zone) {
        this.zone = zone;
        return this;
    }

    /**
     * Get the secondaryZone property: The secondary availability zone for the private cloud.
     * 
     * @return the secondaryZone value.
     */
    public Integer secondaryZone() {
        return this.secondaryZone;
    }

    /**
     * Set the secondaryZone property: The secondary availability zone for the private cloud.
     * 
     * @param secondaryZone the secondaryZone value to set.
     * @return the AvailabilityProperties object itself.
     */
    public AvailabilityProperties withSecondaryZone(Integer secondaryZone) {
        this.secondaryZone = secondaryZone;
        return this;
    }

    /**
     * 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();
        jsonWriter.writeStringField("strategy", this.strategy == null ? null : this.strategy.toString());
        jsonWriter.writeNumberField("zone", this.zone);
        jsonWriter.writeNumberField("secondaryZone", this.secondaryZone);
        return jsonWriter.writeEndObject();
    }

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

                if ("strategy".equals(fieldName)) {
                    deserializedAvailabilityProperties.strategy = AvailabilityStrategy.fromString(reader.getString());
                } else if ("zone".equals(fieldName)) {
                    deserializedAvailabilityProperties.zone = reader.getNullable(JsonReader::getInt);
                } else if ("secondaryZone".equals(fieldName)) {
                    deserializedAvailabilityProperties.secondaryZone = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAvailabilityProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy