software.amazon.awssdk.services.applicationinsights.model.ConfigurationEvent Maven / Gradle / Ivy
Show all versions of applicationinsights 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.applicationinsights.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.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;
/**
*
* The event information.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ConfigurationEvent implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MONITORED_RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MonitoredResourceARN").getter(getter(ConfigurationEvent::monitoredResourceARN))
.setter(setter(Builder::monitoredResourceARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MonitoredResourceARN").build())
.build();
private static final SdkField EVENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventStatus").getter(getter(ConfigurationEvent::eventStatusAsString))
.setter(setter(Builder::eventStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventStatus").build()).build();
private static final SdkField EVENT_RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventResourceType").getter(getter(ConfigurationEvent::eventResourceTypeAsString))
.setter(setter(Builder::eventResourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventResourceType").build()).build();
private static final SdkField EVENT_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EventTime").getter(getter(ConfigurationEvent::eventTime)).setter(setter(Builder::eventTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventTime").build()).build();
private static final SdkField EVENT_DETAIL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventDetail").getter(getter(ConfigurationEvent::eventDetail)).setter(setter(Builder::eventDetail))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventDetail").build()).build();
private static final SdkField EVENT_RESOURCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EventResourceName").getter(getter(ConfigurationEvent::eventResourceName))
.setter(setter(Builder::eventResourceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventResourceName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MONITORED_RESOURCE_ARN_FIELD,
EVENT_STATUS_FIELD, EVENT_RESOURCE_TYPE_FIELD, EVENT_TIME_FIELD, EVENT_DETAIL_FIELD, EVENT_RESOURCE_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String monitoredResourceARN;
private final String eventStatus;
private final String eventResourceType;
private final Instant eventTime;
private final String eventDetail;
private final String eventResourceName;
private ConfigurationEvent(BuilderImpl builder) {
this.monitoredResourceARN = builder.monitoredResourceARN;
this.eventStatus = builder.eventStatus;
this.eventResourceType = builder.eventResourceType;
this.eventTime = builder.eventTime;
this.eventDetail = builder.eventDetail;
this.eventResourceName = builder.eventResourceName;
}
/**
*
* The resource monitored by Application Insights.
*
*
* @return The resource monitored by Application Insights.
*/
public String monitoredResourceARN() {
return monitoredResourceARN;
}
/**
*
* The status of the configuration update event. Possible values include INFO, WARN, and ERROR.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventStatus} will
* return {@link ConfigurationEventStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #eventStatusAsString}.
*
*
* @return The status of the configuration update event. Possible values include INFO, WARN, and ERROR.
* @see ConfigurationEventStatus
*/
public ConfigurationEventStatus eventStatus() {
return ConfigurationEventStatus.fromValue(eventStatus);
}
/**
*
* The status of the configuration update event. Possible values include INFO, WARN, and ERROR.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventStatus} will
* return {@link ConfigurationEventStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #eventStatusAsString}.
*
*
* @return The status of the configuration update event. Possible values include INFO, WARN, and ERROR.
* @see ConfigurationEventStatus
*/
public String eventStatusAsString() {
return eventStatus;
}
/**
*
* The resource type that Application Insights attempted to configure, for example, CLOUDWATCH_ALARM.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventResourceType}
* will return {@link ConfigurationEventResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #eventResourceTypeAsString}.
*
*
* @return The resource type that Application Insights attempted to configure, for example, CLOUDWATCH_ALARM.
* @see ConfigurationEventResourceType
*/
public ConfigurationEventResourceType eventResourceType() {
return ConfigurationEventResourceType.fromValue(eventResourceType);
}
/**
*
* The resource type that Application Insights attempted to configure, for example, CLOUDWATCH_ALARM.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventResourceType}
* will return {@link ConfigurationEventResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #eventResourceTypeAsString}.
*
*
* @return The resource type that Application Insights attempted to configure, for example, CLOUDWATCH_ALARM.
* @see ConfigurationEventResourceType
*/
public String eventResourceTypeAsString() {
return eventResourceType;
}
/**
*
* The timestamp of the event.
*
*
* @return The timestamp of the event.
*/
public Instant eventTime() {
return eventTime;
}
/**
*
* The details of the event in plain text.
*
*
* @return The details of the event in plain text.
*/
public String eventDetail() {
return eventDetail;
}
/**
*
* The name of the resource Application Insights attempted to configure.
*
*
* @return The name of the resource Application Insights attempted to configure.
*/
public String eventResourceName() {
return eventResourceName;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(monitoredResourceARN());
hashCode = 31 * hashCode + Objects.hashCode(eventStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(eventResourceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(eventTime());
hashCode = 31 * hashCode + Objects.hashCode(eventDetail());
hashCode = 31 * hashCode + Objects.hashCode(eventResourceName());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ConfigurationEvent)) {
return false;
}
ConfigurationEvent other = (ConfigurationEvent) obj;
return Objects.equals(monitoredResourceARN(), other.monitoredResourceARN())
&& Objects.equals(eventStatusAsString(), other.eventStatusAsString())
&& Objects.equals(eventResourceTypeAsString(), other.eventResourceTypeAsString())
&& Objects.equals(eventTime(), other.eventTime()) && Objects.equals(eventDetail(), other.eventDetail())
&& Objects.equals(eventResourceName(), other.eventResourceName());
}
/**
* 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 String toString() {
return ToString.builder("ConfigurationEvent").add("MonitoredResourceARN", monitoredResourceARN())
.add("EventStatus", eventStatusAsString()).add("EventResourceType", eventResourceTypeAsString())
.add("EventTime", eventTime()).add("EventDetail", eventDetail()).add("EventResourceName", eventResourceName())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MonitoredResourceARN":
return Optional.ofNullable(clazz.cast(monitoredResourceARN()));
case "EventStatus":
return Optional.ofNullable(clazz.cast(eventStatusAsString()));
case "EventResourceType":
return Optional.ofNullable(clazz.cast(eventResourceTypeAsString()));
case "EventTime":
return Optional.ofNullable(clazz.cast(eventTime()));
case "EventDetail":
return Optional.ofNullable(clazz.cast(eventDetail()));
case "EventResourceName":
return Optional.ofNullable(clazz.cast(eventResourceName()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function