software.amazon.awssdk.services.databasemigration.model.MongoDbSettings Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2012-2017 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.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.databasemigration.transform.MongoDbSettingsMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public class MongoDbSettings implements StructuredPojo, ToCopyableBuilder {
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 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;
}
/**
*
* 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 #authTypeString}.
*
*
* @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 #authTypeString}.
*
*
* @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 authTypeString() {
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 #authMechanismString}.
*
*
* @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 #authMechanismString}.
*
*
* @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 authMechanismString() {
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 #nestingLevelString}.
*
*
* @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 #nestingLevelString}.
*
*
* @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 nestingLevelString() {
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;
}
@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(authTypeString());
hashCode = 31 * hashCode + Objects.hashCode(authMechanismString());
hashCode = 31 * hashCode + Objects.hashCode(nestingLevelString());
hashCode = 31 * hashCode + Objects.hashCode(extractDocId());
hashCode = 31 * hashCode + Objects.hashCode(docsToInvestigate());
hashCode = 31 * hashCode + Objects.hashCode(authSource());
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(authTypeString(), other.authTypeString())
&& Objects.equals(authMechanismString(), other.authMechanismString())
&& Objects.equals(nestingLevelString(), other.nestingLevelString())
&& Objects.equals(extractDocId(), other.extractDocId())
&& Objects.equals(docsToInvestigate(), other.docsToInvestigate())
&& Objects.equals(authSource(), other.authSource());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (username() != null) {
sb.append("Username: ").append(username()).append(",");
}
if (password() != null) {
sb.append("Password: ").append(password()).append(",");
}
if (serverName() != null) {
sb.append("ServerName: ").append(serverName()).append(",");
}
if (port() != null) {
sb.append("Port: ").append(port()).append(",");
}
if (databaseName() != null) {
sb.append("DatabaseName: ").append(databaseName()).append(",");
}
if (authTypeString() != null) {
sb.append("AuthType: ").append(authTypeString()).append(",");
}
if (authMechanismString() != null) {
sb.append("AuthMechanism: ").append(authMechanismString()).append(",");
}
if (nestingLevelString() != null) {
sb.append("NestingLevel: ").append(nestingLevelString()).append(",");
}
if (extractDocId() != null) {
sb.append("ExtractDocId: ").append(extractDocId()).append(",");
}
if (docsToInvestigate() != null) {
sb.append("DocsToInvestigate: ").append(docsToInvestigate()).append(",");
}
if (authSource() != null) {
sb.append("AuthSource: ").append(authSource()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Username":
return Optional.of(clazz.cast(username()));
case "Password":
return Optional.of(clazz.cast(password()));
case "ServerName":
return Optional.of(clazz.cast(serverName()));
case "Port":
return Optional.of(clazz.cast(port()));
case "DatabaseName":
return Optional.of(clazz.cast(databaseName()));
case "AuthType":
return Optional.of(clazz.cast(authTypeString()));
case "AuthMechanism":
return Optional.of(clazz.cast(authMechanismString()));
case "NestingLevel":
return Optional.of(clazz.cast(nestingLevelString()));
case "ExtractDocId":
return Optional.of(clazz.cast(extractDocId()));
case "DocsToInvestigate":
return Optional.of(clazz.cast(docsToInvestigate()));
case "AuthSource":
return Optional.of(clazz.cast(authSource()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
MongoDbSettingsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The user name you use to access the MongoDB source endpoint.
*
*
* @param username
* The user name you use to access the MongoDB source endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder username(String username);
/**
*
* The password for the user account you use to access the MongoDB source endpoint.
*
*
* @param password
* The password for the user account you use to access the MongoDB source endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder password(String password);
/**
*
* The name of the server on the MongoDB source endpoint.
*
*
* @param serverName
* The name of the server on the MongoDB source endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serverName(String serverName);
/**
*
* The port value for the MongoDB source endpoint.
*
*
* @param port
* The port value for the MongoDB source endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder port(Integer port);
/**
*
* The database name on the MongoDB source endpoint.
*
*
* @param databaseName
* The database name on the MongoDB source endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder databaseName(String 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.
*
*
* @param 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.
* @see AuthTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see AuthTypeValue
*/
Builder authType(String 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.
*
*
* @param 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.
* @see AuthTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see AuthTypeValue
*/
Builder authType(AuthTypeValue 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.
*
*
* @param 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.
* @see AuthMechanismValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see AuthMechanismValue
*/
Builder authMechanism(String 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.
*
*
* @param 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.
* @see AuthMechanismValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see AuthMechanismValue
*/
Builder authMechanism(AuthMechanismValue 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.
*
*
* @param 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.
* @see NestingLevelValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see NestingLevelValue
*/
Builder nestingLevel(String 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.
*
*
* @param 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.
* @see NestingLevelValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see NestingLevelValue
*/
Builder nestingLevel(NestingLevelValue nestingLevel);
/**
*
* Specifies the document ID. Use this attribute when NestingLevel
is set to NONE.
*
*
* Default value is false.
*
*
* @param extractDocId
* Specifies the document ID. Use this attribute when NestingLevel
is set to NONE.
*
* Default value is false.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder extractDocId(String 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.
*
*
* @param docsToInvestigate
* 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 Returns a reference to this object so that method calls can be chained together.
*/
Builder docsToInvestigate(String docsToInvestigate);
/**
*
* The MongoDB database name. This attribute is not used when authType=NO
.
*
*
* The default is admin.
*
*
* @param authSource
* The MongoDB database name. This attribute is not used when authType=NO
.
*
* The default is admin.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder authSource(String authSource);
}
static final class BuilderImpl implements Builder {
private String username;
private String password;
private String serverName;
private Integer port;
private String databaseName;
private String authType;
private String authMechanism;
private String nestingLevel;
private String extractDocId;
private String docsToInvestigate;
private String authSource;
private BuilderImpl() {
}
private BuilderImpl(MongoDbSettings model) {
username(model.username);
password(model.password);
serverName(model.serverName);
port(model.port);
databaseName(model.databaseName);
authType(model.authType);
authMechanism(model.authMechanism);
nestingLevel(model.nestingLevel);
extractDocId(model.extractDocId);
docsToInvestigate(model.docsToInvestigate);
authSource(model.authSource);
}
public final String getUsername() {
return username;
}
@Override
public final Builder username(String username) {
this.username = username;
return this;
}
public final void setUsername(String username) {
this.username = username;
}
public final String getPassword() {
return password;
}
@Override
public final Builder password(String password) {
this.password = password;
return this;
}
public final void setPassword(String password) {
this.password = password;
}
public final String getServerName() {
return serverName;
}
@Override
public final Builder serverName(String serverName) {
this.serverName = serverName;
return this;
}
public final void setServerName(String serverName) {
this.serverName = serverName;
}
public final Integer getPort() {
return port;
}
@Override
public final Builder port(Integer port) {
this.port = port;
return this;
}
public final void setPort(Integer port) {
this.port = port;
}
public final String getDatabaseName() {
return databaseName;
}
@Override
public final Builder databaseName(String databaseName) {
this.databaseName = databaseName;
return this;
}
public final void setDatabaseName(String databaseName) {
this.databaseName = databaseName;
}
public final String getAuthType() {
return authType;
}
@Override
public final Builder authType(String authType) {
this.authType = authType;
return this;
}
@Override
public final Builder authType(AuthTypeValue authType) {
this.authType(authType.toString());
return this;
}
public final void setAuthType(String authType) {
this.authType = authType;
}
public final String getAuthMechanism() {
return authMechanism;
}
@Override
public final Builder authMechanism(String authMechanism) {
this.authMechanism = authMechanism;
return this;
}
@Override
public final Builder authMechanism(AuthMechanismValue authMechanism) {
this.authMechanism(authMechanism.toString());
return this;
}
public final void setAuthMechanism(String authMechanism) {
this.authMechanism = authMechanism;
}
public final String getNestingLevel() {
return nestingLevel;
}
@Override
public final Builder nestingLevel(String nestingLevel) {
this.nestingLevel = nestingLevel;
return this;
}
@Override
public final Builder nestingLevel(NestingLevelValue nestingLevel) {
this.nestingLevel(nestingLevel.toString());
return this;
}
public final void setNestingLevel(String nestingLevel) {
this.nestingLevel = nestingLevel;
}
public final String getExtractDocId() {
return extractDocId;
}
@Override
public final Builder extractDocId(String extractDocId) {
this.extractDocId = extractDocId;
return this;
}
public final void setExtractDocId(String extractDocId) {
this.extractDocId = extractDocId;
}
public final String getDocsToInvestigate() {
return docsToInvestigate;
}
@Override
public final Builder docsToInvestigate(String docsToInvestigate) {
this.docsToInvestigate = docsToInvestigate;
return this;
}
public final void setDocsToInvestigate(String docsToInvestigate) {
this.docsToInvestigate = docsToInvestigate;
}
public final String getAuthSource() {
return authSource;
}
@Override
public final Builder authSource(String authSource) {
this.authSource = authSource;
return this;
}
public final void setAuthSource(String authSource) {
this.authSource = authSource;
}
@Override
public MongoDbSettings build() {
return new MongoDbSettings(this);
}
}
}