software.amazon.awssdk.services.health.model.Event Maven / Gradle / Ivy
Show all versions of health 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.health.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.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;
/**
*
* Summary information about an Health event.
*
*
* Health events can be public or account-specific:
*
*
* -
*
* Public events might be service events that are not specific to an Amazon Web Services account. For example, if
* there is an issue with an Amazon Web Services Region, Health provides information about the event, even if you don't
* use services or resources in that Region.
*
*
* -
*
* Account-specific events are specific to either your Amazon Web Services account or an account in your
* organization. For example, if there's an issue with Amazon Elastic Compute Cloud in a Region that you use, Health
* provides information about the event and the affected resources in the account.
*
*
*
*
* You can determine if an event is public or account-specific by using the eventScopeCode
parameter. For
* more information, see eventScopeCode.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Event implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(Event::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField SERVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("service")
.getter(getter(Event::service)).setter(setter(Builder::service))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("service").build()).build();
private static final SdkField EVENT_TYPE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventTypeCode").getter(getter(Event::eventTypeCode)).setter(setter(Builder::eventTypeCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventTypeCode").build()).build();
private static final SdkField EVENT_TYPE_CATEGORY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventTypeCategory").getter(getter(Event::eventTypeCategoryAsString))
.setter(setter(Builder::eventTypeCategory))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventTypeCategory").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("region")
.getter(getter(Event::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("region").build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("availabilityZone").getter(getter(Event::availabilityZone)).setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("availabilityZone").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(Event::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTime").getter(getter(Event::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastUpdatedTime").getter(getter(Event::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedTime").build()).build();
private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusCode").getter(getter(Event::statusCodeAsString)).setter(setter(Builder::statusCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusCode").build()).build();
private static final SdkField EVENT_SCOPE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventScopeCode").getter(getter(Event::eventScopeCodeAsString)).setter(setter(Builder::eventScopeCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventScopeCode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, SERVICE_FIELD,
EVENT_TYPE_CODE_FIELD, EVENT_TYPE_CATEGORY_FIELD, REGION_FIELD, AVAILABILITY_ZONE_FIELD, START_TIME_FIELD,
END_TIME_FIELD, LAST_UPDATED_TIME_FIELD, STATUS_CODE_FIELD, EVENT_SCOPE_CODE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("arn", ARN_FIELD);
put("service", SERVICE_FIELD);
put("eventTypeCode", EVENT_TYPE_CODE_FIELD);
put("eventTypeCategory", EVENT_TYPE_CATEGORY_FIELD);
put("region", REGION_FIELD);
put("availabilityZone", AVAILABILITY_ZONE_FIELD);
put("startTime", START_TIME_FIELD);
put("endTime", END_TIME_FIELD);
put("lastUpdatedTime", LAST_UPDATED_TIME_FIELD);
put("statusCode", STATUS_CODE_FIELD);
put("eventScopeCode", EVENT_SCOPE_CODE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String arn;
private final String service;
private final String eventTypeCode;
private final String eventTypeCategory;
private final String region;
private final String availabilityZone;
private final Instant startTime;
private final Instant endTime;
private final Instant lastUpdatedTime;
private final String statusCodeValue;
private final String eventScopeCode;
private Event(BuilderImpl builder) {
this.arn = builder.arn;
this.service = builder.service;
this.eventTypeCode = builder.eventTypeCode;
this.eventTypeCategory = builder.eventTypeCategory;
this.region = builder.region;
this.availabilityZone = builder.availabilityZone;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.statusCodeValue = builder.statusCodeValue;
this.eventScopeCode = builder.eventScopeCode;
}
/**
*
* The unique identifier for the event. The event ARN has the
* arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID
* format.
*
*
* For example, an event ARN might look like the following:
*
*
* arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456
*
*
* @return The unique identifier for the event. The event ARN has the
* arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID
* format.
*
* For example, an event ARN might look like the following:
*
*
* arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456
*/
public final String arn() {
return arn;
}
/**
*
* The Amazon Web Service that is affected by the event. For example, EC2
, RDS
.
*
*
* @return The Amazon Web Service that is affected by the event. For example, EC2
, RDS
.
*/
public final String service() {
return service;
}
/**
*
* The unique identifier for the event type. The format is AWS_SERVICE_DESCRIPTION
; for
* example, AWS_EC2_SYSTEM_MAINTENANCE_EVENT
.
*
*
* @return The unique identifier for the event type. The format is
* AWS_SERVICE_DESCRIPTION
; for example,
* AWS_EC2_SYSTEM_MAINTENANCE_EVENT
.
*/
public final String eventTypeCode() {
return eventTypeCode;
}
/**
*
* A list of event type category codes. Possible values are issue
, accountNotification
, or
* scheduledChange
. Currently, the investigation
value isn't supported at this time.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventTypeCategory}
* will return {@link EventTypeCategory#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #eventTypeCategoryAsString}.
*
*
* @return A list of event type category codes. Possible values are issue
,
* accountNotification
, or scheduledChange
. Currently, the
* investigation
value isn't supported at this time.
* @see EventTypeCategory
*/
public final EventTypeCategory eventTypeCategory() {
return EventTypeCategory.fromValue(eventTypeCategory);
}
/**
*
* A list of event type category codes. Possible values are issue
, accountNotification
, or
* scheduledChange
. Currently, the investigation
value isn't supported at this time.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventTypeCategory}
* will return {@link EventTypeCategory#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #eventTypeCategoryAsString}.
*
*
* @return A list of event type category codes. Possible values are issue
,
* accountNotification
, or scheduledChange
. Currently, the
* investigation
value isn't supported at this time.
* @see EventTypeCategory
*/
public final String eventTypeCategoryAsString() {
return eventTypeCategory;
}
/**
*
* The Amazon Web Services Region name of the event.
*
*
* @return The Amazon Web Services Region name of the event.
*/
public final String region() {
return region;
}
/**
*
* The Amazon Web Services Availability Zone of the event. For example, us-east-1a.
*
*
* @return The Amazon Web Services Availability Zone of the event. For example, us-east-1a.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The date and time that the event began.
*
*
* @return The date and time that the event began.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The date and time that the event ended.
*
*
* @return The date and time that the event ended.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The most recent date and time that the event was updated.
*
*
* @return The most recent date and time that the event was updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
* The most recent status of the event. Possible values are open
, closed
, and
* upcoming
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will
* return {@link EventStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusCodeAsString}.
*
*
* @return The most recent status of the event. Possible values are open
, closed
, and
* upcoming
.
* @see EventStatusCode
*/
public final EventStatusCode statusCode() {
return EventStatusCode.fromValue(statusCodeValue);
}
/**
*
* The most recent status of the event. Possible values are open
, closed
, and
* upcoming
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will
* return {@link EventStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusCodeAsString}.
*
*
* @return The most recent status of the event. Possible values are open
, closed
, and
* upcoming
.
* @see EventStatusCode
*/
public final String statusCodeAsString() {
return statusCodeValue;
}
/**
*
* This parameter specifies if the Health event is a public Amazon Web Service event or an account-specific event.
*
*
* -
*
* If the eventScopeCode
value is PUBLIC
, then the affectedAccounts
value is
* always empty.
*
*
* -
*
* If the eventScopeCode
value is ACCOUNT_SPECIFIC
, then the affectedAccounts
* value lists the affected Amazon Web Services accounts in your organization. For example, if an event affects a
* service such as Amazon Elastic Compute Cloud and you have Amazon Web Services accounts that use that service,
* those account IDs appear in the response.
*
*
* -
*
* If the eventScopeCode
value is NONE
, then the eventArn
that you specified
* in the request is invalid or doesn't exist.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventScopeCode}
* will return {@link EventScopeCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #eventScopeCodeAsString}.
*
*
* @return This parameter specifies if the Health event is a public Amazon Web Service event or an account-specific
* event.
*
* -
*
* If the eventScopeCode
value is PUBLIC
, then the affectedAccounts
* value is always empty.
*
*
* -
*
* If the eventScopeCode
value is ACCOUNT_SPECIFIC
, then the
* affectedAccounts
value lists the affected Amazon Web Services accounts in your organization.
* For example, if an event affects a service such as Amazon Elastic Compute Cloud and you have Amazon Web
* Services accounts that use that service, those account IDs appear in the response.
*
*
* -
*
* If the eventScopeCode
value is NONE
, then the eventArn
that you
* specified in the request is invalid or doesn't exist.
*
*
* @see EventScopeCode
*/
public final EventScopeCode eventScopeCode() {
return EventScopeCode.fromValue(eventScopeCode);
}
/**
*
* This parameter specifies if the Health event is a public Amazon Web Service event or an account-specific event.
*
*
* -
*
* If the eventScopeCode
value is PUBLIC
, then the affectedAccounts
value is
* always empty.
*
*
* -
*
* If the eventScopeCode
value is ACCOUNT_SPECIFIC
, then the affectedAccounts
* value lists the affected Amazon Web Services accounts in your organization. For example, if an event affects a
* service such as Amazon Elastic Compute Cloud and you have Amazon Web Services accounts that use that service,
* those account IDs appear in the response.
*
*
* -
*
* If the eventScopeCode
value is NONE
, then the eventArn
that you specified
* in the request is invalid or doesn't exist.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventScopeCode}
* will return {@link EventScopeCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #eventScopeCodeAsString}.
*
*
* @return This parameter specifies if the Health event is a public Amazon Web Service event or an account-specific
* event.
*
* -
*
* If the eventScopeCode
value is PUBLIC
, then the affectedAccounts
* value is always empty.
*
*
* -
*
* If the eventScopeCode
value is ACCOUNT_SPECIFIC
, then the
* affectedAccounts
value lists the affected Amazon Web Services accounts in your organization.
* For example, if an event affects a service such as Amazon Elastic Compute Cloud and you have Amazon Web
* Services accounts that use that service, those account IDs appear in the response.
*
*
* -
*
* If the eventScopeCode
value is NONE
, then the eventArn
that you
* specified in the request is invalid or doesn't exist.
*
*
* @see EventScopeCode
*/
public final String eventScopeCodeAsString() {
return eventScopeCode;
}
@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(service());
hashCode = 31 * hashCode + Objects.hashCode(eventTypeCode());
hashCode = 31 * hashCode + Objects.hashCode(eventTypeCategoryAsString());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(statusCodeAsString());
hashCode = 31 * hashCode + Objects.hashCode(eventScopeCodeAsString());
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 Event)) {
return false;
}
Event other = (Event) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(service(), other.service())
&& Objects.equals(eventTypeCode(), other.eventTypeCode())
&& Objects.equals(eventTypeCategoryAsString(), other.eventTypeCategoryAsString())
&& Objects.equals(region(), other.region()) && Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime())
&& Objects.equals(statusCodeAsString(), other.statusCodeAsString())
&& Objects.equals(eventScopeCodeAsString(), other.eventScopeCodeAsString());
}
/**
* 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("Event").add("Arn", arn()).add("Service", service()).add("EventTypeCode", eventTypeCode())
.add("EventTypeCategory", eventTypeCategoryAsString()).add("Region", region())
.add("AvailabilityZone", availabilityZone()).add("StartTime", startTime()).add("EndTime", endTime())
.add("LastUpdatedTime", lastUpdatedTime()).add("StatusCode", statusCodeAsString())
.add("EventScopeCode", eventScopeCodeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "service":
return Optional.ofNullable(clazz.cast(service()));
case "eventTypeCode":
return Optional.ofNullable(clazz.cast(eventTypeCode()));
case "eventTypeCategory":
return Optional.ofNullable(clazz.cast(eventTypeCategoryAsString()));
case "region":
return Optional.ofNullable(clazz.cast(region()));
case "availabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "lastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "statusCode":
return Optional.ofNullable(clazz.cast(statusCodeAsString()));
case "eventScopeCode":
return Optional.ofNullable(clazz.cast(eventScopeCodeAsString()));
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