software.amazon.awssdk.services.databasemigration.model.S3Settings Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2013-2018 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 software.amazon.awssdk.annotations.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.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final 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 #compressionTypeAsString}.
*
*
* @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 #compressionTypeAsString}.
*
*
* @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 compressionTypeAsString() {
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 + Objects.hashCode(serviceAccessRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(externalTableDefinition());
hashCode = 31 * hashCode + Objects.hashCode(csvRowDelimiter());
hashCode = 31 * hashCode + Objects.hashCode(csvDelimiter());
hashCode = 31 * hashCode + Objects.hashCode(bucketFolder());
hashCode = 31 * hashCode + Objects.hashCode(bucketName());
hashCode = 31 * hashCode + Objects.hashCode(compressionTypeAsString());
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;
return Objects.equals(serviceAccessRoleArn(), other.serviceAccessRoleArn())
&& Objects.equals(externalTableDefinition(), other.externalTableDefinition())
&& Objects.equals(csvRowDelimiter(), other.csvRowDelimiter())
&& Objects.equals(csvDelimiter(), other.csvDelimiter()) && Objects.equals(bucketFolder(), other.bucketFolder())
&& Objects.equals(bucketName(), other.bucketName())
&& Objects.equals(compressionTypeAsString(), other.compressionTypeAsString());
}
@Override
public String toString() {
return ToString.builder("S3Settings").add("ServiceAccessRoleArn", serviceAccessRoleArn())
.add("ExternalTableDefinition", externalTableDefinition()).add("CsvRowDelimiter", csvRowDelimiter())
.add("CsvDelimiter", csvDelimiter()).add("BucketFolder", bucketFolder()).add("BucketName", bucketName())
.add("CompressionType", compressionTypeAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ServiceAccessRoleArn":
return Optional.ofNullable(clazz.cast(serviceAccessRoleArn()));
case "ExternalTableDefinition":
return Optional.ofNullable(clazz.cast(externalTableDefinition()));
case "CsvRowDelimiter":
return Optional.ofNullable(clazz.cast(csvRowDelimiter()));
case "CsvDelimiter":
return Optional.ofNullable(clazz.cast(csvDelimiter()));
case "BucketFolder":
return Optional.ofNullable(clazz.cast(bucketFolder()));
case "BucketName":
return Optional.ofNullable(clazz.cast(bucketName()));
case "CompressionType":
return Optional.ofNullable(clazz.cast(compressionTypeAsString()));
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);
}
}
}