org.mongodb.awscdk.resources.mongodbatlas.ReadPreference Maven / Gradle / Ivy
Show all versions of awscdk-resources-mongodbatlas Show documentation
package org.mongodb.awscdk.resources.mongodbatlas;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.101.0 (build b95fe5d)", date = "2024-07-30T09:54:29.056Z")
@software.amazon.jsii.Jsii(module = org.mongodb.awscdk.resources.mongodbatlas.$Module.class, fqn = "awscdk-resources-mongodbatlas.ReadPreference")
@software.amazon.jsii.Jsii.Proxy(ReadPreference.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface ReadPreference extends software.amazon.jsii.JsiiSerializable {
/**
* Maximum replication lag, or staleness, for reads from secondaries.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getMaxStalenessSeconds() {
return null;
}
/**
* "primary" "primaryPreferred" "secondary" "secondaryPreferred" "nearest" Read preference mode that specifies to which replica set member to route the read requests.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getMode() {
return null;
}
/**
* List that contains tag sets or tag specification documents.
*
* If specified, Atlas Data Lake routes read requests to replica set member or members that are associated with the specified tags.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List> getTagSets() {
return null;
}
/**
* @return a {@link Builder} of {@link ReadPreference}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ReadPreference}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String maxStalenessSeconds;
java.lang.String mode;
java.util.List> tagSets;
/**
* Sets the value of {@link ReadPreference#getMaxStalenessSeconds}
* @param maxStalenessSeconds Maximum replication lag, or staleness, for reads from secondaries.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder maxStalenessSeconds(java.lang.String maxStalenessSeconds) {
this.maxStalenessSeconds = maxStalenessSeconds;
return this;
}
/**
* Sets the value of {@link ReadPreference#getMode}
* @param mode "primary" "primaryPreferred" "secondary" "secondaryPreferred" "nearest" Read preference mode that specifies to which replica set member to route the read requests.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder mode(java.lang.String mode) {
this.mode = mode;
return this;
}
/**
* Sets the value of {@link ReadPreference#getTagSets}
* @param tagSets List that contains tag sets or tag specification documents.
* If specified, Atlas Data Lake routes read requests to replica set member or members that are associated with the specified tags.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder tagSets(java.util.List extends java.util.List extends org.mongodb.awscdk.resources.mongodbatlas.TagSet>> tagSets) {
this.tagSets = (java.util.List>)tagSets;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ReadPreference}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public ReadPreference build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ReadPreference}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ReadPreference {
private final java.lang.String maxStalenessSeconds;
private final java.lang.String mode;
private final java.util.List> tagSets;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.maxStalenessSeconds = software.amazon.jsii.Kernel.get(this, "maxStalenessSeconds", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.mode = software.amazon.jsii.Kernel.get(this, "mode", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.tagSets = software.amazon.jsii.Kernel.get(this, "tagSets", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.mongodb.awscdk.resources.mongodbatlas.TagSet.class))));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.maxStalenessSeconds = builder.maxStalenessSeconds;
this.mode = builder.mode;
this.tagSets = (java.util.List>)builder.tagSets;
}
@Override
public final java.lang.String getMaxStalenessSeconds() {
return this.maxStalenessSeconds;
}
@Override
public final java.lang.String getMode() {
return this.mode;
}
@Override
public final java.util.List> getTagSets() {
return this.tagSets;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getMaxStalenessSeconds() != null) {
data.set("maxStalenessSeconds", om.valueToTree(this.getMaxStalenessSeconds()));
}
if (this.getMode() != null) {
data.set("mode", om.valueToTree(this.getMode()));
}
if (this.getTagSets() != null) {
data.set("tagSets", om.valueToTree(this.getTagSets()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("awscdk-resources-mongodbatlas.ReadPreference"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReadPreference.Jsii$Proxy that = (ReadPreference.Jsii$Proxy) o;
if (this.maxStalenessSeconds != null ? !this.maxStalenessSeconds.equals(that.maxStalenessSeconds) : that.maxStalenessSeconds != null) return false;
if (this.mode != null ? !this.mode.equals(that.mode) : that.mode != null) return false;
return this.tagSets != null ? this.tagSets.equals(that.tagSets) : that.tagSets == null;
}
@Override
public final int hashCode() {
int result = this.maxStalenessSeconds != null ? this.maxStalenessSeconds.hashCode() : 0;
result = 31 * result + (this.mode != null ? this.mode.hashCode() : 0);
result = 31 * result + (this.tagSets != null ? this.tagSets.hashCode() : 0);
return result;
}
}
}