software.amazon.awssdk.services.databasemigration.model.MongoDbSettings Maven / Gradle / Ivy
Show all versions of databasemigration Show documentation
/*
* Copyright 2014-2019 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.databasemigration.model;
import java.io.Serializable;
import java.util.Arrays;
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.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MongoDbSettings implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::username)).setter(setter(Builder::username))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Username").build()).build();
private static final SdkField PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::password)).setter(setter(Builder::password))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build();
private static final SdkField SERVER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::serverName)).setter(setter(Builder::serverName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerName").build()).build();
private static final SdkField PORT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(MongoDbSettings::port)).setter(setter(Builder::port))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Port").build()).build();
private static final SdkField DATABASE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::databaseName)).setter(setter(Builder::databaseName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseName").build()).build();
private static final SdkField AUTH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::authTypeAsString)).setter(setter(Builder::authType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthType").build()).build();
private static final SdkField AUTH_MECHANISM_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::authMechanismAsString)).setter(setter(Builder::authMechanism))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthMechanism").build()).build();
private static final SdkField NESTING_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::nestingLevelAsString)).setter(setter(Builder::nestingLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NestingLevel").build()).build();
private static final SdkField EXTRACT_DOC_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::extractDocId)).setter(setter(Builder::extractDocId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExtractDocId").build()).build();
private static final SdkField DOCS_TO_INVESTIGATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::docsToInvestigate)).setter(setter(Builder::docsToInvestigate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocsToInvestigate").build()).build();
private static final SdkField AUTH_SOURCE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::authSource)).setter(setter(Builder::authSource))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthSource").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MongoDbSettings::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(USERNAME_FIELD,
PASSWORD_FIELD, SERVER_NAME_FIELD, PORT_FIELD, DATABASE_NAME_FIELD, AUTH_TYPE_FIELD, AUTH_MECHANISM_FIELD,
NESTING_LEVEL_FIELD, EXTRACT_DOC_ID_FIELD, DOCS_TO_INVESTIGATE_FIELD, AUTH_SOURCE_FIELD, KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String username;
private final String password;
private final String serverName;
private final Integer port;
private final String databaseName;
private final String authType;
private final String authMechanism;
private final String nestingLevel;
private final String extractDocId;
private final String docsToInvestigate;
private final String authSource;
private final String kmsKeyId;
private MongoDbSettings(BuilderImpl builder) {
this.username = builder.username;
this.password = builder.password;
this.serverName = builder.serverName;
this.port = builder.port;
this.databaseName = builder.databaseName;
this.authType = builder.authType;
this.authMechanism = builder.authMechanism;
this.nestingLevel = builder.nestingLevel;
this.extractDocId = builder.extractDocId;
this.docsToInvestigate = builder.docsToInvestigate;
this.authSource = builder.authSource;
this.kmsKeyId = builder.kmsKeyId;
}
/**
*
* The user name you use to access the MongoDB source endpoint.
*
*
* @return The user name you use to access the MongoDB source endpoint.
*/
public String username() {
return username;
}
/**
*
* The password for the user account you use to access the MongoDB source endpoint.
*
*
* @return The password for the user account you use to access the MongoDB source endpoint.
*/
public String password() {
return password;
}
/**
*
* The name of the server on the MongoDB source endpoint.
*
*
* @return The name of the server on the MongoDB source endpoint.
*/
public String serverName() {
return serverName;
}
/**
*
* The port value for the MongoDB source endpoint.
*
*
* @return The port value for the MongoDB source endpoint.
*/
public Integer port() {
return port;
}
/**
*
* The database name on the MongoDB source endpoint.
*
*
* @return The database name on the MongoDB source endpoint.
*/
public String databaseName() {
return databaseName;
}
/**
*
* The authentication type you use to access the MongoDB source endpoint.
*
*
* Valid values: NO, PASSWORD
*
*
* When NO is selected, user name and password parameters are not used and can be empty.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authType} will
* return {@link AuthTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authTypeAsString}.
*
*
* @return The authentication type you use to access the MongoDB source endpoint.
*
* Valid values: NO, PASSWORD
*
*
* When NO is selected, user name and password parameters are not used and can be empty.
* @see AuthTypeValue
*/
public AuthTypeValue authType() {
return AuthTypeValue.fromValue(authType);
}
/**
*
* The authentication type you use to access the MongoDB source endpoint.
*
*
* Valid values: NO, PASSWORD
*
*
* When NO is selected, user name and password parameters are not used and can be empty.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authType} will
* return {@link AuthTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authTypeAsString}.
*
*
* @return The authentication type you use to access the MongoDB source endpoint.
*
* Valid values: NO, PASSWORD
*
*
* When NO is selected, user name and password parameters are not used and can be empty.
* @see AuthTypeValue
*/
public String authTypeAsString() {
return authType;
}
/**
*
* The authentication mechanism you use to access the MongoDB source endpoint.
*
*
* Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
*
*
* DEFAULT – For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is
* not used when authType=No.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authMechanism}
* will return {@link AuthMechanismValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #authMechanismAsString}.
*
*
* @return The authentication mechanism you use to access the MongoDB source endpoint.
*
* Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
*
*
* DEFAULT – For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This
* attribute is not used when authType=No.
* @see AuthMechanismValue
*/
public AuthMechanismValue authMechanism() {
return AuthMechanismValue.fromValue(authMechanism);
}
/**
*
* The authentication mechanism you use to access the MongoDB source endpoint.
*
*
* Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
*
*
* DEFAULT – For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is
* not used when authType=No.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authMechanism}
* will return {@link AuthMechanismValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #authMechanismAsString}.
*
*
* @return The authentication mechanism you use to access the MongoDB source endpoint.
*
* Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
*
*
* DEFAULT – For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This
* attribute is not used when authType=No.
* @see AuthMechanismValue
*/
public String authMechanismAsString() {
return authMechanism;
}
/**
*
* Specifies either document or table mode.
*
*
* Valid values: NONE, ONE
*
*
* Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nestingLevel} will
* return {@link NestingLevelValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nestingLevelAsString}.
*
*
* @return Specifies either document or table mode.
*
* Valid values: NONE, ONE
*
*
* Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
* @see NestingLevelValue
*/
public NestingLevelValue nestingLevel() {
return NestingLevelValue.fromValue(nestingLevel);
}
/**
*
* Specifies either document or table mode.
*
*
* Valid values: NONE, ONE
*
*
* Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #nestingLevel} will
* return {@link NestingLevelValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nestingLevelAsString}.
*
*
* @return Specifies either document or table mode.
*
* Valid values: NONE, ONE
*
*
* Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
* @see NestingLevelValue
*/
public String nestingLevelAsString() {
return nestingLevel;
}
/**
*
* Specifies the document ID. Use this attribute when NestingLevel
is set to NONE.
*
*
* Default value is false.
*
*
* @return Specifies the document ID. Use this attribute when NestingLevel
is set to NONE.
*
* Default value is false.
*/
public String extractDocId() {
return extractDocId;
}
/**
*
* Indicates the number of documents to preview to determine the document organization. Use this attribute when
* NestingLevel
is set to ONE.
*
*
* Must be a positive value greater than 0. Default value is 1000.
*
*
* @return Indicates the number of documents to preview to determine the document organization. Use this attribute
* when NestingLevel
is set to ONE.
*
* Must be a positive value greater than 0. Default value is 1000.
*/
public String docsToInvestigate() {
return docsToInvestigate;
}
/**
*
* The MongoDB database name. This attribute is not used when authType=NO
.
*
*
* The default is admin.
*
*
* @return The MongoDB database name. This attribute is not used when authType=NO
.
*
* The default is admin.
*/
public String authSource() {
return authSource;
}
/**
*
* The AWS KMS key identifier that is used to encrypt the content on the replication instance. If you don't specify
* a value for the KmsKeyId
parameter, then AWS DMS uses your default encryption key. AWS KMS creates
* the default encryption key for your AWS account. Your AWS account has a different default encryption key for each
* AWS Region.
*
*
* @return The AWS KMS key identifier that is used to encrypt the content on the replication instance. If you don't
* specify a value for the KmsKeyId
parameter, then AWS DMS uses your default encryption key.
* AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default
* encryption key for each AWS Region.
*/
public String kmsKeyId() {
return kmsKeyId;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(username());
hashCode = 31 * hashCode + Objects.hashCode(password());
hashCode = 31 * hashCode + Objects.hashCode(serverName());
hashCode = 31 * hashCode + Objects.hashCode(port());
hashCode = 31 * hashCode + Objects.hashCode(databaseName());
hashCode = 31 * hashCode + Objects.hashCode(authTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(authMechanismAsString());
hashCode = 31 * hashCode + Objects.hashCode(nestingLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(extractDocId());
hashCode = 31 * hashCode + Objects.hashCode(docsToInvestigate());
hashCode = 31 * hashCode + Objects.hashCode(authSource());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MongoDbSettings)) {
return false;
}
MongoDbSettings other = (MongoDbSettings) obj;
return Objects.equals(username(), other.username()) && Objects.equals(password(), other.password())
&& Objects.equals(serverName(), other.serverName()) && Objects.equals(port(), other.port())
&& Objects.equals(databaseName(), other.databaseName())
&& Objects.equals(authTypeAsString(), other.authTypeAsString())
&& Objects.equals(authMechanismAsString(), other.authMechanismAsString())
&& Objects.equals(nestingLevelAsString(), other.nestingLevelAsString())
&& Objects.equals(extractDocId(), other.extractDocId())
&& Objects.equals(docsToInvestigate(), other.docsToInvestigate())
&& Objects.equals(authSource(), other.authSource()) && Objects.equals(kmsKeyId(), other.kmsKeyId());
}
/**
* 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 String toString() {
return ToString.builder("MongoDbSettings").add("Username", username())
.add("Password", password() == null ? null : "*** Sensitive Data Redacted ***").add("ServerName", serverName())
.add("Port", port()).add("DatabaseName", databaseName()).add("AuthType", authTypeAsString())
.add("AuthMechanism", authMechanismAsString()).add("NestingLevel", nestingLevelAsString())
.add("ExtractDocId", extractDocId()).add("DocsToInvestigate", docsToInvestigate())
.add("AuthSource", authSource()).add("KmsKeyId", kmsKeyId()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Username":
return Optional.ofNullable(clazz.cast(username()));
case "Password":
return Optional.ofNullable(clazz.cast(password()));
case "ServerName":
return Optional.ofNullable(clazz.cast(serverName()));
case "Port":
return Optional.ofNullable(clazz.cast(port()));
case "DatabaseName":
return Optional.ofNullable(clazz.cast(databaseName()));
case "AuthType":
return Optional.ofNullable(clazz.cast(authTypeAsString()));
case "AuthMechanism":
return Optional.ofNullable(clazz.cast(authMechanismAsString()));
case "NestingLevel":
return Optional.ofNullable(clazz.cast(nestingLevelAsString()));
case "ExtractDocId":
return Optional.ofNullable(clazz.cast(extractDocId()));
case "DocsToInvestigate":
return Optional.ofNullable(clazz.cast(docsToInvestigate()));
case "AuthSource":
return Optional.ofNullable(clazz.cast(authSource()));
case "KmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function