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

com.azure.resourcemanager.netapp.models.DestinationReplication 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;

/**
 * Destination replication properties.
 */
@Fluent
public final class DestinationReplication implements JsonSerializable {
    /*
     * The resource ID of the remote volume
     */
    private String resourceId;

    /*
     * Indicates whether the replication is cross zone or cross region.
     */
    private ReplicationType replicationType;

    /*
     * The remote region for the destination volume.
     */
    private String region;

    /*
     * The remote zone for the destination volume.
     */
    private String zone;

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

    /**
     * Get the resourceId property: The resource ID of the remote volume.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: The resource ID of the remote volume.
     * 
     * @param resourceId the resourceId value to set.
     * @return the DestinationReplication object itself.
     */
    public DestinationReplication withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the replicationType property: Indicates whether the replication is cross zone or cross region.
     * 
     * @return the replicationType value.
     */
    public ReplicationType replicationType() {
        return this.replicationType;
    }

    /**
     * Set the replicationType property: Indicates whether the replication is cross zone or cross region.
     * 
     * @param replicationType the replicationType value to set.
     * @return the DestinationReplication object itself.
     */
    public DestinationReplication withReplicationType(ReplicationType replicationType) {
        this.replicationType = replicationType;
        return this;
    }

    /**
     * Get the region property: The remote region for the destination volume.
     * 
     * @return the region value.
     */
    public String region() {
        return this.region;
    }

    /**
     * Set the region property: The remote region for the destination volume.
     * 
     * @param region the region value to set.
     * @return the DestinationReplication object itself.
     */
    public DestinationReplication withRegion(String region) {
        this.region = region;
        return this;
    }

    /**
     * Get the zone property: The remote zone for the destination volume.
     * 
     * @return the zone value.
     */
    public String zone() {
        return this.zone;
    }

    /**
     * Set the zone property: The remote zone for the destination volume.
     * 
     * @param zone the zone value to set.
     * @return the DestinationReplication object itself.
     */
    public DestinationReplication withZone(String zone) {
        this.zone = zone;
        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("resourceId", this.resourceId);
        jsonWriter.writeStringField("replicationType",
            this.replicationType == null ? null : this.replicationType.toString());
        jsonWriter.writeStringField("region", this.region);
        jsonWriter.writeStringField("zone", this.zone);
        return jsonWriter.writeEndObject();
    }

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

                if ("resourceId".equals(fieldName)) {
                    deserializedDestinationReplication.resourceId = reader.getString();
                } else if ("replicationType".equals(fieldName)) {
                    deserializedDestinationReplication.replicationType = ReplicationType.fromString(reader.getString());
                } else if ("region".equals(fieldName)) {
                    deserializedDestinationReplication.region = reader.getString();
                } else if ("zone".equals(fieldName)) {
                    deserializedDestinationReplication.zone = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDestinationReplication;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy