software.amazon.awssdk.services.databasemigration.model.S3Settings 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.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.S3SettingsMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public class S3Settings implements StructuredPojo, ToCopyableBuilder {
private final String serviceAccessRoleArn;
private final String externalTableDefinition;
private final String csvRowDelimiter;
private final String csvDelimiter;
private final String bucketFolder;
private final String bucketName;
private final String compressionType;
private S3Settings(BuilderImpl builder) {
this.serviceAccessRoleArn = builder.serviceAccessRoleArn;
this.externalTableDefinition = builder.externalTableDefinition;
this.csvRowDelimiter = builder.csvRowDelimiter;
this.csvDelimiter = builder.csvDelimiter;
this.bucketFolder = builder.bucketFolder;
this.bucketName = builder.bucketName;
this.compressionType = builder.compressionType;
}
/**
*
* The Amazon Resource Name (ARN) used by the service access IAM role.
*
*
* @return The Amazon Resource Name (ARN) used by the service access IAM role.
*/
public String serviceAccessRoleArn() {
return serviceAccessRoleArn;
}
/**
*
*
*
* @return
*/
public String externalTableDefinition() {
return externalTableDefinition;
}
/**
*
* The delimiter used to separate rows in the source files. The default is a carriage return (\n).
*
*
* @return The delimiter used to separate rows in the source files. The default is a carriage return (\n).
*/
public String csvRowDelimiter() {
return csvRowDelimiter;
}
/**
*
* The delimiter used to separate columns in the source files. The default is a comma.
*
*
* @return The delimiter used to separate columns in the source files. The default is a comma.
*/
public String csvDelimiter() {
return csvDelimiter;
}
/**
*
* An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path
* <bucketFolder>/<schema_name>/<table_name>/. If this parameter is not specified, then the path
* used is <schema_name>/<table_name>/.
*
*
* @return An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path
* <bucketFolder>/<schema_name>/<table_name>/. If this parameter is not specified, then
* the path used is <schema_name>/<table_name>/.
*/
public String bucketFolder() {
return bucketFolder;
}
/**
*
* The name of the S3 bucket.
*
*
* @return The name of the S3 bucket.
*/
public String bucketName() {
return bucketName;
}
/**
*
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to
* NONE (the default) or do not use to leave the files uncompressed.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType}
* will return {@link CompressionTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #compressionTypeString}.
*
*
* @return An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files.
* Set to NONE (the default) or do not use to leave the files uncompressed.
* @see CompressionTypeValue
*/
public CompressionTypeValue compressionType() {
return CompressionTypeValue.fromValue(compressionType);
}
/**
*
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to
* NONE (the default) or do not use to leave the files uncompressed.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType}
* will return {@link CompressionTypeValue#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #compressionTypeString}.
*
*
* @return An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files.
* Set to NONE (the default) or do not use to leave the files uncompressed.
* @see CompressionTypeValue
*/
public String compressionTypeString() {
return compressionType;
}
@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 + ((serviceAccessRoleArn() == null) ? 0 : serviceAccessRoleArn().hashCode());
hashCode = 31 * hashCode + ((externalTableDefinition() == null) ? 0 : externalTableDefinition().hashCode());
hashCode = 31 * hashCode + ((csvRowDelimiter() == null) ? 0 : csvRowDelimiter().hashCode());
hashCode = 31 * hashCode + ((csvDelimiter() == null) ? 0 : csvDelimiter().hashCode());
hashCode = 31 * hashCode + ((bucketFolder() == null) ? 0 : bucketFolder().hashCode());
hashCode = 31 * hashCode + ((bucketName() == null) ? 0 : bucketName().hashCode());
hashCode = 31 * hashCode + ((compressionTypeString() == null) ? 0 : compressionTypeString().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof S3Settings)) {
return false;
}
S3Settings other = (S3Settings) obj;
if (other.serviceAccessRoleArn() == null ^ this.serviceAccessRoleArn() == null) {
return false;
}
if (other.serviceAccessRoleArn() != null && !other.serviceAccessRoleArn().equals(this.serviceAccessRoleArn())) {
return false;
}
if (other.externalTableDefinition() == null ^ this.externalTableDefinition() == null) {
return false;
}
if (other.externalTableDefinition() != null && !other.externalTableDefinition().equals(this.externalTableDefinition())) {
return false;
}
if (other.csvRowDelimiter() == null ^ this.csvRowDelimiter() == null) {
return false;
}
if (other.csvRowDelimiter() != null && !other.csvRowDelimiter().equals(this.csvRowDelimiter())) {
return false;
}
if (other.csvDelimiter() == null ^ this.csvDelimiter() == null) {
return false;
}
if (other.csvDelimiter() != null && !other.csvDelimiter().equals(this.csvDelimiter())) {
return false;
}
if (other.bucketFolder() == null ^ this.bucketFolder() == null) {
return false;
}
if (other.bucketFolder() != null && !other.bucketFolder().equals(this.bucketFolder())) {
return false;
}
if (other.bucketName() == null ^ this.bucketName() == null) {
return false;
}
if (other.bucketName() != null && !other.bucketName().equals(this.bucketName())) {
return false;
}
if (other.compressionTypeString() == null ^ this.compressionTypeString() == null) {
return false;
}
if (other.compressionTypeString() != null && !other.compressionTypeString().equals(this.compressionTypeString())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (serviceAccessRoleArn() != null) {
sb.append("ServiceAccessRoleArn: ").append(serviceAccessRoleArn()).append(",");
}
if (externalTableDefinition() != null) {
sb.append("ExternalTableDefinition: ").append(externalTableDefinition()).append(",");
}
if (csvRowDelimiter() != null) {
sb.append("CsvRowDelimiter: ").append(csvRowDelimiter()).append(",");
}
if (csvDelimiter() != null) {
sb.append("CsvDelimiter: ").append(csvDelimiter()).append(",");
}
if (bucketFolder() != null) {
sb.append("BucketFolder: ").append(bucketFolder()).append(",");
}
if (bucketName() != null) {
sb.append("BucketName: ").append(bucketName()).append(",");
}
if (compressionTypeString() != null) {
sb.append("CompressionType: ").append(compressionTypeString()).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 "ServiceAccessRoleArn":
return Optional.of(clazz.cast(serviceAccessRoleArn()));
case "ExternalTableDefinition":
return Optional.of(clazz.cast(externalTableDefinition()));
case "CsvRowDelimiter":
return Optional.of(clazz.cast(csvRowDelimiter()));
case "CsvDelimiter":
return Optional.of(clazz.cast(csvDelimiter()));
case "BucketFolder":
return Optional.of(clazz.cast(bucketFolder()));
case "BucketName":
return Optional.of(clazz.cast(bucketName()));
case "CompressionType":
return Optional.of(clazz.cast(compressionTypeString()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
S3SettingsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) used by the service access IAM role.
*
*
* @param serviceAccessRoleArn
* The Amazon Resource Name (ARN) used by the service access IAM role.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceAccessRoleArn(String serviceAccessRoleArn);
/**
*
*
*
* @param externalTableDefinition
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder externalTableDefinition(String externalTableDefinition);
/**
*
* The delimiter used to separate rows in the source files. The default is a carriage return (\n).
*
*
* @param csvRowDelimiter
* The delimiter used to separate rows in the source files. The default is a carriage return (\n).
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder csvRowDelimiter(String csvRowDelimiter);
/**
*
* The delimiter used to separate columns in the source files. The default is a comma.
*
*
* @param csvDelimiter
* The delimiter used to separate columns in the source files. The default is a comma.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder csvDelimiter(String csvDelimiter);
/**
*
* An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path
* <bucketFolder>/<schema_name>/<table_name>/. If this parameter is not specified, then the
* path used is <schema_name>/<table_name>/.
*
*
* @param bucketFolder
* An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the
* path <bucketFolder>/<schema_name>/<table_name>/. If this parameter is not specified,
* then the path used is <schema_name>/<table_name>/.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder bucketFolder(String bucketFolder);
/**
*
* The name of the S3 bucket.
*
*
* @param bucketName
* The name of the S3 bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder bucketName(String bucketName);
/**
*
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set
* to NONE (the default) or do not use to leave the files uncompressed.
*
*
* @param compressionType
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target
* files. Set to NONE (the default) or do not use to leave the files uncompressed.
* @see CompressionTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see CompressionTypeValue
*/
Builder compressionType(String compressionType);
/**
*
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set
* to NONE (the default) or do not use to leave the files uncompressed.
*
*
* @param compressionType
* An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target
* files. Set to NONE (the default) or do not use to leave the files uncompressed.
* @see CompressionTypeValue
* @return Returns a reference to this object so that method calls can be chained together.
* @see CompressionTypeValue
*/
Builder compressionType(CompressionTypeValue compressionType);
}
static final class BuilderImpl implements Builder {
private String serviceAccessRoleArn;
private String externalTableDefinition;
private String csvRowDelimiter;
private String csvDelimiter;
private String bucketFolder;
private String bucketName;
private String compressionType;
private BuilderImpl() {
}
private BuilderImpl(S3Settings model) {
serviceAccessRoleArn(model.serviceAccessRoleArn);
externalTableDefinition(model.externalTableDefinition);
csvRowDelimiter(model.csvRowDelimiter);
csvDelimiter(model.csvDelimiter);
bucketFolder(model.bucketFolder);
bucketName(model.bucketName);
compressionType(model.compressionType);
}
public final String getServiceAccessRoleArn() {
return serviceAccessRoleArn;
}
@Override
public final Builder serviceAccessRoleArn(String serviceAccessRoleArn) {
this.serviceAccessRoleArn = serviceAccessRoleArn;
return this;
}
public final void setServiceAccessRoleArn(String serviceAccessRoleArn) {
this.serviceAccessRoleArn = serviceAccessRoleArn;
}
public final String getExternalTableDefinition() {
return externalTableDefinition;
}
@Override
public final Builder externalTableDefinition(String externalTableDefinition) {
this.externalTableDefinition = externalTableDefinition;
return this;
}
public final void setExternalTableDefinition(String externalTableDefinition) {
this.externalTableDefinition = externalTableDefinition;
}
public final String getCsvRowDelimiter() {
return csvRowDelimiter;
}
@Override
public final Builder csvRowDelimiter(String csvRowDelimiter) {
this.csvRowDelimiter = csvRowDelimiter;
return this;
}
public final void setCsvRowDelimiter(String csvRowDelimiter) {
this.csvRowDelimiter = csvRowDelimiter;
}
public final String getCsvDelimiter() {
return csvDelimiter;
}
@Override
public final Builder csvDelimiter(String csvDelimiter) {
this.csvDelimiter = csvDelimiter;
return this;
}
public final void setCsvDelimiter(String csvDelimiter) {
this.csvDelimiter = csvDelimiter;
}
public final String getBucketFolder() {
return bucketFolder;
}
@Override
public final Builder bucketFolder(String bucketFolder) {
this.bucketFolder = bucketFolder;
return this;
}
public final void setBucketFolder(String bucketFolder) {
this.bucketFolder = bucketFolder;
}
public final String getBucketName() {
return bucketName;
}
@Override
public final Builder bucketName(String bucketName) {
this.bucketName = bucketName;
return this;
}
public final void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
public final String getCompressionType() {
return compressionType;
}
@Override
public final Builder compressionType(String compressionType) {
this.compressionType = compressionType;
return this;
}
@Override
public final Builder compressionType(CompressionTypeValue compressionType) {
this.compressionType(compressionType.toString());
return this;
}
public final void setCompressionType(String compressionType) {
this.compressionType = compressionType;
}
@Override
public S3Settings build() {
return new S3Settings(this);
}
}
}