software.amazon.awssdk.services.lookoutmetrics.model.UpdateAlertRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lookoutmetrics Show documentation
Show all versions of lookoutmetrics Show documentation
The AWS Java SDK for Lookout Metrics module holds the client classes that are used for
communicating with Lookout Metrics.
/*
* 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.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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateAlertRequest extends LookoutMetricsRequest implements
ToCopyableBuilder {
private static final SdkField ALERT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlertArn").getter(getter(UpdateAlertRequest::alertArn)).setter(setter(Builder::alertArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlertArn").build()).build();
private static final SdkField ALERT_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlertDescription").getter(getter(UpdateAlertRequest::alertDescription))
.setter(setter(Builder::alertDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlertDescription").build()).build();
private static final SdkField ALERT_SENSITIVITY_THRESHOLD_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("AlertSensitivityThreshold")
.getter(getter(UpdateAlertRequest::alertSensitivityThreshold)).setter(setter(Builder::alertSensitivityThreshold))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlertSensitivityThreshold").build())
.build();
private static final SdkField ACTION_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Action")
.getter(getter(UpdateAlertRequest::action)).setter(setter(Builder::action)).constructor(Action::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Action").build()).build();
private static final SdkField ALERT_FILTERS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("AlertFilters").getter(getter(UpdateAlertRequest::alertFilters)).setter(setter(Builder::alertFilters))
.constructor(AlertFilters::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlertFilters").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALERT_ARN_FIELD,
ALERT_DESCRIPTION_FIELD, ALERT_SENSITIVITY_THRESHOLD_FIELD, ACTION_FIELD, ALERT_FILTERS_FIELD));
private final String alertArn;
private final String alertDescription;
private final Integer alertSensitivityThreshold;
private final Action action;
private final AlertFilters alertFilters;
private UpdateAlertRequest(BuilderImpl builder) {
super(builder);
this.alertArn = builder.alertArn;
this.alertDescription = builder.alertDescription;
this.alertSensitivityThreshold = builder.alertSensitivityThreshold;
this.action = builder.action;
this.alertFilters = builder.alertFilters;
}
/**
*
* The ARN of the alert to update.
*
*
* @return The ARN of the alert to update.
*/
public final String alertArn() {
return alertArn;
}
/**
*
* A description of the alert.
*
*
* @return A description of the alert.
*/
public final String alertDescription() {
return alertDescription;
}
/**
*
* An integer from 0 to 100 specifying the alert sensitivity threshold.
*
*
* @return An integer from 0 to 100 specifying the alert sensitivity threshold.
*/
public final Integer alertSensitivityThreshold() {
return alertSensitivityThreshold;
}
/**
*
* Action that will be triggered when there is an alert.
*
*
* @return Action that will be triggered when there is an alert.
*/
public final Action action() {
return action;
}
/**
*
* The configuration of the alert filters, containing MetricList and DimensionFilterList.
*
*
* @return The configuration of the alert filters, containing MetricList and DimensionFilterList.
*/
public final AlertFilters alertFilters() {
return alertFilters;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(alertArn());
hashCode = 31 * hashCode + Objects.hashCode(alertDescription());
hashCode = 31 * hashCode + Objects.hashCode(alertSensitivityThreshold());
hashCode = 31 * hashCode + Objects.hashCode(action());
hashCode = 31 * hashCode + Objects.hashCode(alertFilters());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateAlertRequest)) {
return false;
}
UpdateAlertRequest other = (UpdateAlertRequest) obj;
return Objects.equals(alertArn(), other.alertArn()) && Objects.equals(alertDescription(), other.alertDescription())
&& Objects.equals(alertSensitivityThreshold(), other.alertSensitivityThreshold())
&& Objects.equals(action(), other.action()) && Objects.equals(alertFilters(), other.alertFilters());
}
/**
* 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("UpdateAlertRequest").add("AlertArn", alertArn()).add("AlertDescription", alertDescription())
.add("AlertSensitivityThreshold", alertSensitivityThreshold()).add("Action", action())
.add("AlertFilters", alertFilters()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AlertArn":
return Optional.ofNullable(clazz.cast(alertArn()));
case "AlertDescription":
return Optional.ofNullable(clazz.cast(alertDescription()));
case "AlertSensitivityThreshold":
return Optional.ofNullable(clazz.cast(alertSensitivityThreshold()));
case "Action":
return Optional.ofNullable(clazz.cast(action()));
case "AlertFilters":
return Optional.ofNullable(clazz.cast(alertFilters()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function