All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.qldb.model.StreamJournalToKinesisRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for QLDB module holds the client classes that are used for communicating with QLDB.

There is a newer version: 2.28.3
Show newest version
/*
 * 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.qldb.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.awscore.AwsRequestOverrideConfiguration;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 StreamJournalToKinesisRequest extends QldbRequest implements
        ToCopyableBuilder {
    private static final SdkField LEDGER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("LedgerName").getter(getter(StreamJournalToKinesisRequest::ledgerName))
            .setter(setter(Builder::ledgerName))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("name").build()).build();

    private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("RoleArn").getter(getter(StreamJournalToKinesisRequest::roleArn)).setter(setter(Builder::roleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(StreamJournalToKinesisRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField INCLUSIVE_START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("InclusiveStartTime").getter(getter(StreamJournalToKinesisRequest::inclusiveStartTime))
            .setter(setter(Builder::inclusiveStartTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InclusiveStartTime").build())
            .build();

    private static final SdkField EXCLUSIVE_END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("ExclusiveEndTime").getter(getter(StreamJournalToKinesisRequest::exclusiveEndTime))
            .setter(setter(Builder::exclusiveEndTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExclusiveEndTime").build()).build();

    private static final SdkField KINESIS_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("KinesisConfiguration")
            .getter(getter(StreamJournalToKinesisRequest::kinesisConfiguration)).setter(setter(Builder::kinesisConfiguration))
            .constructor(KinesisConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KinesisConfiguration").build())
            .build();

    private static final SdkField STREAM_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("StreamName").getter(getter(StreamJournalToKinesisRequest::streamName))
            .setter(setter(Builder::streamName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamName").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LEDGER_NAME_FIELD,
            ROLE_ARN_FIELD, TAGS_FIELD, INCLUSIVE_START_TIME_FIELD, EXCLUSIVE_END_TIME_FIELD, KINESIS_CONFIGURATION_FIELD,
            STREAM_NAME_FIELD));

    private final String ledgerName;

    private final String roleArn;

    private final Map tags;

    private final Instant inclusiveStartTime;

    private final Instant exclusiveEndTime;

    private final KinesisConfiguration kinesisConfiguration;

    private final String streamName;

    private StreamJournalToKinesisRequest(BuilderImpl builder) {
        super(builder);
        this.ledgerName = builder.ledgerName;
        this.roleArn = builder.roleArn;
        this.tags = builder.tags;
        this.inclusiveStartTime = builder.inclusiveStartTime;
        this.exclusiveEndTime = builder.exclusiveEndTime;
        this.kinesisConfiguration = builder.kinesisConfiguration;
        this.streamName = builder.streamName;
    }

    /**
     * 

* The name of the ledger. *

* * @return The name of the ledger. */ public final String ledgerName() { return ledgerName; } /** *

* The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write data * records to a Kinesis Data Streams resource. *

*

* To pass a role to QLDB when requesting a journal stream, you must have permissions to perform the * iam:PassRole action on the IAM role resource. This is required for all journal stream requests. *

* * @return The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write * data records to a Kinesis Data Streams resource.

*

* To pass a role to QLDB when requesting a journal stream, you must have permissions to perform the * iam:PassRole action on the IAM role resource. This is required for all journal stream * requests. */ public final String roleArn() { return roleArn; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. Tag values * are case sensitive and can be null. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. * Tag values are case sensitive and can be null. */ public final Map tags() { return tags; } /** *

* The inclusive start date and time from which to start streaming journal data. This parameter must be in * ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: * 2019-06-13T21:36:34Z. *

*

* The InclusiveStartTime cannot be in the future and must be before ExclusiveEndTime. *

*

* If you provide an InclusiveStartTime that is before the ledger's CreationDateTime, QLDB * effectively defaults it to the ledger's CreationDateTime. *

* * @return The inclusive start date and time from which to start streaming journal data. This parameter must be in * ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: * 2019-06-13T21:36:34Z.

*

* The InclusiveStartTime cannot be in the future and must be before * ExclusiveEndTime. *

*

* If you provide an InclusiveStartTime that is before the ledger's * CreationDateTime, QLDB effectively defaults it to the ledger's CreationDateTime. */ public final Instant inclusiveStartTime() { return inclusiveStartTime; } /** *

* The exclusive date and time that specifies when the stream ends. If you don't define this parameter, the stream * runs indefinitely until you cancel it. *

*

* The ExclusiveEndTime must be in ISO 8601 date and time format and in Universal * Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z. *

* * @return The exclusive date and time that specifies when the stream ends. If you don't define this parameter, the * stream runs indefinitely until you cancel it.

*

* The ExclusiveEndTime must be in ISO 8601 date and time format and in Universal * Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z. */ public final Instant exclusiveEndTime() { return exclusiveEndTime; } /** *

* The configuration settings of the Kinesis Data Streams destination for your stream request. *

* * @return The configuration settings of the Kinesis Data Streams destination for your stream request. */ public final KinesisConfiguration kinesisConfiguration() { return kinesisConfiguration; } /** *

* The name that you want to assign to the QLDB journal stream. User-defined names can help identify and indicate * the purpose of a stream. *

*

* Your stream name must be unique among other active streams for a given ledger. Stream names have the same * naming constraints as ledger names, as defined in Quotas in Amazon QLDB * in the Amazon QLDB Developer Guide. *

* * @return The name that you want to assign to the QLDB journal stream. User-defined names can help identify and * indicate the purpose of a stream.

*

* Your stream name must be unique among other active streams for a given ledger. Stream names have * the same naming constraints as ledger names, as defined in Quotas in Amazon * QLDB in the Amazon QLDB Developer Guide. */ public final String streamName() { return streamName; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(ledgerName()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(inclusiveStartTime()); hashCode = 31 * hashCode + Objects.hashCode(exclusiveEndTime()); hashCode = 31 * hashCode + Objects.hashCode(kinesisConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(streamName()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StreamJournalToKinesisRequest)) { return false; } StreamJournalToKinesisRequest other = (StreamJournalToKinesisRequest) obj; return Objects.equals(ledgerName(), other.ledgerName()) && Objects.equals(roleArn(), other.roleArn()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(inclusiveStartTime(), other.inclusiveStartTime()) && Objects.equals(exclusiveEndTime(), other.exclusiveEndTime()) && Objects.equals(kinesisConfiguration(), other.kinesisConfiguration()) && Objects.equals(streamName(), other.streamName()); } /** * 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("StreamJournalToKinesisRequest").add("LedgerName", ledgerName()).add("RoleArn", roleArn()) .add("Tags", hasTags() ? tags() : null).add("InclusiveStartTime", inclusiveStartTime()) .add("ExclusiveEndTime", exclusiveEndTime()).add("KinesisConfiguration", kinesisConfiguration()) .add("StreamName", streamName()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "LedgerName": return Optional.ofNullable(clazz.cast(ledgerName())); case "RoleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "InclusiveStartTime": return Optional.ofNullable(clazz.cast(inclusiveStartTime())); case "ExclusiveEndTime": return Optional.ofNullable(clazz.cast(exclusiveEndTime())); case "KinesisConfiguration": return Optional.ofNullable(clazz.cast(kinesisConfiguration())); case "StreamName": return Optional.ofNullable(clazz.cast(streamName())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StreamJournalToKinesisRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends QldbRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the ledger. *

* * @param ledgerName * The name of the ledger. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ledgerName(String ledgerName); /** *

* The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to write * data records to a Kinesis Data Streams resource. *

*

* To pass a role to QLDB when requesting a journal stream, you must have permissions to perform the * iam:PassRole action on the IAM role resource. This is required for all journal stream requests. *

* * @param roleArn * The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for a journal stream to * write data records to a Kinesis Data Streams resource.

*

* To pass a role to QLDB when requesting a journal stream, you must have permissions to perform the * iam:PassRole action on the IAM role resource. This is required for all journal stream * requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. Tag * values are case sensitive and can be null. *

* * @param tags * The key-value pairs to add as tags to the stream that you want to create. Tag keys are case sensitive. * Tag values are case sensitive and can be null. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The inclusive start date and time from which to start streaming journal data. This parameter must be in * ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: * 2019-06-13T21:36:34Z. *

*

* The InclusiveStartTime cannot be in the future and must be before ExclusiveEndTime. *

*

* If you provide an InclusiveStartTime that is before the ledger's CreationDateTime, * QLDB effectively defaults it to the ledger's CreationDateTime. *

* * @param inclusiveStartTime * The inclusive start date and time from which to start streaming journal data. This parameter must be * in ISO 8601 date and time format and in Universal Coordinated Time (UTC). For example: * 2019-06-13T21:36:34Z.

*

* The InclusiveStartTime cannot be in the future and must be before * ExclusiveEndTime. *

*

* If you provide an InclusiveStartTime that is before the ledger's * CreationDateTime, QLDB effectively defaults it to the ledger's * CreationDateTime. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inclusiveStartTime(Instant inclusiveStartTime); /** *

* The exclusive date and time that specifies when the stream ends. If you don't define this parameter, the * stream runs indefinitely until you cancel it. *

*

* The ExclusiveEndTime must be in ISO 8601 date and time format and in Universal * Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z. *

* * @param exclusiveEndTime * The exclusive date and time that specifies when the stream ends. If you don't define this parameter, * the stream runs indefinitely until you cancel it.

*

* The ExclusiveEndTime must be in ISO 8601 date and time format and in * Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exclusiveEndTime(Instant exclusiveEndTime); /** *

* The configuration settings of the Kinesis Data Streams destination for your stream request. *

* * @param kinesisConfiguration * The configuration settings of the Kinesis Data Streams destination for your stream request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kinesisConfiguration(KinesisConfiguration kinesisConfiguration); /** *

* The configuration settings of the Kinesis Data Streams destination for your stream request. *

* This is a convenience method that creates an instance of the {@link KinesisConfiguration.Builder} avoiding * the need to create one manually via {@link KinesisConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link KinesisConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #kinesisConfiguration(KinesisConfiguration)}. * * @param kinesisConfiguration * a consumer that will call methods on {@link KinesisConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #kinesisConfiguration(KinesisConfiguration) */ default Builder kinesisConfiguration(Consumer kinesisConfiguration) { return kinesisConfiguration(KinesisConfiguration.builder().applyMutation(kinesisConfiguration).build()); } /** *

* The name that you want to assign to the QLDB journal stream. User-defined names can help identify and * indicate the purpose of a stream. *

*

* Your stream name must be unique among other active streams for a given ledger. Stream names have the * same naming constraints as ledger names, as defined in Quotas in Amazon * QLDB in the Amazon QLDB Developer Guide. *

* * @param streamName * The name that you want to assign to the QLDB journal stream. User-defined names can help identify and * indicate the purpose of a stream.

*

* Your stream name must be unique among other active streams for a given ledger. Stream names * have the same naming constraints as ledger names, as defined in Quotas in * Amazon QLDB in the Amazon QLDB Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder streamName(String streamName); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends QldbRequest.BuilderImpl implements Builder { private String ledgerName; private String roleArn; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private Instant inclusiveStartTime; private Instant exclusiveEndTime; private KinesisConfiguration kinesisConfiguration; private String streamName; private BuilderImpl() { } private BuilderImpl(StreamJournalToKinesisRequest model) { super(model); ledgerName(model.ledgerName); roleArn(model.roleArn); tags(model.tags); inclusiveStartTime(model.inclusiveStartTime); exclusiveEndTime(model.exclusiveEndTime); kinesisConfiguration(model.kinesisConfiguration); streamName(model.streamName); } public final String getLedgerName() { return ledgerName; } public final void setLedgerName(String ledgerName) { this.ledgerName = ledgerName; } @Override public final Builder ledgerName(String ledgerName) { this.ledgerName = ledgerName; return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagsCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagsCopier.copy(tags); return this; } public final Instant getInclusiveStartTime() { return inclusiveStartTime; } public final void setInclusiveStartTime(Instant inclusiveStartTime) { this.inclusiveStartTime = inclusiveStartTime; } @Override public final Builder inclusiveStartTime(Instant inclusiveStartTime) { this.inclusiveStartTime = inclusiveStartTime; return this; } public final Instant getExclusiveEndTime() { return exclusiveEndTime; } public final void setExclusiveEndTime(Instant exclusiveEndTime) { this.exclusiveEndTime = exclusiveEndTime; } @Override public final Builder exclusiveEndTime(Instant exclusiveEndTime) { this.exclusiveEndTime = exclusiveEndTime; return this; } public final KinesisConfiguration.Builder getKinesisConfiguration() { return kinesisConfiguration != null ? kinesisConfiguration.toBuilder() : null; } public final void setKinesisConfiguration(KinesisConfiguration.BuilderImpl kinesisConfiguration) { this.kinesisConfiguration = kinesisConfiguration != null ? kinesisConfiguration.build() : null; } @Override public final Builder kinesisConfiguration(KinesisConfiguration kinesisConfiguration) { this.kinesisConfiguration = kinesisConfiguration; return this; } public final String getStreamName() { return streamName; } public final void setStreamName(String streamName) { this.streamName = streamName; } @Override public final Builder streamName(String streamName) { this.streamName = streamName; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StreamJournalToKinesisRequest build() { return new StreamJournalToKinesisRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy