software.amazon.awssdk.services.cloudwatchlogs.model.UpdateAnomalyRequest Maven / Gradle / Ivy
Show all versions of cloudwatchlogs 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.cloudwatchlogs.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 UpdateAnomalyRequest extends CloudWatchLogsRequest implements
ToCopyableBuilder {
private static final SdkField ANOMALY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("anomalyId").getter(getter(UpdateAnomalyRequest::anomalyId)).setter(setter(Builder::anomalyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("anomalyId").build()).build();
private static final SdkField PATTERN_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("patternId").getter(getter(UpdateAnomalyRequest::patternId)).setter(setter(Builder::patternId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("patternId").build()).build();
private static final SdkField ANOMALY_DETECTOR_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("anomalyDetectorArn").getter(getter(UpdateAnomalyRequest::anomalyDetectorArn))
.setter(setter(Builder::anomalyDetectorArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("anomalyDetectorArn").build())
.build();
private static final SdkField SUPPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("suppressionType").getter(getter(UpdateAnomalyRequest::suppressionTypeAsString))
.setter(setter(Builder::suppressionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("suppressionType").build()).build();
private static final SdkField SUPPRESSION_PERIOD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("suppressionPeriod")
.getter(getter(UpdateAnomalyRequest::suppressionPeriod)).setter(setter(Builder::suppressionPeriod))
.constructor(SuppressionPeriod::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("suppressionPeriod").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ANOMALY_ID_FIELD,
PATTERN_ID_FIELD, ANOMALY_DETECTOR_ARN_FIELD, SUPPRESSION_TYPE_FIELD, SUPPRESSION_PERIOD_FIELD));
private final String anomalyId;
private final String patternId;
private final String anomalyDetectorArn;
private final String suppressionType;
private final SuppressionPeriod suppressionPeriod;
private UpdateAnomalyRequest(BuilderImpl builder) {
super(builder);
this.anomalyId = builder.anomalyId;
this.patternId = builder.patternId;
this.anomalyDetectorArn = builder.anomalyDetectorArn;
this.suppressionType = builder.suppressionType;
this.suppressionPeriod = builder.suppressionPeriod;
}
/**
*
* If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using
* the
* ListAnomalies operation.
*
*
* @return If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs
* by using the ListAnomalies operation.
*/
public final String anomalyId() {
return anomalyId;
}
/**
*
* If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using
* the
* ListAnomalies operation.
*
*
* @return If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs
* by using the ListAnomalies operation.
*/
public final String patternId() {
return patternId;
}
/**
*
* The ARN of the anomaly detector that this operation is to act on.
*
*
* @return The ARN of the anomaly detector that this operation is to act on.
*/
public final String anomalyDetectorArn() {
return anomalyDetectorArn;
}
/**
*
* Use this to specify whether the suppression to be temporary or infinite. If you specify LIMITED
, you
* must also specify a suppressionPeriod
. If you specify INFINITE
, any value for
* suppressionPeriod
is ignored.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #suppressionType}
* will return {@link SuppressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #suppressionTypeAsString}.
*
*
* @return Use this to specify whether the suppression to be temporary or infinite. If you specify
* LIMITED
, you must also specify a suppressionPeriod
. If you specify
* INFINITE
, any value for suppressionPeriod
is ignored.
* @see SuppressionType
*/
public final SuppressionType suppressionType() {
return SuppressionType.fromValue(suppressionType);
}
/**
*
* Use this to specify whether the suppression to be temporary or infinite. If you specify LIMITED
, you
* must also specify a suppressionPeriod
. If you specify INFINITE
, any value for
* suppressionPeriod
is ignored.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #suppressionType}
* will return {@link SuppressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #suppressionTypeAsString}.
*
*
* @return Use this to specify whether the suppression to be temporary or infinite. If you specify
* LIMITED
, you must also specify a suppressionPeriod
. If you specify
* INFINITE
, any value for suppressionPeriod
is ignored.
* @see SuppressionType
*/
public final String suppressionTypeAsString() {
return suppressionType;
}
/**
*
* If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression
* is to last.
*
*
* @return If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the
* suppression is to last.
*/
public final SuppressionPeriod suppressionPeriod() {
return suppressionPeriod;
}
@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(anomalyId());
hashCode = 31 * hashCode + Objects.hashCode(patternId());
hashCode = 31 * hashCode + Objects.hashCode(anomalyDetectorArn());
hashCode = 31 * hashCode + Objects.hashCode(suppressionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(suppressionPeriod());
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 UpdateAnomalyRequest)) {
return false;
}
UpdateAnomalyRequest other = (UpdateAnomalyRequest) obj;
return Objects.equals(anomalyId(), other.anomalyId()) && Objects.equals(patternId(), other.patternId())
&& Objects.equals(anomalyDetectorArn(), other.anomalyDetectorArn())
&& Objects.equals(suppressionTypeAsString(), other.suppressionTypeAsString())
&& Objects.equals(suppressionPeriod(), other.suppressionPeriod());
}
/**
* 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("UpdateAnomalyRequest").add("AnomalyId", anomalyId()).add("PatternId", patternId())
.add("AnomalyDetectorArn", anomalyDetectorArn()).add("SuppressionType", suppressionTypeAsString())
.add("SuppressionPeriod", suppressionPeriod()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "anomalyId":
return Optional.ofNullable(clazz.cast(anomalyId()));
case "patternId":
return Optional.ofNullable(clazz.cast(patternId()));
case "anomalyDetectorArn":
return Optional.ofNullable(clazz.cast(anomalyDetectorArn()));
case "suppressionType":
return Optional.ofNullable(clazz.cast(suppressionTypeAsString()));
case "suppressionPeriod":
return Optional.ofNullable(clazz.cast(suppressionPeriod()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function