com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mongocluster Show documentation
Show all versions of azure-resourcemanager-mongocluster Show documentation
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.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 high availability properties of the cluster.
*/
@Fluent
public final class HighAvailabilityProperties implements JsonSerializable {
/*
* The target high availability mode requested for the cluster.
*/
private HighAvailabilityMode targetMode;
/**
* Creates an instance of HighAvailabilityProperties class.
*/
public HighAvailabilityProperties() {
}
/**
* Get the targetMode property: The target high availability mode requested for the cluster.
*
* @return the targetMode value.
*/
public HighAvailabilityMode targetMode() {
return this.targetMode;
}
/**
* Set the targetMode property: The target high availability mode requested for the cluster.
*
* @param targetMode the targetMode value to set.
* @return the HighAvailabilityProperties object itself.
*/
public HighAvailabilityProperties withTargetMode(HighAvailabilityMode targetMode) {
this.targetMode = targetMode;
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("targetMode", this.targetMode == null ? null : this.targetMode.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of HighAvailabilityProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of HighAvailabilityProperties 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 HighAvailabilityProperties.
*/
public static HighAvailabilityProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
HighAvailabilityProperties deserializedHighAvailabilityProperties = new HighAvailabilityProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("targetMode".equals(fieldName)) {
deserializedHighAvailabilityProperties.targetMode
= HighAvailabilityMode.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedHighAvailabilityProperties;
});
}
}