software.amazon.awssdk.services.neptune.model.GlobalCluster Maven / Gradle / Ivy
Show all versions of neptune Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.neptune.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains the details of an Amazon Neptune global database.
*
*
* This data type is used as a response element for the CreateGlobalCluster, DescribeGlobalClusters,
* ModifyGlobalCluster, DeleteGlobalCluster, FailoverGlobalCluster, and
* RemoveFromGlobalCluster actions.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GlobalCluster implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField GLOBAL_CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalClusterIdentifier").getter(getter(GlobalCluster::globalClusterIdentifier))
.setter(setter(Builder::globalClusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalClusterIdentifier").build())
.build();
private static final SdkField GLOBAL_CLUSTER_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalClusterResourceId").getter(getter(GlobalCluster::globalClusterResourceId))
.setter(setter(Builder::globalClusterResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalClusterResourceId").build())
.build();
private static final SdkField GLOBAL_CLUSTER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalClusterArn").getter(getter(GlobalCluster::globalClusterArn))
.setter(setter(Builder::globalClusterArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalClusterArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(GlobalCluster::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField ENGINE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Engine")
.getter(getter(GlobalCluster::engine)).setter(setter(Builder::engine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Engine").build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineVersion").getter(getter(GlobalCluster::engineVersion)).setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField STORAGE_ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("StorageEncrypted").getter(getter(GlobalCluster::storageEncrypted))
.setter(setter(Builder::storageEncrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageEncrypted").build()).build();
private static final SdkField DELETION_PROTECTION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DeletionProtection").getter(getter(GlobalCluster::deletionProtection))
.setter(setter(Builder::deletionProtection))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeletionProtection").build())
.build();
private static final SdkField> GLOBAL_CLUSTER_MEMBERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("GlobalClusterMembers")
.getter(getter(GlobalCluster::globalClusterMembers))
.setter(setter(Builder::globalClusterMembers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalClusterMembers").build(),
ListTrait
.builder()
.memberLocationName("GlobalClusterMember")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GlobalClusterMember::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalClusterMember").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(GLOBAL_CLUSTER_IDENTIFIER_FIELD, GLOBAL_CLUSTER_RESOURCE_ID_FIELD,
GLOBAL_CLUSTER_ARN_FIELD, STATUS_FIELD, ENGINE_FIELD, ENGINE_VERSION_FIELD, STORAGE_ENCRYPTED_FIELD,
DELETION_PROTECTION_FIELD, GLOBAL_CLUSTER_MEMBERS_FIELD));
private static final long serialVersionUID = 1L;
private final String globalClusterIdentifier;
private final String globalClusterResourceId;
private final String globalClusterArn;
private final String status;
private final String engine;
private final String engineVersion;
private final Boolean storageEncrypted;
private final Boolean deletionProtection;
private final List globalClusterMembers;
private GlobalCluster(BuilderImpl builder) {
this.globalClusterIdentifier = builder.globalClusterIdentifier;
this.globalClusterResourceId = builder.globalClusterResourceId;
this.globalClusterArn = builder.globalClusterArn;
this.status = builder.status;
this.engine = builder.engine;
this.engineVersion = builder.engineVersion;
this.storageEncrypted = builder.storageEncrypted;
this.deletionProtection = builder.deletionProtection;
this.globalClusterMembers = builder.globalClusterMembers;
}
/**
*
* Contains a user-supplied global database cluster identifier. This identifier is the unique key that identifies a
* global database.
*
*
* @return Contains a user-supplied global database cluster identifier. This identifier is the unique key that
* identifies a global database.
*/
public final String globalClusterIdentifier() {
return globalClusterIdentifier;
}
/**
*
* An immutable identifier for the global database that is unique within in all regions. This identifier is found in
* CloudTrail log entries whenever the KMS key for the DB cluster is accessed.
*
*
* @return An immutable identifier for the global database that is unique within in all regions. This identifier is
* found in CloudTrail log entries whenever the KMS key for the DB cluster is accessed.
*/
public final String globalClusterResourceId() {
return globalClusterResourceId;
}
/**
*
* The Amazon Resource Name (ARN) for the global database.
*
*
* @return The Amazon Resource Name (ARN) for the global database.
*/
public final String globalClusterArn() {
return globalClusterArn;
}
/**
*
* Specifies the current state of this global database.
*
*
* @return Specifies the current state of this global database.
*/
public final String status() {
return status;
}
/**
*
* The Neptune database engine used by the global database ("neptune"
).
*
*
* @return The Neptune database engine used by the global database ("neptune"
).
*/
public final String engine() {
return engine;
}
/**
*
* The Neptune engine version used by the global database.
*
*
* @return The Neptune engine version used by the global database.
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* The storage encryption setting for the global database.
*
*
* @return The storage encryption setting for the global database.
*/
public final Boolean storageEncrypted() {
return storageEncrypted;
}
/**
*
* The deletion protection setting for the global database.
*
*
* @return The deletion protection setting for the global database.
*/
public final Boolean deletionProtection() {
return deletionProtection;
}
/**
* For responses, this returns true if the service returned a value for the GlobalClusterMembers property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasGlobalClusterMembers() {
return globalClusterMembers != null && !(globalClusterMembers instanceof SdkAutoConstructList);
}
/**
*
* A list of cluster ARNs and instance ARNs for all the DB clusters that are part of the global database.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasGlobalClusterMembers} method.
*
*
* @return A list of cluster ARNs and instance ARNs for all the DB clusters that are part of the global database.
*/
public final List globalClusterMembers() {
return globalClusterMembers;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(globalClusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(globalClusterResourceId());
hashCode = 31 * hashCode + Objects.hashCode(globalClusterArn());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(engine());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(storageEncrypted());
hashCode = 31 * hashCode + Objects.hashCode(deletionProtection());
hashCode = 31 * hashCode + Objects.hashCode(hasGlobalClusterMembers() ? globalClusterMembers() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GlobalCluster)) {
return false;
}
GlobalCluster other = (GlobalCluster) obj;
return Objects.equals(globalClusterIdentifier(), other.globalClusterIdentifier())
&& Objects.equals(globalClusterResourceId(), other.globalClusterResourceId())
&& Objects.equals(globalClusterArn(), other.globalClusterArn()) && Objects.equals(status(), other.status())
&& Objects.equals(engine(), other.engine()) && Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(storageEncrypted(), other.storageEncrypted())
&& Objects.equals(deletionProtection(), other.deletionProtection())
&& hasGlobalClusterMembers() == other.hasGlobalClusterMembers()
&& Objects.equals(globalClusterMembers(), other.globalClusterMembers());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("GlobalCluster").add("GlobalClusterIdentifier", globalClusterIdentifier())
.add("GlobalClusterResourceId", globalClusterResourceId()).add("GlobalClusterArn", globalClusterArn())
.add("Status", status()).add("Engine", engine()).add("EngineVersion", engineVersion())
.add("StorageEncrypted", storageEncrypted()).add("DeletionProtection", deletionProtection())
.add("GlobalClusterMembers", hasGlobalClusterMembers() ? globalClusterMembers() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GlobalClusterIdentifier":
return Optional.ofNullable(clazz.cast(globalClusterIdentifier()));
case "GlobalClusterResourceId":
return Optional.ofNullable(clazz.cast(globalClusterResourceId()));
case "GlobalClusterArn":
return Optional.ofNullable(clazz.cast(globalClusterArn()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "Engine":
return Optional.ofNullable(clazz.cast(engine()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "StorageEncrypted":
return Optional.ofNullable(clazz.cast(storageEncrypted()));
case "DeletionProtection":
return Optional.ofNullable(clazz.cast(deletionProtection()));
case "GlobalClusterMembers":
return Optional.ofNullable(clazz.cast(globalClusterMembers()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function