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

com.azure.resourcemanager.netapp.fluent.models.ReplicationStatusInner 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.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.netapp.models.MirrorState;
import com.azure.resourcemanager.netapp.models.RelationshipStatus;
import java.io.IOException;

/**
 * Replication status.
 */
@Fluent
public final class ReplicationStatusInner implements JsonSerializable {
    /*
     * Replication health check
     */
    private Boolean healthy;

    /*
     * Status of the mirror relationship
     */
    private RelationshipStatus relationshipStatus;

    /*
     * The status of the replication
     */
    private MirrorState mirrorState;

    /*
     * The progress of the replication
     */
    private String totalProgress;

    /*
     * Displays error message if the replication is in an error state
     */
    private String errorMessage;

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

    /**
     * Get the healthy property: Replication health check.
     * 
     * @return the healthy value.
     */
    public Boolean healthy() {
        return this.healthy;
    }

    /**
     * Set the healthy property: Replication health check.
     * 
     * @param healthy the healthy value to set.
     * @return the ReplicationStatusInner object itself.
     */
    public ReplicationStatusInner withHealthy(Boolean healthy) {
        this.healthy = healthy;
        return this;
    }

    /**
     * Get the relationshipStatus property: Status of the mirror relationship.
     * 
     * @return the relationshipStatus value.
     */
    public RelationshipStatus relationshipStatus() {
        return this.relationshipStatus;
    }

    /**
     * Set the relationshipStatus property: Status of the mirror relationship.
     * 
     * @param relationshipStatus the relationshipStatus value to set.
     * @return the ReplicationStatusInner object itself.
     */
    public ReplicationStatusInner withRelationshipStatus(RelationshipStatus relationshipStatus) {
        this.relationshipStatus = relationshipStatus;
        return this;
    }

    /**
     * Get the mirrorState property: The status of the replication.
     * 
     * @return the mirrorState value.
     */
    public MirrorState mirrorState() {
        return this.mirrorState;
    }

    /**
     * Set the mirrorState property: The status of the replication.
     * 
     * @param mirrorState the mirrorState value to set.
     * @return the ReplicationStatusInner object itself.
     */
    public ReplicationStatusInner withMirrorState(MirrorState mirrorState) {
        this.mirrorState = mirrorState;
        return this;
    }

    /**
     * Get the totalProgress property: The progress of the replication.
     * 
     * @return the totalProgress value.
     */
    public String totalProgress() {
        return this.totalProgress;
    }

    /**
     * Set the totalProgress property: The progress of the replication.
     * 
     * @param totalProgress the totalProgress value to set.
     * @return the ReplicationStatusInner object itself.
     */
    public ReplicationStatusInner withTotalProgress(String totalProgress) {
        this.totalProgress = totalProgress;
        return this;
    }

    /**
     * Get the errorMessage property: Displays error message if the replication is in an error state.
     * 
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.errorMessage;
    }

    /**
     * Set the errorMessage property: Displays error message if the replication is in an error state.
     * 
     * @param errorMessage the errorMessage value to set.
     * @return the ReplicationStatusInner object itself.
     */
    public ReplicationStatusInner withErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
        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.writeBooleanField("healthy", this.healthy);
        jsonWriter.writeStringField("relationshipStatus",
            this.relationshipStatus == null ? null : this.relationshipStatus.toString());
        jsonWriter.writeStringField("mirrorState", this.mirrorState == null ? null : this.mirrorState.toString());
        jsonWriter.writeStringField("totalProgress", this.totalProgress);
        jsonWriter.writeStringField("errorMessage", this.errorMessage);
        return jsonWriter.writeEndObject();
    }

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

                if ("healthy".equals(fieldName)) {
                    deserializedReplicationStatusInner.healthy = reader.getNullable(JsonReader::getBoolean);
                } else if ("relationshipStatus".equals(fieldName)) {
                    deserializedReplicationStatusInner.relationshipStatus
                        = RelationshipStatus.fromString(reader.getString());
                } else if ("mirrorState".equals(fieldName)) {
                    deserializedReplicationStatusInner.mirrorState = MirrorState.fromString(reader.getString());
                } else if ("totalProgress".equals(fieldName)) {
                    deserializedReplicationStatusInner.totalProgress = reader.getString();
                } else if ("errorMessage".equals(fieldName)) {
                    deserializedReplicationStatusInner.errorMessage = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedReplicationStatusInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy