software.amazon.awssdk.services.lookoutmetrics.model.InterMetricImpactDetails Maven / Gradle / Ivy
Show all versions of lookoutmetrics 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.lookoutmetrics.model;
import java.io.Serializable;
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;
/**
*
* Aggregated details about the measures contributing to the anomaly group, and the measures potentially impacted by the
* anomaly group.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InterMetricImpactDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField METRIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MetricName").getter(getter(InterMetricImpactDetails::metricName)).setter(setter(Builder::metricName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricName").build()).build();
private static final SdkField ANOMALY_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AnomalyGroupId").getter(getter(InterMetricImpactDetails::anomalyGroupId))
.setter(setter(Builder::anomalyGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnomalyGroupId").build()).build();
private static final SdkField RELATIONSHIP_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RelationshipType").getter(getter(InterMetricImpactDetails::relationshipTypeAsString))
.setter(setter(Builder::relationshipType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RelationshipType").build()).build();
private static final SdkField CONTRIBUTION_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("ContributionPercentage").getter(getter(InterMetricImpactDetails::contributionPercentage))
.setter(setter(Builder::contributionPercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContributionPercentage").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRIC_NAME_FIELD,
ANOMALY_GROUP_ID_FIELD, RELATIONSHIP_TYPE_FIELD, CONTRIBUTION_PERCENTAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String metricName;
private final String anomalyGroupId;
private final String relationshipType;
private final Double contributionPercentage;
private InterMetricImpactDetails(BuilderImpl builder) {
this.metricName = builder.metricName;
this.anomalyGroupId = builder.anomalyGroupId;
this.relationshipType = builder.relationshipType;
this.contributionPercentage = builder.contributionPercentage;
}
/**
*
* The name of the measure.
*
*
* @return The name of the measure.
*/
public final String metricName() {
return metricName;
}
/**
*
* The ID of the anomaly group.
*
*
* @return The ID of the anomaly group.
*/
public final String anomalyGroupId() {
return anomalyGroupId;
}
/**
*
* Whether a measure is a potential cause of the anomaly group (CAUSE_OF_INPUT_ANOMALY_GROUP
), or
* whether the measure is impacted by the anomaly group (EFFECT_OF_INPUT_ANOMALY_GROUP
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #relationshipType}
* will return {@link RelationshipType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #relationshipTypeAsString}.
*
*
* @return Whether a measure is a potential cause of the anomaly group (CAUSE_OF_INPUT_ANOMALY_GROUP
),
* or whether the measure is impacted by the anomaly group (EFFECT_OF_INPUT_ANOMALY_GROUP
).
* @see RelationshipType
*/
public final RelationshipType relationshipType() {
return RelationshipType.fromValue(relationshipType);
}
/**
*
* Whether a measure is a potential cause of the anomaly group (CAUSE_OF_INPUT_ANOMALY_GROUP
), or
* whether the measure is impacted by the anomaly group (EFFECT_OF_INPUT_ANOMALY_GROUP
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #relationshipType}
* will return {@link RelationshipType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #relationshipTypeAsString}.
*
*
* @return Whether a measure is a potential cause of the anomaly group (CAUSE_OF_INPUT_ANOMALY_GROUP
),
* or whether the measure is impacted by the anomaly group (EFFECT_OF_INPUT_ANOMALY_GROUP
).
* @see RelationshipType
*/
public final String relationshipTypeAsString() {
return relationshipType;
}
/**
*
* For potential causes (CAUSE_OF_INPUT_ANOMALY_GROUP
), the percentage contribution the measure has in
* causing the anomalies.
*
*
* @return For potential causes (CAUSE_OF_INPUT_ANOMALY_GROUP
), the percentage contribution the measure
* has in causing the anomalies.
*/
public final Double contributionPercentage() {
return contributionPercentage;
}
@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(metricName());
hashCode = 31 * hashCode + Objects.hashCode(anomalyGroupId());
hashCode = 31 * hashCode + Objects.hashCode(relationshipTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(contributionPercentage());
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 InterMetricImpactDetails)) {
return false;
}
InterMetricImpactDetails other = (InterMetricImpactDetails) obj;
return Objects.equals(metricName(), other.metricName()) && Objects.equals(anomalyGroupId(), other.anomalyGroupId())
&& Objects.equals(relationshipTypeAsString(), other.relationshipTypeAsString())
&& Objects.equals(contributionPercentage(), other.contributionPercentage());
}
/**
* 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("InterMetricImpactDetails").add("MetricName", metricName())
.add("AnomalyGroupId", anomalyGroupId()).add("RelationshipType", relationshipTypeAsString())
.add("ContributionPercentage", contributionPercentage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MetricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "AnomalyGroupId":
return Optional.ofNullable(clazz.cast(anomalyGroupId()));
case "RelationshipType":
return Optional.ofNullable(clazz.cast(relationshipTypeAsString()));
case "ContributionPercentage":
return Optional.ofNullable(clazz.cast(contributionPercentage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function