software.amazon.awssdk.services.kinesisanalytics.model.Input 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.kinesisanalytics.model;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
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.kinesisanalytics.transform.InputMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* When you configure the application input, you specify the streaming source, the in-application stream name that is
* created, and the mapping between the two. For more information, see Configuring Application
* Input.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class Input implements StructuredPojo, ToCopyableBuilder {
private final String namePrefix;
private final InputProcessingConfiguration inputProcessingConfiguration;
private final KinesisStreamsInput kinesisStreamsInput;
private final KinesisFirehoseInput kinesisFirehoseInput;
private final InputParallelism inputParallelism;
private final SourceSchema inputSchema;
private Input(BuilderImpl builder) {
this.namePrefix = builder.namePrefix;
this.inputProcessingConfiguration = builder.inputProcessingConfiguration;
this.kinesisStreamsInput = builder.kinesisStreamsInput;
this.kinesisFirehoseInput = builder.kinesisFirehoseInput;
this.inputParallelism = builder.inputParallelism;
this.inputSchema = builder.inputSchema;
}
/**
*
* Name prefix to use when creating in-application stream. Suppose you specify a prefix "MyInApplicationStream".
* Amazon Kinesis Analytics will then create one or more (as per the InputParallelism
count you
* specified) in-application streams with names "MyInApplicationStream_001", "MyInApplicationStream_002" and so on.
*
*
* @return Name prefix to use when creating in-application stream. Suppose you specify a prefix
* "MyInApplicationStream". Amazon Kinesis Analytics will then create one or more (as per the
* InputParallelism
count you specified) in-application streams with names
* "MyInApplicationStream_001", "MyInApplicationStream_002" and so on.
*/
public String namePrefix() {
return namePrefix;
}
/**
*
* The InputProcessingConfiguration for the Input. An input processor transforms records as they are received
* from the stream, before the application's SQL code executes. Currently, the only input processing configuration
* available is InputLambdaProcessor.
*
*
* @return The InputProcessingConfiguration for the Input. An input processor transforms records as they are
* received from the stream, before the application's SQL code executes. Currently, the only input
* processing configuration available is InputLambdaProcessor.
*/
public InputProcessingConfiguration inputProcessingConfiguration() {
return inputProcessingConfiguration;
}
/**
*
* If the streaming source is an Amazon Kinesis stream, identifies the stream's Amazon Resource Name (ARN) and an
* IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
*
* @return If the streaming source is an Amazon Kinesis stream, identifies the stream's Amazon Resource Name (ARN)
* and an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*/
public KinesisStreamsInput kinesisStreamsInput() {
return kinesisStreamsInput;
}
/**
*
* If the streaming source is an Amazon Kinesis Firehose delivery stream, identifies the Firehose delivery stream's
* ARN and an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
*
* @return If the streaming source is an Amazon Kinesis Firehose delivery stream, identifies the Firehose delivery
* stream's ARN and an IAM role that enables Amazon Kinesis Analytics to access the stream on your
* behalf.
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*/
public KinesisFirehoseInput kinesisFirehoseInput() {
return kinesisFirehoseInput;
}
/**
*
* Describes the number of in-application streams to create.
*
*
* Data from your source will be routed to these in-application input streams.
*
*
* (see Configuring
* Application Input.
*
*
* @return Describes the number of in-application streams to create.
*
* Data from your source will be routed to these in-application input streams.
*
*
* (see Configuring
* Application Input.
*/
public InputParallelism inputParallelism() {
return inputParallelism;
}
/**
*
* Describes the format of the data in the streaming source, and how each data element maps to corresponding columns
* in the in-application stream that is being created.
*
*
* Also used to describe the format of the reference data source.
*
*
* @return Describes the format of the data in the streaming source, and how each data element maps to corresponding
* columns in the in-application stream that is being created.
*
* Also used to describe the format of the reference data source.
*/
public SourceSchema inputSchema() {
return inputSchema;
}
@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(namePrefix());
hashCode = 31 * hashCode + Objects.hashCode(inputProcessingConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(kinesisStreamsInput());
hashCode = 31 * hashCode + Objects.hashCode(kinesisFirehoseInput());
hashCode = 31 * hashCode + Objects.hashCode(inputParallelism());
hashCode = 31 * hashCode + Objects.hashCode(inputSchema());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Input)) {
return false;
}
Input other = (Input) obj;
return Objects.equals(namePrefix(), other.namePrefix())
&& Objects.equals(inputProcessingConfiguration(), other.inputProcessingConfiguration())
&& Objects.equals(kinesisStreamsInput(), other.kinesisStreamsInput())
&& Objects.equals(kinesisFirehoseInput(), other.kinesisFirehoseInput())
&& Objects.equals(inputParallelism(), other.inputParallelism())
&& Objects.equals(inputSchema(), other.inputSchema());
}
@Override
public String toString() {
return ToString.builder("Input").add("NamePrefix", namePrefix())
.add("InputProcessingConfiguration", inputProcessingConfiguration())
.add("KinesisStreamsInput", kinesisStreamsInput()).add("KinesisFirehoseInput", kinesisFirehoseInput())
.add("InputParallelism", inputParallelism()).add("InputSchema", inputSchema()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NamePrefix":
return Optional.of(clazz.cast(namePrefix()));
case "InputProcessingConfiguration":
return Optional.of(clazz.cast(inputProcessingConfiguration()));
case "KinesisStreamsInput":
return Optional.of(clazz.cast(kinesisStreamsInput()));
case "KinesisFirehoseInput":
return Optional.of(clazz.cast(kinesisFirehoseInput()));
case "InputParallelism":
return Optional.of(clazz.cast(inputParallelism()));
case "InputSchema":
return Optional.of(clazz.cast(inputSchema()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
InputMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* Name prefix to use when creating in-application stream. Suppose you specify a prefix "MyInApplicationStream".
* Amazon Kinesis Analytics will then create one or more (as per the InputParallelism
count you
* specified) in-application streams with names "MyInApplicationStream_001", "MyInApplicationStream_002" and so
* on.
*
*
* @param namePrefix
* Name prefix to use when creating in-application stream. Suppose you specify a prefix
* "MyInApplicationStream". Amazon Kinesis Analytics will then create one or more (as per the
* InputParallelism
count you specified) in-application streams with names
* "MyInApplicationStream_001", "MyInApplicationStream_002" and so on.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder namePrefix(String namePrefix);
/**
*
* The InputProcessingConfiguration for the Input. An input processor transforms records as they are
* received from the stream, before the application's SQL code executes. Currently, the only input processing
* configuration available is InputLambdaProcessor.
*
*
* @param inputProcessingConfiguration
* The InputProcessingConfiguration for the Input. An input processor transforms records as they
* are received from the stream, before the application's SQL code executes. Currently, the only input
* processing configuration available is InputLambdaProcessor.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder inputProcessingConfiguration(InputProcessingConfiguration inputProcessingConfiguration);
/**
*
* The InputProcessingConfiguration for the Input. An input processor transforms records as they are
* received from the stream, before the application's SQL code executes. Currently, the only input processing
* configuration available is InputLambdaProcessor.
*
* This is a convenience that creates an instance of the {@link InputProcessingConfiguration.Builder} avoiding
* the need to create one manually via {@link InputProcessingConfiguration#builder()}.
*
* When the {@link Consumer} completes, {@link InputProcessingConfiguration.Builder#build()} is called
* immediately and its result is passed to {@link #inputProcessingConfiguration(InputProcessingConfiguration)}.
*
* @param inputProcessingConfiguration
* a consumer that will call methods on {@link InputProcessingConfiguration.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #inputProcessingConfiguration(InputProcessingConfiguration)
*/
default Builder inputProcessingConfiguration(Consumer inputProcessingConfiguration) {
return inputProcessingConfiguration(InputProcessingConfiguration.builder().apply(inputProcessingConfiguration)
.build());
}
/**
*
* If the streaming source is an Amazon Kinesis stream, identifies the stream's Amazon Resource Name (ARN) and
* an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
*
* @param kinesisStreamsInput
* If the streaming source is an Amazon Kinesis stream, identifies the stream's Amazon Resource Name
* (ARN) and an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kinesisStreamsInput(KinesisStreamsInput kinesisStreamsInput);
/**
*
* If the streaming source is an Amazon Kinesis stream, identifies the stream's Amazon Resource Name (ARN) and
* an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
* This is a convenience that creates an instance of the {@link KinesisStreamsInput.Builder} avoiding the need
* to create one manually via {@link KinesisStreamsInput#builder()}.
*
* When the {@link Consumer} completes, {@link KinesisStreamsInput.Builder#build()} is called immediately and
* its result is passed to {@link #kinesisStreamsInput(KinesisStreamsInput)}.
*
* @param kinesisStreamsInput
* a consumer that will call methods on {@link KinesisStreamsInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #kinesisStreamsInput(KinesisStreamsInput)
*/
default Builder kinesisStreamsInput(Consumer kinesisStreamsInput) {
return kinesisStreamsInput(KinesisStreamsInput.builder().apply(kinesisStreamsInput).build());
}
/**
*
* If the streaming source is an Amazon Kinesis Firehose delivery stream, identifies the Firehose delivery
* stream's ARN and an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
*
* @param kinesisFirehoseInput
* If the streaming source is an Amazon Kinesis Firehose delivery stream, identifies the Firehose
* delivery stream's ARN and an IAM role that enables Amazon Kinesis Analytics to access the stream on
* your behalf.
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kinesisFirehoseInput(KinesisFirehoseInput kinesisFirehoseInput);
/**
*
* If the streaming source is an Amazon Kinesis Firehose delivery stream, identifies the Firehose delivery
* stream's ARN and an IAM role that enables Amazon Kinesis Analytics to access the stream on your behalf.
*
*
* Note: Either KinesisStreamsInput
or KinesisFirehoseInput
is required.
*
* This is a convenience that creates an instance of the {@link KinesisFirehoseInput.Builder} avoiding the need
* to create one manually via {@link KinesisFirehoseInput#builder()}.
*
* When the {@link Consumer} completes, {@link KinesisFirehoseInput.Builder#build()} is called immediately and
* its result is passed to {@link #kinesisFirehoseInput(KinesisFirehoseInput)}.
*
* @param kinesisFirehoseInput
* a consumer that will call methods on {@link KinesisFirehoseInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #kinesisFirehoseInput(KinesisFirehoseInput)
*/
default Builder kinesisFirehoseInput(Consumer kinesisFirehoseInput) {
return kinesisFirehoseInput(KinesisFirehoseInput.builder().apply(kinesisFirehoseInput).build());
}
/**
*
* Describes the number of in-application streams to create.
*
*
* Data from your source will be routed to these in-application input streams.
*
*
* (see Configuring
* Application Input.
*
*
* @param inputParallelism
* Describes the number of in-application streams to create.
*
* Data from your source will be routed to these in-application input streams.
*
*
* (see Configuring
* Application Input.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder inputParallelism(InputParallelism inputParallelism);
/**
*
* Describes the number of in-application streams to create.
*
*
* Data from your source will be routed to these in-application input streams.
*
*
* (see Configuring
* Application Input.
*
* This is a convenience that creates an instance of the {@link InputParallelism.Builder} avoiding the need to
* create one manually via {@link InputParallelism#builder()}.
*
* When the {@link Consumer} completes, {@link InputParallelism.Builder#build()} is called immediately and its
* result is passed to {@link #inputParallelism(InputParallelism)}.
*
* @param inputParallelism
* a consumer that will call methods on {@link InputParallelism.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #inputParallelism(InputParallelism)
*/
default Builder inputParallelism(Consumer inputParallelism) {
return inputParallelism(InputParallelism.builder().apply(inputParallelism).build());
}
/**
*
* Describes the format of the data in the streaming source, and how each data element maps to corresponding
* columns in the in-application stream that is being created.
*
*
* Also used to describe the format of the reference data source.
*
*
* @param inputSchema
* Describes the format of the data in the streaming source, and how each data element maps to
* corresponding columns in the in-application stream that is being created.
*
* Also used to describe the format of the reference data source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder inputSchema(SourceSchema inputSchema);
/**
*
* Describes the format of the data in the streaming source, and how each data element maps to corresponding
* columns in the in-application stream that is being created.
*
*
* Also used to describe the format of the reference data source.
*
* This is a convenience that creates an instance of the {@link SourceSchema.Builder} avoiding the need to
* create one manually via {@link SourceSchema#builder()}.
*
* When the {@link Consumer} completes, {@link SourceSchema.Builder#build()} is called immediately and its
* result is passed to {@link #inputSchema(SourceSchema)}.
*
* @param inputSchema
* a consumer that will call methods on {@link SourceSchema.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #inputSchema(SourceSchema)
*/
default Builder inputSchema(Consumer inputSchema) {
return inputSchema(SourceSchema.builder().apply(inputSchema).build());
}
}
static final class BuilderImpl implements Builder {
private String namePrefix;
private InputProcessingConfiguration inputProcessingConfiguration;
private KinesisStreamsInput kinesisStreamsInput;
private KinesisFirehoseInput kinesisFirehoseInput;
private InputParallelism inputParallelism;
private SourceSchema inputSchema;
private BuilderImpl() {
}
private BuilderImpl(Input model) {
namePrefix(model.namePrefix);
inputProcessingConfiguration(model.inputProcessingConfiguration);
kinesisStreamsInput(model.kinesisStreamsInput);
kinesisFirehoseInput(model.kinesisFirehoseInput);
inputParallelism(model.inputParallelism);
inputSchema(model.inputSchema);
}
public final String getNamePrefix() {
return namePrefix;
}
@Override
public final Builder namePrefix(String namePrefix) {
this.namePrefix = namePrefix;
return this;
}
public final void setNamePrefix(String namePrefix) {
this.namePrefix = namePrefix;
}
public final InputProcessingConfiguration.Builder getInputProcessingConfiguration() {
return inputProcessingConfiguration != null ? inputProcessingConfiguration.toBuilder() : null;
}
@Override
public final Builder inputProcessingConfiguration(InputProcessingConfiguration inputProcessingConfiguration) {
this.inputProcessingConfiguration = inputProcessingConfiguration;
return this;
}
public final void setInputProcessingConfiguration(InputProcessingConfiguration.BuilderImpl inputProcessingConfiguration) {
this.inputProcessingConfiguration = inputProcessingConfiguration != null ? inputProcessingConfiguration.build()
: null;
}
public final KinesisStreamsInput.Builder getKinesisStreamsInput() {
return kinesisStreamsInput != null ? kinesisStreamsInput.toBuilder() : null;
}
@Override
public final Builder kinesisStreamsInput(KinesisStreamsInput kinesisStreamsInput) {
this.kinesisStreamsInput = kinesisStreamsInput;
return this;
}
public final void setKinesisStreamsInput(KinesisStreamsInput.BuilderImpl kinesisStreamsInput) {
this.kinesisStreamsInput = kinesisStreamsInput != null ? kinesisStreamsInput.build() : null;
}
public final KinesisFirehoseInput.Builder getKinesisFirehoseInput() {
return kinesisFirehoseInput != null ? kinesisFirehoseInput.toBuilder() : null;
}
@Override
public final Builder kinesisFirehoseInput(KinesisFirehoseInput kinesisFirehoseInput) {
this.kinesisFirehoseInput = kinesisFirehoseInput;
return this;
}
public final void setKinesisFirehoseInput(KinesisFirehoseInput.BuilderImpl kinesisFirehoseInput) {
this.kinesisFirehoseInput = kinesisFirehoseInput != null ? kinesisFirehoseInput.build() : null;
}
public final InputParallelism.Builder getInputParallelism() {
return inputParallelism != null ? inputParallelism.toBuilder() : null;
}
@Override
public final Builder inputParallelism(InputParallelism inputParallelism) {
this.inputParallelism = inputParallelism;
return this;
}
public final void setInputParallelism(InputParallelism.BuilderImpl inputParallelism) {
this.inputParallelism = inputParallelism != null ? inputParallelism.build() : null;
}
public final SourceSchema.Builder getInputSchema() {
return inputSchema != null ? inputSchema.toBuilder() : null;
}
@Override
public final Builder inputSchema(SourceSchema inputSchema) {
this.inputSchema = inputSchema;
return this;
}
public final void setInputSchema(SourceSchema.BuilderImpl inputSchema) {
this.inputSchema = inputSchema != null ? inputSchema.build() : null;
}
@Override
public Input build() {
return new Input(this);
}
}
}