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

com.azure.resourcemanager.mongocluster.models.ReplicationProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.resourcemanager.mongocluster.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Replica properties of the mongo cluster.
 */
@Immutable
public final class ReplicationProperties implements JsonSerializable {
    /*
     * The resource id the source cluster for the replica cluster.
     */
    private String sourceResourceId;

    /*
     * The replication role of the cluster
     */
    private ReplicationRole role;

    /*
     * The replication link state of the replica cluster.
     */
    private ReplicationState replicationState;

    /**
     * Creates an instance of ReplicationProperties class.
     */
    private ReplicationProperties() {
    }

    /**
     * Get the sourceResourceId property: The resource id the source cluster for the replica cluster.
     * 
     * @return the sourceResourceId value.
     */
    public String sourceResourceId() {
        return this.sourceResourceId;
    }

    /**
     * Get the role property: The replication role of the cluster.
     * 
     * @return the role value.
     */
    public ReplicationRole role() {
        return this.role;
    }

    /**
     * Get the replicationState property: The replication link state of the replica cluster.
     * 
     * @return the replicationState value.
     */
    public ReplicationState replicationState() {
        return this.replicationState;
    }

    /**
     * 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();
        return jsonWriter.writeEndObject();
    }

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

                if ("sourceResourceId".equals(fieldName)) {
                    deserializedReplicationProperties.sourceResourceId = reader.getString();
                } else if ("role".equals(fieldName)) {
                    deserializedReplicationProperties.role = ReplicationRole.fromString(reader.getString());
                } else if ("replicationState".equals(fieldName)) {
                    deserializedReplicationProperties.replicationState
                        = ReplicationState.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedReplicationProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy