
software.amazon.awssdk.services.notifications.model.NotificationEventOverview 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.notifications.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.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.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a short summary of a NotificationEvent. This is only used when listing notification events.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NotificationEventOverview implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(NotificationEventOverview::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField NOTIFICATION_CONFIGURATION_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("notificationConfigurationArn")
.getter(getter(NotificationEventOverview::notificationConfigurationArn))
.setter(setter(Builder::notificationConfigurationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("notificationConfigurationArn")
.build()).build();
private static final SdkField RELATED_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("relatedAccount").getter(getter(NotificationEventOverview::relatedAccount))
.setter(setter(Builder::relatedAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("relatedAccount").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("creationTime")
.getter(getter(NotificationEventOverview::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField NOTIFICATION_EVENT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("notificationEvent")
.getter(getter(NotificationEventOverview::notificationEvent)).setter(setter(Builder::notificationEvent))
.constructor(NotificationEventSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("notificationEvent").build()).build();
private static final SdkField AGGREGATION_EVENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("aggregationEventType").getter(getter(NotificationEventOverview::aggregationEventTypeAsString))
.setter(setter(Builder::aggregationEventType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationEventType").build())
.build();
private static final SdkField AGGREGATE_NOTIFICATION_EVENT_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("aggregateNotificationEventArn")
.getter(getter(NotificationEventOverview::aggregateNotificationEventArn))
.setter(setter(Builder::aggregateNotificationEventArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregateNotificationEventArn")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
NOTIFICATION_CONFIGURATION_ARN_FIELD, RELATED_ACCOUNT_FIELD, CREATION_TIME_FIELD, NOTIFICATION_EVENT_FIELD,
AGGREGATION_EVENT_TYPE_FIELD, AGGREGATE_NOTIFICATION_EVENT_ARN_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("arn", ARN_FIELD);
put("notificationConfigurationArn", NOTIFICATION_CONFIGURATION_ARN_FIELD);
put("relatedAccount", RELATED_ACCOUNT_FIELD);
put("creationTime", CREATION_TIME_FIELD);
put("notificationEvent", NOTIFICATION_EVENT_FIELD);
put("aggregationEventType", AGGREGATION_EVENT_TYPE_FIELD);
put("aggregateNotificationEventArn", AGGREGATE_NOTIFICATION_EVENT_ARN_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String arn;
private final String notificationConfigurationArn;
private final String relatedAccount;
private final Instant creationTime;
private final NotificationEventSummary notificationEvent;
private final String aggregationEventType;
private final String aggregateNotificationEventArn;
private NotificationEventOverview(BuilderImpl builder) {
this.arn = builder.arn;
this.notificationConfigurationArn = builder.notificationConfigurationArn;
this.relatedAccount = builder.relatedAccount;
this.creationTime = builder.creationTime;
this.notificationEvent = builder.notificationEvent;
this.aggregationEventType = builder.aggregationEventType;
this.aggregateNotificationEventArn = builder.aggregateNotificationEventArn;
}
/**
*
* The Amazon Resource Name (ARN) of the resource.
*
*
* @return The Amazon Resource Name (ARN) of the resource.
*/
public final String arn() {
return arn;
}
/**
*
* The ARN of the NotificationConfiguration.
*
*
* @return The ARN of the NotificationConfiguration.
*/
public final String notificationConfigurationArn() {
return notificationConfigurationArn;
}
/**
*
* The account name containing the NotificationHub.
*
*
* @return The account name containing the NotificationHub.
*/
public final String relatedAccount() {
return relatedAccount;
}
/**
*
* The creation time of the NotificationEvent.
*
*
* @return The creation time of the NotificationEvent.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* Refers to a NotificationEventSummary object.
*
*
* Similar in structure to content
in the GetNotificationEvent response.
*
*
* @return Refers to a NotificationEventSummary object.
*
* Similar in structure to content
in the GetNotificationEvent response.
*/
public final NotificationEventSummary notificationEvent() {
return notificationEvent;
}
/**
*
* The NotificationConfiguration's aggregation type.
*
*
* -
*
* Values:
*
*
* -
*
* AGGREGATE
*
*
* -
*
* The notification event is an aggregate notification. Aggregate notifications summarize grouped events over a
* specified time period.
*
*
*
*
* -
*
* CHILD
*
*
* -
*
* Some EventRules are ACTIVE
and some are INACTIVE
. Any call can be run.
*
*
*
*
* -
*
* NONE
*
*
* -
*
* The notification isn't aggregated.
*
*
*
*
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #aggregationEventType} will return {@link AggregationEventType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #aggregationEventTypeAsString}.
*
*
* @return The NotificationConfiguration's aggregation type.
*
* -
*
* Values:
*
*
* -
*
* AGGREGATE
*
*
* -
*
* The notification event is an aggregate notification. Aggregate notifications summarize grouped events
* over a specified time period.
*
*
*
*
* -
*
* CHILD
*
*
* -
*
* Some EventRules are ACTIVE
and some are INACTIVE
. Any call can be run.
*
*
*
*
* -
*
* NONE
*
*
* -
*
* The notification isn't aggregated.
*
*
*
*
*
*
* @see AggregationEventType
*/
public final AggregationEventType aggregationEventType() {
return AggregationEventType.fromValue(aggregationEventType);
}
/**
*
* The NotificationConfiguration's aggregation type.
*
*
* -
*
* Values:
*
*
* -
*
* AGGREGATE
*
*
* -
*
* The notification event is an aggregate notification. Aggregate notifications summarize grouped events over a
* specified time period.
*
*
*
*
* -
*
* CHILD
*
*
* -
*
* Some EventRules are ACTIVE
and some are INACTIVE
. Any call can be run.
*
*
*
*
* -
*
* NONE
*
*
* -
*
* The notification isn't aggregated.
*
*
*
*
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #aggregationEventType} will return {@link AggregationEventType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #aggregationEventTypeAsString}.
*
*
* @return The NotificationConfiguration's aggregation type.
*
* -
*
* Values:
*
*
* -
*
* AGGREGATE
*
*
* -
*
* The notification event is an aggregate notification. Aggregate notifications summarize grouped events
* over a specified time period.
*
*
*
*
* -
*
* CHILD
*
*
* -
*
* Some EventRules are ACTIVE
and some are INACTIVE
. Any call can be run.
*
*
*
*
* -
*
* NONE
*
*
* -
*
* The notification isn't aggregated.
*
*
*
*
*
*
* @see AggregationEventType
*/
public final String aggregationEventTypeAsString() {
return aggregationEventType;
}
/**
*
* The ARN of the aggregatedNotificationEventArn to match.
*
*
* @return The ARN of the aggregatedNotificationEventArn to match.
*/
public final String aggregateNotificationEventArn() {
return aggregateNotificationEventArn;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(notificationConfigurationArn());
hashCode = 31 * hashCode + Objects.hashCode(relatedAccount());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(notificationEvent());
hashCode = 31 * hashCode + Objects.hashCode(aggregationEventTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(aggregateNotificationEventArn());
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 NotificationEventOverview)) {
return false;
}
NotificationEventOverview other = (NotificationEventOverview) obj;
return Objects.equals(arn(), other.arn())
&& Objects.equals(notificationConfigurationArn(), other.notificationConfigurationArn())
&& Objects.equals(relatedAccount(), other.relatedAccount())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(notificationEvent(), other.notificationEvent())
&& Objects.equals(aggregationEventTypeAsString(), other.aggregationEventTypeAsString())
&& Objects.equals(aggregateNotificationEventArn(), other.aggregateNotificationEventArn());
}
/**
* 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("NotificationEventOverview").add("Arn", arn())
.add("NotificationConfigurationArn", notificationConfigurationArn()).add("RelatedAccount", relatedAccount())
.add("CreationTime", creationTime()).add("NotificationEvent", notificationEvent())
.add("AggregationEventType", aggregationEventTypeAsString())
.add("AggregateNotificationEventArn", aggregateNotificationEventArn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "notificationConfigurationArn":
return Optional.ofNullable(clazz.cast(notificationConfigurationArn()));
case "relatedAccount":
return Optional.ofNullable(clazz.cast(relatedAccount()));
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "notificationEvent":
return Optional.ofNullable(clazz.cast(notificationEvent()));
case "aggregationEventType":
return Optional.ofNullable(clazz.cast(aggregationEventTypeAsString()));
case "aggregateNotificationEventArn":
return Optional.ofNullable(clazz.cast(aggregateNotificationEventArn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function