software.amazon.awssdk.services.devopsguru.model.ReactiveAnomalySummary Maven / Gradle / Ivy
Show all versions of devopsguru 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.devopsguru.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Details about a reactive anomaly. This object is returned by DescribeAnomaly.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReactiveAnomalySummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ReactiveAnomalySummary::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Severity").getter(getter(ReactiveAnomalySummary::severityAsString)).setter(setter(Builder::severity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ReactiveAnomalySummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField ANOMALY_TIME_RANGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AnomalyTimeRange")
.getter(getter(ReactiveAnomalySummary::anomalyTimeRange)).setter(setter(Builder::anomalyTimeRange))
.constructor(AnomalyTimeRange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnomalyTimeRange").build()).build();
private static final SdkField ANOMALY_REPORTED_TIME_RANGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AnomalyReportedTimeRange")
.getter(getter(ReactiveAnomalySummary::anomalyReportedTimeRange)).setter(setter(Builder::anomalyReportedTimeRange))
.constructor(AnomalyReportedTimeRange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnomalyReportedTimeRange").build())
.build();
private static final SdkField SOURCE_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourceDetails")
.getter(getter(ReactiveAnomalySummary::sourceDetails)).setter(setter(Builder::sourceDetails))
.constructor(AnomalySourceDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceDetails").build()).build();
private static final SdkField ASSOCIATED_INSIGHT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociatedInsightId").getter(getter(ReactiveAnomalySummary::associatedInsightId))
.setter(setter(Builder::associatedInsightId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedInsightId").build())
.build();
private static final SdkField RESOURCE_COLLECTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ResourceCollection")
.getter(getter(ReactiveAnomalySummary::resourceCollection)).setter(setter(Builder::resourceCollection))
.constructor(ResourceCollection::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceCollection").build())
.build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(ReactiveAnomalySummary::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ReactiveAnomalySummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(ReactiveAnomalySummary::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField CAUSAL_ANOMALY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CausalAnomalyId").getter(getter(ReactiveAnomalySummary::causalAnomalyId))
.setter(setter(Builder::causalAnomalyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CausalAnomalyId").build()).build();
private static final SdkField> ANOMALY_RESOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AnomalyResources")
.getter(getter(ReactiveAnomalySummary::anomalyResources))
.setter(setter(Builder::anomalyResources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnomalyResources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AnomalyResource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, SEVERITY_FIELD,
STATUS_FIELD, ANOMALY_TIME_RANGE_FIELD, ANOMALY_REPORTED_TIME_RANGE_FIELD, SOURCE_DETAILS_FIELD,
ASSOCIATED_INSIGHT_ID_FIELD, RESOURCE_COLLECTION_FIELD, TYPE_FIELD, NAME_FIELD, DESCRIPTION_FIELD,
CAUSAL_ANOMALY_ID_FIELD, ANOMALY_RESOURCES_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Id", ID_FIELD);
put("Severity", SEVERITY_FIELD);
put("Status", STATUS_FIELD);
put("AnomalyTimeRange", ANOMALY_TIME_RANGE_FIELD);
put("AnomalyReportedTimeRange", ANOMALY_REPORTED_TIME_RANGE_FIELD);
put("SourceDetails", SOURCE_DETAILS_FIELD);
put("AssociatedInsightId", ASSOCIATED_INSIGHT_ID_FIELD);
put("ResourceCollection", RESOURCE_COLLECTION_FIELD);
put("Type", TYPE_FIELD);
put("Name", NAME_FIELD);
put("Description", DESCRIPTION_FIELD);
put("CausalAnomalyId", CAUSAL_ANOMALY_ID_FIELD);
put("AnomalyResources", ANOMALY_RESOURCES_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String id;
private final String severity;
private final String status;
private final AnomalyTimeRange anomalyTimeRange;
private final AnomalyReportedTimeRange anomalyReportedTimeRange;
private final AnomalySourceDetails sourceDetails;
private final String associatedInsightId;
private final ResourceCollection resourceCollection;
private final String type;
private final String name;
private final String description;
private final String causalAnomalyId;
private final List anomalyResources;
private ReactiveAnomalySummary(BuilderImpl builder) {
this.id = builder.id;
this.severity = builder.severity;
this.status = builder.status;
this.anomalyTimeRange = builder.anomalyTimeRange;
this.anomalyReportedTimeRange = builder.anomalyReportedTimeRange;
this.sourceDetails = builder.sourceDetails;
this.associatedInsightId = builder.associatedInsightId;
this.resourceCollection = builder.resourceCollection;
this.type = builder.type;
this.name = builder.name;
this.description = builder.description;
this.causalAnomalyId = builder.causalAnomalyId;
this.anomalyResources = builder.anomalyResources;
}
/**
*
* The ID of the reactive anomaly.
*
*
* @return The ID of the reactive anomaly.
*/
public final String id() {
return id;
}
/**
*
* The severity of the anomaly. The severity of anomalies that generate an insight determine that insight's
* severity. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link AnomalySeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return The severity of the anomaly. The severity of anomalies that generate an insight determine that insight's
* severity. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide.
* @see AnomalySeverity
*/
public final AnomalySeverity severity() {
return AnomalySeverity.fromValue(severity);
}
/**
*
* The severity of the anomaly. The severity of anomalies that generate an insight determine that insight's
* severity. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link AnomalySeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return The severity of the anomaly. The severity of anomalies that generate an insight determine that insight's
* severity. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide.
* @see AnomalySeverity
*/
public final String severityAsString() {
return severity;
}
/**
*
* The status of the reactive anomaly.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AnomalyStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the reactive anomaly.
* @see AnomalyStatus
*/
public final AnomalyStatus status() {
return AnomalyStatus.fromValue(status);
}
/**
*
* The status of the reactive anomaly.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link AnomalyStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the reactive anomaly.
* @see AnomalyStatus
*/
public final String statusAsString() {
return status;
}
/**
* Returns the value of the AnomalyTimeRange property for this object.
*
* @return The value of the AnomalyTimeRange property for this object.
*/
public final AnomalyTimeRange anomalyTimeRange() {
return anomalyTimeRange;
}
/**
*
* An AnomalyReportedTimeRange
object that specifies the time range between when the anomaly is opened
* and the time when it is closed.
*
*
* @return An AnomalyReportedTimeRange
object that specifies the time range between when the anomaly is
* opened and the time when it is closed.
*/
public final AnomalyReportedTimeRange anomalyReportedTimeRange() {
return anomalyReportedTimeRange;
}
/**
*
* Details about the source of the analyzed operational data that triggered the anomaly. The one supported source is
* Amazon CloudWatch metrics.
*
*
* @return Details about the source of the analyzed operational data that triggered the anomaly. The one supported
* source is Amazon CloudWatch metrics.
*/
public final AnomalySourceDetails sourceDetails() {
return sourceDetails;
}
/**
*
* The ID of the insight that contains this anomaly. An insight is composed of related anomalies.
*
*
* @return The ID of the insight that contains this anomaly. An insight is composed of related anomalies.
*/
public final String associatedInsightId() {
return associatedInsightId;
}
/**
* Returns the value of the ResourceCollection property for this object.
*
* @return The value of the ResourceCollection property for this object.
*/
public final ResourceCollection resourceCollection() {
return resourceCollection;
}
/**
*
* The type of the reactive anomaly. It can be one of the following types.
*
*
* -
*
* CAUSAL
- the anomaly can cause a new insight.
*
*
* -
*
* CONTEXTUAL
- the anomaly contains additional information about an insight or its causal anomaly.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link AnomalyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the reactive anomaly. It can be one of the following types.
*
* -
*
* CAUSAL
- the anomaly can cause a new insight.
*
*
* -
*
* CONTEXTUAL
- the anomaly contains additional information about an insight or its causal
* anomaly.
*
*
* @see AnomalyType
*/
public final AnomalyType type() {
return AnomalyType.fromValue(type);
}
/**
*
* The type of the reactive anomaly. It can be one of the following types.
*
*
* -
*
* CAUSAL
- the anomaly can cause a new insight.
*
*
* -
*
* CONTEXTUAL
- the anomaly contains additional information about an insight or its causal anomaly.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link AnomalyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the reactive anomaly. It can be one of the following types.
*
* -
*
* CAUSAL
- the anomaly can cause a new insight.
*
*
* -
*
* CONTEXTUAL
- the anomaly contains additional information about an insight or its causal
* anomaly.
*
*
* @see AnomalyType
*/
public final String typeAsString() {
return type;
}
/**
*
* The name of the reactive anomaly.
*
*
* @return The name of the reactive anomaly.
*/
public final String name() {
return name;
}
/**
*
* A description of the reactive anomaly.
*
*
* @return A description of the reactive anomaly.
*/
public final String description() {
return description;
}
/**
*
* The ID of the causal anomaly that is associated with this reactive anomaly. The ID of a `CAUSAL` anomaly is
* always `NULL`.
*
*
* @return The ID of the causal anomaly that is associated with this reactive anomaly. The ID of a `CAUSAL` anomaly
* is always `NULL`.
*/
public final String causalAnomalyId() {
return causalAnomalyId;
}
/**
* For responses, this returns true if the service returned a value for the AnomalyResources property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasAnomalyResources() {
return anomalyResources != null && !(anomalyResources instanceof SdkAutoConstructList);
}
/**
*
* The Amazon Web Services resources in which anomalous behavior was detected by DevOps Guru.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAnomalyResources} method.
*
*
* @return The Amazon Web Services resources in which anomalous behavior was detected by DevOps Guru.
*/
public final List anomalyResources() {
return anomalyResources;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(severityAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(anomalyTimeRange());
hashCode = 31 * hashCode + Objects.hashCode(anomalyReportedTimeRange());
hashCode = 31 * hashCode + Objects.hashCode(sourceDetails());
hashCode = 31 * hashCode + Objects.hashCode(associatedInsightId());
hashCode = 31 * hashCode + Objects.hashCode(resourceCollection());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(causalAnomalyId());
hashCode = 31 * hashCode + Objects.hashCode(hasAnomalyResources() ? anomalyResources() : null);
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 ReactiveAnomalySummary)) {
return false;
}
ReactiveAnomalySummary other = (ReactiveAnomalySummary) obj;
return Objects.equals(id(), other.id()) && Objects.equals(severityAsString(), other.severityAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(anomalyTimeRange(), other.anomalyTimeRange())
&& Objects.equals(anomalyReportedTimeRange(), other.anomalyReportedTimeRange())
&& Objects.equals(sourceDetails(), other.sourceDetails())
&& Objects.equals(associatedInsightId(), other.associatedInsightId())
&& Objects.equals(resourceCollection(), other.resourceCollection())
&& Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(name(), other.name())
&& Objects.equals(description(), other.description())
&& Objects.equals(causalAnomalyId(), other.causalAnomalyId())
&& hasAnomalyResources() == other.hasAnomalyResources()
&& Objects.equals(anomalyResources(), other.anomalyResources());
}
/**
* 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("ReactiveAnomalySummary").add("Id", id()).add("Severity", severityAsString())
.add("Status", statusAsString()).add("AnomalyTimeRange", anomalyTimeRange())
.add("AnomalyReportedTimeRange", anomalyReportedTimeRange()).add("SourceDetails", sourceDetails())
.add("AssociatedInsightId", associatedInsightId()).add("ResourceCollection", resourceCollection())
.add("Type", typeAsString()).add("Name", name()).add("Description", description())
.add("CausalAnomalyId", causalAnomalyId())
.add("AnomalyResources", hasAnomalyResources() ? anomalyResources() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Severity":
return Optional.ofNullable(clazz.cast(severityAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "AnomalyTimeRange":
return Optional.ofNullable(clazz.cast(anomalyTimeRange()));
case "AnomalyReportedTimeRange":
return Optional.ofNullable(clazz.cast(anomalyReportedTimeRange()));
case "SourceDetails":
return Optional.ofNullable(clazz.cast(sourceDetails()));
case "AssociatedInsightId":
return Optional.ofNullable(clazz.cast(associatedInsightId()));
case "ResourceCollection":
return Optional.ofNullable(clazz.cast(resourceCollection()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "CausalAnomalyId":
return Optional.ofNullable(clazz.cast(causalAnomalyId()));
case "AnomalyResources":
return Optional.ofNullable(clazz.cast(anomalyResources()));
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