com.azure.resourcemanager.cosmos.models.Location Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-cosmos Show documentation
Show all versions of azure-resourcemanager-cosmos Show documentation
This package contains Microsoft Azure CosmosDB SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.cosmos.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;
/**
* A region in which the Azure Cosmos DB database account is deployed.
*/
@Fluent
public final class Location implements JsonSerializable {
/*
* The unique identifier of the region within the database account. Example:
* <accountName>-<locationName>.
*/
private String id;
/*
* The name of the region.
*/
private String locationName;
/*
* The connection endpoint for the specific region. Example:
* https://<accountName>-<locationName>.documents.azure.com:443/
*/
private String documentEndpoint;
/*
* The status of the Cosmos DB account at the time the operation was called. The status can be one of following.
* 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that
* are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB
* account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB
* account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB
* account deletion failed.
*/
private String provisioningState;
/*
* The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a
* failover priority = (total number of regions - 1). Failover priority values must be unique for each of the
* regions in which the database account exists.
*/
private Integer failoverPriority;
/*
* Flag to indicate whether or not this region is an AvailabilityZone region
*/
private Boolean isZoneRedundant;
/**
* Creates an instance of Location class.
*/
public Location() {
}
/**
* Get the id property: The unique identifier of the region within the database account. Example:
* <accountName>-<locationName>.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Get the locationName property: The name of the region.
*
* @return the locationName value.
*/
public String locationName() {
return this.locationName;
}
/**
* Set the locationName property: The name of the region.
*
* @param locationName the locationName value to set.
* @return the Location object itself.
*/
public Location withLocationName(String locationName) {
this.locationName = locationName;
return this;
}
/**
* Get the documentEndpoint property: The connection endpoint for the specific region. Example:
* https://<accountName>-<locationName>.documents.azure.com:443/.
*
* @return the documentEndpoint value.
*/
public String documentEndpoint() {
return this.documentEndpoint;
}
/**
* Get the provisioningState property: The status of the Cosmos DB account at the time the operation was called. The
* status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in
* Creating state, only properties that are specified as input for the Create Cosmos DB account operation are
* returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being
* updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation.
* 'DeletionFailed' – the Cosmos DB account deletion failed.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.provisioningState;
}
/**
* Get the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a
* write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values
* must be unique for each of the regions in which the database account exists.
*
* @return the failoverPriority value.
*/
public Integer failoverPriority() {
return this.failoverPriority;
}
/**
* Set the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a
* write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values
* must be unique for each of the regions in which the database account exists.
*
* @param failoverPriority the failoverPriority value to set.
* @return the Location object itself.
*/
public Location withFailoverPriority(Integer failoverPriority) {
this.failoverPriority = failoverPriority;
return this;
}
/**
* Get the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region.
*
* @return the isZoneRedundant value.
*/
public Boolean isZoneRedundant() {
return this.isZoneRedundant;
}
/**
* Set the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region.
*
* @param isZoneRedundant the isZoneRedundant value to set.
* @return the Location object itself.
*/
public Location withIsZoneRedundant(Boolean isZoneRedundant) {
this.isZoneRedundant = isZoneRedundant;
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("locationName", this.locationName);
jsonWriter.writeNumberField("failoverPriority", this.failoverPriority);
jsonWriter.writeBooleanField("isZoneRedundant", this.isZoneRedundant);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Location from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Location 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 Location.
*/
public static Location fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Location deserializedLocation = new Location();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedLocation.id = reader.getString();
} else if ("locationName".equals(fieldName)) {
deserializedLocation.locationName = reader.getString();
} else if ("documentEndpoint".equals(fieldName)) {
deserializedLocation.documentEndpoint = reader.getString();
} else if ("provisioningState".equals(fieldName)) {
deserializedLocation.provisioningState = reader.getString();
} else if ("failoverPriority".equals(fieldName)) {
deserializedLocation.failoverPriority = reader.getNullable(JsonReader::getInt);
} else if ("isZoneRedundant".equals(fieldName)) {
deserializedLocation.isZoneRedundant = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedLocation;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy