
software.amazon.awssdk.services.kinesisanalytics.model.ReferenceDataSource Maven / Gradle / Ivy
/*
* Copyright 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.kinesisanalytics.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.Consumer;
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;
/**
*
* Describes the reference data source by providing the source information (S3 bucket name and object key name), the
* resulting in-application table name that is created, and the necessary schema to map the data elements in the Amazon
* S3 object to the in-application table.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReferenceDataSource implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableName").getter(getter(ReferenceDataSource::tableName)).setter(setter(Builder::tableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableName").build()).build();
private static final SdkField S3_REFERENCE_DATA_SOURCE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("S3ReferenceDataSource")
.getter(getter(ReferenceDataSource::s3ReferenceDataSource)).setter(setter(Builder::s3ReferenceDataSource))
.constructor(S3ReferenceDataSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3ReferenceDataSource").build())
.build();
private static final SdkField REFERENCE_SCHEMA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ReferenceSchema")
.getter(getter(ReferenceDataSource::referenceSchema)).setter(setter(Builder::referenceSchema))
.constructor(SourceSchema::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReferenceSchema").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TABLE_NAME_FIELD,
S3_REFERENCE_DATA_SOURCE_FIELD, REFERENCE_SCHEMA_FIELD));
private static final long serialVersionUID = 1L;
private final String tableName;
private final S3ReferenceDataSource s3ReferenceDataSource;
private final SourceSchema referenceSchema;
private ReferenceDataSource(BuilderImpl builder) {
this.tableName = builder.tableName;
this.s3ReferenceDataSource = builder.s3ReferenceDataSource;
this.referenceSchema = builder.referenceSchema;
}
/**
*
* Name of the in-application table to create.
*
*
* @return Name of the in-application table to create.
*/
public final String tableName() {
return tableName;
}
/**
*
* Identifies the S3 bucket and object that contains the reference data. Also identifies the IAM role Amazon Kinesis
* Analytics can assume to read this object on your behalf. An Amazon Kinesis Analytics application loads reference
* data only once. If the data changes, you call the UpdateApplication
operation to trigger reloading
* of data into your application.
*
*
* @return Identifies the S3 bucket and object that contains the reference data. Also identifies the IAM role Amazon
* Kinesis Analytics can assume to read this object on your behalf. An Amazon Kinesis Analytics application
* loads reference data only once. If the data changes, you call the UpdateApplication
* operation to trigger reloading of data into your application.
*/
public final S3ReferenceDataSource s3ReferenceDataSource() {
return s3ReferenceDataSource;
}
/**
*
* Describes the format of the data in the streaming source, and how each data element maps to corresponding columns
* created in the in-application stream.
*
*
* @return Describes the format of the data in the streaming source, and how each data element maps to corresponding
* columns created in the in-application stream.
*/
public final SourceSchema referenceSchema() {
return referenceSchema;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(tableName());
hashCode = 31 * hashCode + Objects.hashCode(s3ReferenceDataSource());
hashCode = 31 * hashCode + Objects.hashCode(referenceSchema());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ReferenceDataSource)) {
return false;
}
ReferenceDataSource other = (ReferenceDataSource) obj;
return Objects.equals(tableName(), other.tableName())
&& Objects.equals(s3ReferenceDataSource(), other.s3ReferenceDataSource())
&& Objects.equals(referenceSchema(), other.referenceSchema());
}
/**
* 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 final String toString() {
return ToString.builder("ReferenceDataSource").add("TableName", tableName())
.add("S3ReferenceDataSource", s3ReferenceDataSource()).add("ReferenceSchema", referenceSchema()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "S3ReferenceDataSource":
return Optional.ofNullable(clazz.cast(s3ReferenceDataSource()));
case "ReferenceSchema":
return Optional.ofNullable(clazz.cast(referenceSchema()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function