
software.amazon.awssdk.services.qldb.model.JournalKinesisStreamDescription 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.qldb.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Information about an Amazon QLDB journal stream, including the Amazon Resource Name (ARN), stream name, creation
* time, current status, and the parameters of the original stream creation request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JournalKinesisStreamDescription implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LEDGER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LedgerName").getter(getter(JournalKinesisStreamDescription::ledgerName))
.setter(setter(Builder::ledgerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LedgerName").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(JournalKinesisStreamDescription::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField INCLUSIVE_START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("InclusiveStartTime").getter(getter(JournalKinesisStreamDescription::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(JournalKinesisStreamDescription::exclusiveEndTime))
.setter(setter(Builder::exclusiveEndTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExclusiveEndTime").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(JournalKinesisStreamDescription::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField STREAM_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamId").getter(getter(JournalKinesisStreamDescription::streamId)).setter(setter(Builder::streamId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StreamId").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(JournalKinesisStreamDescription::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(JournalKinesisStreamDescription::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField KINESIS_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("KinesisConfiguration")
.getter(getter(JournalKinesisStreamDescription::kinesisConfiguration)).setter(setter(Builder::kinesisConfiguration))
.constructor(KinesisConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KinesisConfiguration").build())
.build();
private static final SdkField ERROR_CAUSE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorCause").getter(getter(JournalKinesisStreamDescription::errorCauseAsString))
.setter(setter(Builder::errorCause))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorCause").build()).build();
private static final SdkField STREAM_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StreamName").getter(getter(JournalKinesisStreamDescription::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,
CREATION_TIME_FIELD, INCLUSIVE_START_TIME_FIELD, EXCLUSIVE_END_TIME_FIELD, ROLE_ARN_FIELD, STREAM_ID_FIELD,
ARN_FIELD, STATUS_FIELD, KINESIS_CONFIGURATION_FIELD, ERROR_CAUSE_FIELD, STREAM_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String ledgerName;
private final Instant creationTime;
private final Instant inclusiveStartTime;
private final Instant exclusiveEndTime;
private final String roleArn;
private final String streamId;
private final String arn;
private final String status;
private final KinesisConfiguration kinesisConfiguration;
private final String errorCause;
private final String streamName;
private JournalKinesisStreamDescription(BuilderImpl builder) {
this.ledgerName = builder.ledgerName;
this.creationTime = builder.creationTime;
this.inclusiveStartTime = builder.inclusiveStartTime;
this.exclusiveEndTime = builder.exclusiveEndTime;
this.roleArn = builder.roleArn;
this.streamId = builder.streamId;
this.arn = builder.arn;
this.status = builder.status;
this.kinesisConfiguration = builder.kinesisConfiguration;
this.errorCause = builder.errorCause;
this.streamName = builder.streamName;
}
/**
*
* The name of the ledger.
*
*
* @return The name of the ledger.
*/
public final String ledgerName() {
return ledgerName;
}
/**
*
* The date and time, in epoch time format, when the QLDB journal stream was created. (Epoch time format is the
* number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)
*
*
* @return The date and time, in epoch time format, when the QLDB journal stream was created. (Epoch time format is
* the number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The inclusive start date and time from which to start streaming journal data.
*
*
* @return The inclusive start date and time from which to start streaming journal data.
*/
public final Instant inclusiveStartTime() {
return inclusiveStartTime;
}
/**
*
* The exclusive date and time that specifies when the stream ends. If this parameter is undefined, the stream runs
* indefinitely until you cancel it.
*
*
* @return The exclusive date and time that specifies when the stream ends. If this parameter is undefined, the
* stream runs indefinitely until you cancel it.
*/
public final Instant exclusiveEndTime() {
return exclusiveEndTime;
}
/**
*
* 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.
*
*
* @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.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The UUID (represented in Base62-encoded text) of the QLDB journal stream.
*
*
* @return The UUID (represented in Base62-encoded text) of the QLDB journal stream.
*/
public final String streamId() {
return streamId;
}
/**
*
* The Amazon Resource Name (ARN) of the QLDB journal stream.
*
*
* @return The Amazon Resource Name (ARN) of the QLDB journal stream.
*/
public final String arn() {
return arn;
}
/**
*
* The current state of the QLDB journal stream.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current state of the QLDB journal stream.
* @see StreamStatus
*/
public final StreamStatus status() {
return StreamStatus.fromValue(status);
}
/**
*
* The current state of the QLDB journal stream.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current state of the QLDB journal stream.
* @see StreamStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The configuration settings of the Amazon Kinesis Data Streams destination for a QLDB journal stream.
*
*
* @return The configuration settings of the Amazon Kinesis Data Streams destination for a QLDB journal stream.
*/
public final KinesisConfiguration kinesisConfiguration() {
return kinesisConfiguration;
}
/**
*
* The error message that describes the reason that a stream has a status of IMPAIRED
or
* FAILED
. This is not applicable to streams that have other status values.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #errorCause} will
* return {@link ErrorCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #errorCauseAsString}.
*
*
* @return The error message that describes the reason that a stream has a status of IMPAIRED
or
* FAILED
. This is not applicable to streams that have other status values.
* @see ErrorCause
*/
public final ErrorCause errorCause() {
return ErrorCause.fromValue(errorCause);
}
/**
*
* The error message that describes the reason that a stream has a status of IMPAIRED
or
* FAILED
. This is not applicable to streams that have other status values.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #errorCause} will
* return {@link ErrorCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #errorCauseAsString}.
*
*
* @return The error message that describes the reason that a stream has a status of IMPAIRED
or
* FAILED
. This is not applicable to streams that have other status values.
* @see ErrorCause
*/
public final String errorCauseAsString() {
return errorCause;
}
/**
*
* The user-defined name of the QLDB journal stream.
*
*
* @return The user-defined name of the QLDB journal stream.
*/
public final String streamName() {
return streamName;
}
@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(ledgerName());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(inclusiveStartTime());
hashCode = 31 * hashCode + Objects.hashCode(exclusiveEndTime());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(streamId());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(kinesisConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(errorCauseAsString());
hashCode = 31 * hashCode + Objects.hashCode(streamName());
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 JournalKinesisStreamDescription)) {
return false;
}
JournalKinesisStreamDescription other = (JournalKinesisStreamDescription) obj;
return Objects.equals(ledgerName(), other.ledgerName()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(inclusiveStartTime(), other.inclusiveStartTime())
&& Objects.equals(exclusiveEndTime(), other.exclusiveEndTime()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(streamId(), other.streamId()) && Objects.equals(arn(), other.arn())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(kinesisConfiguration(), other.kinesisConfiguration())
&& Objects.equals(errorCauseAsString(), other.errorCauseAsString())
&& 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("JournalKinesisStreamDescription").add("LedgerName", ledgerName())
.add("CreationTime", creationTime()).add("InclusiveStartTime", inclusiveStartTime())
.add("ExclusiveEndTime", exclusiveEndTime()).add("RoleArn", roleArn()).add("StreamId", streamId())
.add("Arn", arn()).add("Status", statusAsString()).add("KinesisConfiguration", kinesisConfiguration())
.add("ErrorCause", errorCauseAsString()).add("StreamName", streamName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LedgerName":
return Optional.ofNullable(clazz.cast(ledgerName()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "InclusiveStartTime":
return Optional.ofNullable(clazz.cast(inclusiveStartTime()));
case "ExclusiveEndTime":
return Optional.ofNullable(clazz.cast(exclusiveEndTime()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "StreamId":
return Optional.ofNullable(clazz.cast(streamId()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "KinesisConfiguration":
return Optional.ofNullable(clazz.cast(kinesisConfiguration()));
case "ErrorCause":
return Optional.ofNullable(clazz.cast(errorCauseAsString()));
case "StreamName":
return Optional.ofNullable(clazz.cast(streamName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function