software.amazon.awssdk.services.eventbridge.model.DescribeArchiveResponse Maven / Gradle / Ivy
Show all versions of eventbridge Show documentation
/*
* 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.eventbridge.model;
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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeArchiveResponse extends EventBridgeResponse implements
ToCopyableBuilder {
private static final SdkField ARCHIVE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ArchiveArn").getter(getter(DescribeArchiveResponse::archiveArn)).setter(setter(Builder::archiveArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ArchiveArn").build()).build();
private static final SdkField ARCHIVE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ArchiveName").getter(getter(DescribeArchiveResponse::archiveName)).setter(setter(Builder::archiveName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ArchiveName").build()).build();
private static final SdkField EVENT_SOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventSourceArn").getter(getter(DescribeArchiveResponse::eventSourceArn))
.setter(setter(Builder::eventSourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventSourceArn").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(DescribeArchiveResponse::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField EVENT_PATTERN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventPattern").getter(getter(DescribeArchiveResponse::eventPattern))
.setter(setter(Builder::eventPattern))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventPattern").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(DescribeArchiveResponse::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField STATE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StateReason").getter(getter(DescribeArchiveResponse::stateReason)).setter(setter(Builder::stateReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateReason").build()).build();
private static final SdkField RETENTION_DAYS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RetentionDays").getter(getter(DescribeArchiveResponse::retentionDays))
.setter(setter(Builder::retentionDays))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetentionDays").build()).build();
private static final SdkField SIZE_BYTES_FIELD = SdkField. builder(MarshallingType.LONG).memberName("SizeBytes")
.getter(getter(DescribeArchiveResponse::sizeBytes)).setter(setter(Builder::sizeBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SizeBytes").build()).build();
private static final SdkField EVENT_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("EventCount").getter(getter(DescribeArchiveResponse::eventCount)).setter(setter(Builder::eventCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventCount").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeArchiveResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARCHIVE_ARN_FIELD,
ARCHIVE_NAME_FIELD, EVENT_SOURCE_ARN_FIELD, DESCRIPTION_FIELD, EVENT_PATTERN_FIELD, STATE_FIELD, STATE_REASON_FIELD,
RETENTION_DAYS_FIELD, SIZE_BYTES_FIELD, EVENT_COUNT_FIELD, CREATION_TIME_FIELD));
private final String archiveArn;
private final String archiveName;
private final String eventSourceArn;
private final String description;
private final String eventPattern;
private final String state;
private final String stateReason;
private final Integer retentionDays;
private final Long sizeBytes;
private final Long eventCount;
private final Instant creationTime;
private DescribeArchiveResponse(BuilderImpl builder) {
super(builder);
this.archiveArn = builder.archiveArn;
this.archiveName = builder.archiveName;
this.eventSourceArn = builder.eventSourceArn;
this.description = builder.description;
this.eventPattern = builder.eventPattern;
this.state = builder.state;
this.stateReason = builder.stateReason;
this.retentionDays = builder.retentionDays;
this.sizeBytes = builder.sizeBytes;
this.eventCount = builder.eventCount;
this.creationTime = builder.creationTime;
}
/**
*
* The ARN of the archive.
*
*
* @return The ARN of the archive.
*/
public final String archiveArn() {
return archiveArn;
}
/**
*
* The name of the archive.
*
*
* @return The name of the archive.
*/
public final String archiveName() {
return archiveName;
}
/**
*
* The ARN of the event source associated with the archive.
*
*
* @return The ARN of the event source associated with the archive.
*/
public final String eventSourceArn() {
return eventSourceArn;
}
/**
*
* The description of the archive.
*
*
* @return The description of the archive.
*/
public final String description() {
return description;
}
/**
*
* The event pattern used to filter events sent to the archive.
*
*
* @return The event pattern used to filter events sent to the archive.
*/
public final String eventPattern() {
return eventPattern;
}
/**
*
* The state of the archive.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ArchiveState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the archive.
* @see ArchiveState
*/
public final ArchiveState state() {
return ArchiveState.fromValue(state);
}
/**
*
* The state of the archive.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ArchiveState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the archive.
* @see ArchiveState
*/
public final String stateAsString() {
return state;
}
/**
*
* The reason that the archive is in the state.
*
*
* @return The reason that the archive is in the state.
*/
public final String stateReason() {
return stateReason;
}
/**
*
* The number of days to retain events for in the archive.
*
*
* @return The number of days to retain events for in the archive.
*/
public final Integer retentionDays() {
return retentionDays;
}
/**
*
* The size of the archive in bytes.
*
*
* @return The size of the archive in bytes.
*/
public final Long sizeBytes() {
return sizeBytes;
}
/**
*
* The number of events in the archive.
*
*
* @return The number of events in the archive.
*/
public final Long eventCount() {
return eventCount;
}
/**
*
* The time at which the archive was created.
*
*
* @return The time at which the archive was created.
*/
public final Instant creationTime() {
return creationTime;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(archiveArn());
hashCode = 31 * hashCode + Objects.hashCode(archiveName());
hashCode = 31 * hashCode + Objects.hashCode(eventSourceArn());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(eventPattern());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateReason());
hashCode = 31 * hashCode + Objects.hashCode(retentionDays());
hashCode = 31 * hashCode + Objects.hashCode(sizeBytes());
hashCode = 31 * hashCode + Objects.hashCode(eventCount());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
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 DescribeArchiveResponse)) {
return false;
}
DescribeArchiveResponse other = (DescribeArchiveResponse) obj;
return Objects.equals(archiveArn(), other.archiveArn()) && Objects.equals(archiveName(), other.archiveName())
&& Objects.equals(eventSourceArn(), other.eventSourceArn()) && Objects.equals(description(), other.description())
&& Objects.equals(eventPattern(), other.eventPattern()) && Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(stateReason(), other.stateReason()) && Objects.equals(retentionDays(), other.retentionDays())
&& Objects.equals(sizeBytes(), other.sizeBytes()) && Objects.equals(eventCount(), other.eventCount())
&& Objects.equals(creationTime(), other.creationTime());
}
/**
* 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("DescribeArchiveResponse").add("ArchiveArn", archiveArn()).add("ArchiveName", archiveName())
.add("EventSourceArn", eventSourceArn()).add("Description", description()).add("EventPattern", eventPattern())
.add("State", stateAsString()).add("StateReason", stateReason()).add("RetentionDays", retentionDays())
.add("SizeBytes", sizeBytes()).add("EventCount", eventCount()).add("CreationTime", creationTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ArchiveArn":
return Optional.ofNullable(clazz.cast(archiveArn()));
case "ArchiveName":
return Optional.ofNullable(clazz.cast(archiveName()));
case "EventSourceArn":
return Optional.ofNullable(clazz.cast(eventSourceArn()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "EventPattern":
return Optional.ofNullable(clazz.cast(eventPattern()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "StateReason":
return Optional.ofNullable(clazz.cast(stateReason()));
case "RetentionDays":
return Optional.ofNullable(clazz.cast(retentionDays()));
case "SizeBytes":
return Optional.ofNullable(clazz.cast(sizeBytes()));
case "EventCount":
return Optional.ofNullable(clazz.cast(eventCount()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function