Class FailoverPolicy

java.lang.Object
com.azure.resourcemanager.cosmos.models.FailoverPolicy
All Implemented Interfaces:
com.azure.json.JsonSerializable<FailoverPolicy>

public final class FailoverPolicy extends Object implements com.azure.json.JsonSerializable<FailoverPolicy>
The failover policy for a given region of a database account.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of FailoverPolicy class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the failoverPriority property: The failover priority of the region.
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of FailoverPolicy from the JsonReader.
    id()
    Get the id property: The unique identifier of the region in which the database account replicates to.
    Get the locationName property: The name of the region in which the database account exists.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)
    void
    Validates the instance.
    withFailoverPriority(Integer failoverPriority)
    Set the failoverPriority property: The failover priority of the region.
    withLocationName(String locationName)
    Set the locationName property: The name of the region in which the database account exists.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • FailoverPolicy

      public FailoverPolicy()
      Creates an instance of FailoverPolicy class.
  • Method Details

    • id

      public String id()
      Get the id property: The unique identifier of the region in which the database account replicates to. Example: &lt;accountName&gt;-&lt;locationName&gt;.
      Returns:
      the id value.
    • locationName

      public String locationName()
      Get the locationName property: The name of the region in which the database account exists.
      Returns:
      the locationName value.
    • withLocationName

      public FailoverPolicy withLocationName(String locationName)
      Set the locationName property: The name of the region in which the database account exists.
      Parameters:
      locationName - the locationName value to set.
      Returns:
      the FailoverPolicy object itself.
    • failoverPriority

      public Integer failoverPriority()
      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.
      Returns:
      the failoverPriority value.
    • withFailoverPriority

      public FailoverPolicy withFailoverPriority(Integer 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.
      Parameters:
      failoverPriority - the failoverPriority value to set.
      Returns:
      the FailoverPolicy object itself.
    • validate

      public void validate()
      Validates the instance.
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<FailoverPolicy>
      Throws:
      IOException
    • fromJson

      public static FailoverPolicy fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of FailoverPolicy from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of FailoverPolicy 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 FailoverPolicy.