software.amazon.awssdk.services.rds.model.TenantDatabase Maven / Gradle / Ivy
Show all versions of rds 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.rds.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* A tenant database in the DB instance. This data type is an element in the response to the
* DescribeTenantDatabases
action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TenantDatabase implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TENANT_DATABASE_CREATE_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT).memberName("TenantDatabaseCreateTime")
.getter(getter(TenantDatabase::tenantDatabaseCreateTime)).setter(setter(Builder::tenantDatabaseCreateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TenantDatabaseCreateTime").build())
.build();
private static final SdkField DB_INSTANCE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBInstanceIdentifier").getter(getter(TenantDatabase::dbInstanceIdentifier))
.setter(setter(Builder::dbInstanceIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBInstanceIdentifier").build())
.build();
private static final SdkField TENANT_DB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TenantDBName").getter(getter(TenantDatabase::tenantDBName)).setter(setter(Builder::tenantDBName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TenantDBName").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(TenantDatabase::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField MASTER_USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MasterUsername").getter(getter(TenantDatabase::masterUsername)).setter(setter(Builder::masterUsername))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MasterUsername").build()).build();
private static final SdkField DBI_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DbiResourceId").getter(getter(TenantDatabase::dbiResourceId)).setter(setter(Builder::dbiResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DbiResourceId").build()).build();
private static final SdkField TENANT_DATABASE_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TenantDatabaseResourceId").getter(getter(TenantDatabase::tenantDatabaseResourceId))
.setter(setter(Builder::tenantDatabaseResourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TenantDatabaseResourceId").build())
.build();
private static final SdkField TENANT_DATABASE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TenantDatabaseARN").getter(getter(TenantDatabase::tenantDatabaseARN))
.setter(setter(Builder::tenantDatabaseARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TenantDatabaseARN").build()).build();
private static final SdkField CHARACTER_SET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CharacterSetName").getter(getter(TenantDatabase::characterSetName))
.setter(setter(Builder::characterSetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CharacterSetName").build()).build();
private static final SdkField NCHAR_CHARACTER_SET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NcharCharacterSetName").getter(getter(TenantDatabase::ncharCharacterSetName))
.setter(setter(Builder::ncharCharacterSetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NcharCharacterSetName").build())
.build();
private static final SdkField DELETION_PROTECTION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DeletionProtection").getter(getter(TenantDatabase::deletionProtection))
.setter(setter(Builder::deletionProtection))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeletionProtection").build())
.build();
private static final SdkField PENDING_MODIFIED_VALUES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("PendingModifiedValues")
.getter(getter(TenantDatabase::pendingModifiedValues)).setter(setter(Builder::pendingModifiedValues))
.constructor(TenantDatabasePendingModifiedValues::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PendingModifiedValues").build())
.build();
private static final SdkField> TAG_LIST_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("TagList")
.getter(getter(TenantDatabase::tagList))
.setter(setter(Builder::tagList))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagList").build(),
ListTrait
.builder()
.memberLocationName("Tag")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Tag").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
TENANT_DATABASE_CREATE_TIME_FIELD, DB_INSTANCE_IDENTIFIER_FIELD, TENANT_DB_NAME_FIELD, STATUS_FIELD,
MASTER_USERNAME_FIELD, DBI_RESOURCE_ID_FIELD, TENANT_DATABASE_RESOURCE_ID_FIELD, TENANT_DATABASE_ARN_FIELD,
CHARACTER_SET_NAME_FIELD, NCHAR_CHARACTER_SET_NAME_FIELD, DELETION_PROTECTION_FIELD, PENDING_MODIFIED_VALUES_FIELD,
TAG_LIST_FIELD));
private static final long serialVersionUID = 1L;
private final Instant tenantDatabaseCreateTime;
private final String dbInstanceIdentifier;
private final String tenantDBName;
private final String status;
private final String masterUsername;
private final String dbiResourceId;
private final String tenantDatabaseResourceId;
private final String tenantDatabaseARN;
private final String characterSetName;
private final String ncharCharacterSetName;
private final Boolean deletionProtection;
private final TenantDatabasePendingModifiedValues pendingModifiedValues;
private final List tagList;
private TenantDatabase(BuilderImpl builder) {
this.tenantDatabaseCreateTime = builder.tenantDatabaseCreateTime;
this.dbInstanceIdentifier = builder.dbInstanceIdentifier;
this.tenantDBName = builder.tenantDBName;
this.status = builder.status;
this.masterUsername = builder.masterUsername;
this.dbiResourceId = builder.dbiResourceId;
this.tenantDatabaseResourceId = builder.tenantDatabaseResourceId;
this.tenantDatabaseARN = builder.tenantDatabaseARN;
this.characterSetName = builder.characterSetName;
this.ncharCharacterSetName = builder.ncharCharacterSetName;
this.deletionProtection = builder.deletionProtection;
this.pendingModifiedValues = builder.pendingModifiedValues;
this.tagList = builder.tagList;
}
/**
*
* The creation time of the tenant database.
*
*
* @return The creation time of the tenant database.
*/
public final Instant tenantDatabaseCreateTime() {
return tenantDatabaseCreateTime;
}
/**
*
* The ID of the DB instance that contains the tenant database.
*
*
* @return The ID of the DB instance that contains the tenant database.
*/
public final String dbInstanceIdentifier() {
return dbInstanceIdentifier;
}
/**
*
* The database name of the tenant database.
*
*
* @return The database name of the tenant database.
*/
public final String tenantDBName() {
return tenantDBName;
}
/**
*
* The status of the tenant database.
*
*
* @return The status of the tenant database.
*/
public final String status() {
return status;
}
/**
*
* The master username of the tenant database.
*
*
* @return The master username of the tenant database.
*/
public final String masterUsername() {
return masterUsername;
}
/**
*
* The Amazon Web Services Region-unique, immutable identifier for the DB instance.
*
*
* @return The Amazon Web Services Region-unique, immutable identifier for the DB instance.
*/
public final String dbiResourceId() {
return dbiResourceId;
}
/**
*
* The Amazon Web Services Region-unique, immutable identifier for the tenant database.
*
*
* @return The Amazon Web Services Region-unique, immutable identifier for the tenant database.
*/
public final String tenantDatabaseResourceId() {
return tenantDatabaseResourceId;
}
/**
*
* The Amazon Resource Name (ARN) for the tenant database.
*
*
* @return The Amazon Resource Name (ARN) for the tenant database.
*/
public final String tenantDatabaseARN() {
return tenantDatabaseARN;
}
/**
*
* The character set of the tenant database.
*
*
* @return The character set of the tenant database.
*/
public final String characterSetName() {
return characterSetName;
}
/**
*
* The NCHAR
character set name of the tenant database.
*
*
* @return The NCHAR
character set name of the tenant database.
*/
public final String ncharCharacterSetName() {
return ncharCharacterSetName;
}
/**
*
* Specifies whether deletion protection is enabled for the DB instance.
*
*
* @return Specifies whether deletion protection is enabled for the DB instance.
*/
public final Boolean deletionProtection() {
return deletionProtection;
}
/**
*
* Information about pending changes for a tenant database.
*
*
* @return Information about pending changes for a tenant database.
*/
public final TenantDatabasePendingModifiedValues pendingModifiedValues() {
return pendingModifiedValues;
}
/**
* For responses, this returns true if the service returned a value for the TagList 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 hasTagList() {
return tagList != null && !(tagList instanceof SdkAutoConstructList);
}
/**
* Returns the value of the TagList property for this object.
*
* 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 #hasTagList} method.
*
*
* @return The value of the TagList property for this object.
*/
public final List tagList() {
return tagList;
}
@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(tenantDatabaseCreateTime());
hashCode = 31 * hashCode + Objects.hashCode(dbInstanceIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(tenantDBName());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(masterUsername());
hashCode = 31 * hashCode + Objects.hashCode(dbiResourceId());
hashCode = 31 * hashCode + Objects.hashCode(tenantDatabaseResourceId());
hashCode = 31 * hashCode + Objects.hashCode(tenantDatabaseARN());
hashCode = 31 * hashCode + Objects.hashCode(characterSetName());
hashCode = 31 * hashCode + Objects.hashCode(ncharCharacterSetName());
hashCode = 31 * hashCode + Objects.hashCode(deletionProtection());
hashCode = 31 * hashCode + Objects.hashCode(pendingModifiedValues());
hashCode = 31 * hashCode + Objects.hashCode(hasTagList() ? tagList() : 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 TenantDatabase)) {
return false;
}
TenantDatabase other = (TenantDatabase) obj;
return Objects.equals(tenantDatabaseCreateTime(), other.tenantDatabaseCreateTime())
&& Objects.equals(dbInstanceIdentifier(), other.dbInstanceIdentifier())
&& Objects.equals(tenantDBName(), other.tenantDBName()) && Objects.equals(status(), other.status())
&& Objects.equals(masterUsername(), other.masterUsername())
&& Objects.equals(dbiResourceId(), other.dbiResourceId())
&& Objects.equals(tenantDatabaseResourceId(), other.tenantDatabaseResourceId())
&& Objects.equals(tenantDatabaseARN(), other.tenantDatabaseARN())
&& Objects.equals(characterSetName(), other.characterSetName())
&& Objects.equals(ncharCharacterSetName(), other.ncharCharacterSetName())
&& Objects.equals(deletionProtection(), other.deletionProtection())
&& Objects.equals(pendingModifiedValues(), other.pendingModifiedValues()) && hasTagList() == other.hasTagList()
&& Objects.equals(tagList(), other.tagList());
}
/**
* 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("TenantDatabase").add("TenantDatabaseCreateTime", tenantDatabaseCreateTime())
.add("DBInstanceIdentifier", dbInstanceIdentifier()).add("TenantDBName", tenantDBName()).add("Status", status())
.add("MasterUsername", masterUsername()).add("DbiResourceId", dbiResourceId())
.add("TenantDatabaseResourceId", tenantDatabaseResourceId()).add("TenantDatabaseARN", tenantDatabaseARN())
.add("CharacterSetName", characterSetName()).add("NcharCharacterSetName", ncharCharacterSetName())
.add("DeletionProtection", deletionProtection()).add("PendingModifiedValues", pendingModifiedValues())
.add("TagList", hasTagList() ? tagList() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TenantDatabaseCreateTime":
return Optional.ofNullable(clazz.cast(tenantDatabaseCreateTime()));
case "DBInstanceIdentifier":
return Optional.ofNullable(clazz.cast(dbInstanceIdentifier()));
case "TenantDBName":
return Optional.ofNullable(clazz.cast(tenantDBName()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "MasterUsername":
return Optional.ofNullable(clazz.cast(masterUsername()));
case "DbiResourceId":
return Optional.ofNullable(clazz.cast(dbiResourceId()));
case "TenantDatabaseResourceId":
return Optional.ofNullable(clazz.cast(tenantDatabaseResourceId()));
case "TenantDatabaseARN":
return Optional.ofNullable(clazz.cast(tenantDatabaseARN()));
case "CharacterSetName":
return Optional.ofNullable(clazz.cast(characterSetName()));
case "NcharCharacterSetName":
return Optional.ofNullable(clazz.cast(ncharCharacterSetName()));
case "DeletionProtection":
return Optional.ofNullable(clazz.cast(deletionProtection()));
case "PendingModifiedValues":
return Optional.ofNullable(clazz.cast(pendingModifiedValues()));
case "TagList":
return Optional.ofNullable(clazz.cast(tagList()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function