software.amazon.awssdk.services.firehose.model.CopyCommand Maven / Gradle / Ivy
Show all versions of kinesis 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.firehose.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.firehose.transform.CopyCommandMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a COPY
command for Amazon Redshift.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class CopyCommand implements StructuredPojo, ToCopyableBuilder {
private final String dataTableName;
private final String dataTableColumns;
private final String copyOptions;
private CopyCommand(BuilderImpl builder) {
this.dataTableName = builder.dataTableName;
this.dataTableColumns = builder.dataTableColumns;
this.copyOptions = builder.copyOptions;
}
/**
*
* The name of the target table. The table must already exist in the database.
*
*
* @return The name of the target table. The table must already exist in the database.
*/
public String dataTableName() {
return dataTableName;
}
/**
*
* A comma-separated list of column names.
*
*
* @return A comma-separated list of column names.
*/
public String dataTableColumns() {
return dataTableColumns;
}
/**
*
* Optional parameters to use with the Amazon Redshift COPY
command. For more information, see the
* "Optional Parameters" section of Amazon
* Redshift COPY command. Some possible examples that would apply to Kinesis Firehose are as follows:
*
*
* delimiter '\t' lzop;
- fields are delimited with "\t" (TAB character) and compressed using lzop.
*
*
* delimiter '|'
- fields are delimited with "|" (this is the default delimiter).
*
*
* delimiter '|' escape
- the delimiter should be escaped.
*
*
* fixedwidth 'venueid:3,venuename:25,venuecity:12,venuestate:2,venueseats:6'
- fields are fixed width
* in the source, with each width specified after every column in the table.
*
*
* JSON 's3://mybucket/jsonpaths.txt'
- data is in JSON format, and the path specified is the format of
* the data.
*
*
* For more examples, see Amazon Redshift COPY command
* examples.
*
*
* @return Optional parameters to use with the Amazon Redshift COPY
command. For more information, see
* the "Optional Parameters" section of Amazon Redshift COPY command. Some
* possible examples that would apply to Kinesis Firehose are as follows:
*
* delimiter '\t' lzop;
- fields are delimited with "\t" (TAB character) and compressed using
* lzop.
*
*
* delimiter '|'
- fields are delimited with "|" (this is the default delimiter).
*
*
* delimiter '|' escape
- the delimiter should be escaped.
*
*
* fixedwidth 'venueid:3,venuename:25,venuecity:12,venuestate:2,venueseats:6'
- fields are
* fixed width in the source, with each width specified after every column in the table.
*
*
* JSON 's3://mybucket/jsonpaths.txt'
- data is in JSON format, and the path specified is the
* format of the data.
*
*
* For more examples, see Amazon Redshift COPY
* command examples.
*/
public String copyOptions() {
return copyOptions;
}
@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(dataTableName());
hashCode = 31 * hashCode + Objects.hashCode(dataTableColumns());
hashCode = 31 * hashCode + Objects.hashCode(copyOptions());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CopyCommand)) {
return false;
}
CopyCommand other = (CopyCommand) obj;
return Objects.equals(dataTableName(), other.dataTableName())
&& Objects.equals(dataTableColumns(), other.dataTableColumns())
&& Objects.equals(copyOptions(), other.copyOptions());
}
@Override
public String toString() {
return ToString.builder("CopyCommand").add("DataTableName", dataTableName()).add("DataTableColumns", dataTableColumns())
.add("CopyOptions", copyOptions()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DataTableName":
return Optional.of(clazz.cast(dataTableName()));
case "DataTableColumns":
return Optional.of(clazz.cast(dataTableColumns()));
case "CopyOptions":
return Optional.of(clazz.cast(copyOptions()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
CopyCommandMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The name of the target table. The table must already exist in the database.
*
*
* @param dataTableName
* The name of the target table. The table must already exist in the database.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataTableName(String dataTableName);
/**
*
* A comma-separated list of column names.
*
*
* @param dataTableColumns
* A comma-separated list of column names.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataTableColumns(String dataTableColumns);
/**
*
* Optional parameters to use with the Amazon Redshift COPY
command. For more information, see the
* "Optional Parameters" section of Amazon
* Redshift COPY command. Some possible examples that would apply to Kinesis Firehose are as follows:
*
*
* delimiter '\t' lzop;
- fields are delimited with "\t" (TAB character) and compressed using lzop.
*
*
* delimiter '|'
- fields are delimited with "|" (this is the default delimiter).
*
*
* delimiter '|' escape
- the delimiter should be escaped.
*
*
* fixedwidth 'venueid:3,venuename:25,venuecity:12,venuestate:2,venueseats:6'
- fields are fixed
* width in the source, with each width specified after every column in the table.
*
*
* JSON 's3://mybucket/jsonpaths.txt'
- data is in JSON format, and the path specified is the
* format of the data.
*
*
* For more examples, see Amazon Redshift COPY
* command examples.
*
*
* @param copyOptions
* Optional parameters to use with the Amazon Redshift COPY
command. For more information,
* see the "Optional Parameters" section of Amazon Redshift COPY command.
* Some possible examples that would apply to Kinesis Firehose are as follows:
*
* delimiter '\t' lzop;
- fields are delimited with "\t" (TAB character) and compressed
* using lzop.
*
*
* delimiter '|'
- fields are delimited with "|" (this is the default delimiter).
*
*
* delimiter '|' escape
- the delimiter should be escaped.
*
*
* fixedwidth 'venueid:3,venuename:25,venuecity:12,venuestate:2,venueseats:6'
- fields are
* fixed width in the source, with each width specified after every column in the table.
*
*
* JSON 's3://mybucket/jsonpaths.txt'
- data is in JSON format, and the path specified is
* the format of the data.
*
*
* For more examples, see Amazon Redshift COPY
* command examples.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder copyOptions(String copyOptions);
}
static final class BuilderImpl implements Builder {
private String dataTableName;
private String dataTableColumns;
private String copyOptions;
private BuilderImpl() {
}
private BuilderImpl(CopyCommand model) {
dataTableName(model.dataTableName);
dataTableColumns(model.dataTableColumns);
copyOptions(model.copyOptions);
}
public final String getDataTableName() {
return dataTableName;
}
@Override
public final Builder dataTableName(String dataTableName) {
this.dataTableName = dataTableName;
return this;
}
public final void setDataTableName(String dataTableName) {
this.dataTableName = dataTableName;
}
public final String getDataTableColumns() {
return dataTableColumns;
}
@Override
public final Builder dataTableColumns(String dataTableColumns) {
this.dataTableColumns = dataTableColumns;
return this;
}
public final void setDataTableColumns(String dataTableColumns) {
this.dataTableColumns = dataTableColumns;
}
public final String getCopyOptions() {
return copyOptions;
}
@Override
public final Builder copyOptions(String copyOptions) {
this.copyOptions = copyOptions;
return this;
}
public final void setCopyOptions(String copyOptions) {
this.copyOptions = copyOptions;
}
@Override
public CopyCommand build() {
return new CopyCommand(this);
}
}
}