
com.amazonaws.services.iot.model.BehaviorCriteria Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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 com.amazonaws.services.iot.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The criteria by which the behavior is determined to be normal.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BehaviorCriteria implements Serializable, Cloneable, StructuredPojo {
/**
*
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
*
*/
private String comparisonOperator;
/**
*
* The value to be compared with the metric
.
*
*/
private MetricValue value;
/**
*
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time
* dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
metric
* comparison, measurements from all devices are accumulated over this time duration before being used to calculate
* percentiles, and later, measurements from an individual device are also accumulated over this time duration
* before being given a percentile rank.
*
*/
private Integer durationSeconds;
/**
*
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs.
* If not specified, the default is 1.
*
*/
private Integer consecutiveDatapointsToAlarm;
/**
*
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified
* number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*
*/
private Integer consecutiveDatapointsToClear;
/**
*
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in
* compliance or in violation of the behavior.
*
*/
private StatisticalThreshold statisticalThreshold;
/**
*
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
*
*
* @param comparisonOperator
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* @see ComparisonOperator
*/
public void setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
}
/**
*
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
*
*
* @return The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* @see ComparisonOperator
*/
public String getComparisonOperator() {
return this.comparisonOperator;
}
/**
*
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
*
*
* @param comparisonOperator
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
public BehaviorCriteria withComparisonOperator(String comparisonOperator) {
setComparisonOperator(comparisonOperator);
return this;
}
/**
*
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
*
*
* @param comparisonOperator
* The operator that relates the thing measured (metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
public BehaviorCriteria withComparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator = comparisonOperator.toString();
return this;
}
/**
*
* The value to be compared with the metric
.
*
*
* @param value
* The value to be compared with the metric
.
*/
public void setValue(MetricValue value) {
this.value = value;
}
/**
*
* The value to be compared with the metric
.
*
*
* @return The value to be compared with the metric
.
*/
public MetricValue getValue() {
return this.value;
}
/**
*
* The value to be compared with the metric
.
*
*
* @param value
* The value to be compared with the metric
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BehaviorCriteria withValue(MetricValue value) {
setValue(value);
return this;
}
/**
*
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time
* dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
metric
* comparison, measurements from all devices are accumulated over this time duration before being used to calculate
* percentiles, and later, measurements from an individual device are also accumulated over this time duration
* before being given a percentile rank.
*
*
* @param durationSeconds
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have
* a time dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
* metric comparison, measurements from all devices are accumulated over this time duration before being used
* to calculate percentiles, and later, measurements from an individual device are also accumulated over this
* time duration before being given a percentile rank.
*/
public void setDurationSeconds(Integer durationSeconds) {
this.durationSeconds = durationSeconds;
}
/**
*
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time
* dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
metric
* comparison, measurements from all devices are accumulated over this time duration before being used to calculate
* percentiles, and later, measurements from an individual device are also accumulated over this time duration
* before being given a percentile rank.
*
*
* @return Use this to specify the time duration over which the behavior is evaluated, for those criteria which have
* a time dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
* metric comparison, measurements from all devices are accumulated over this time duration before being
* used to calculate percentiles, and later, measurements from an individual device are also accumulated
* over this time duration before being given a percentile rank.
*/
public Integer getDurationSeconds() {
return this.durationSeconds;
}
/**
*
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have a time
* dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
metric
* comparison, measurements from all devices are accumulated over this time duration before being used to calculate
* percentiles, and later, measurements from an individual device are also accumulated over this time duration
* before being given a percentile rank.
*
*
* @param durationSeconds
* Use this to specify the time duration over which the behavior is evaluated, for those criteria which have
* a time dimension (for example, NUM_MESSAGES_SENT
). For a statisticalThreshhold
* metric comparison, measurements from all devices are accumulated over this time duration before being used
* to calculate percentiles, and later, measurements from an individual device are also accumulated over this
* time duration before being given a percentile rank.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BehaviorCriteria withDurationSeconds(Integer durationSeconds) {
setDurationSeconds(durationSeconds);
return this;
}
/**
*
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs.
* If not specified, the default is 1.
*
*
* @param consecutiveDatapointsToAlarm
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm
* occurs. If not specified, the default is 1.
*/
public void setConsecutiveDatapointsToAlarm(Integer consecutiveDatapointsToAlarm) {
this.consecutiveDatapointsToAlarm = consecutiveDatapointsToAlarm;
}
/**
*
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs.
* If not specified, the default is 1.
*
*
* @return If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm
* occurs. If not specified, the default is 1.
*/
public Integer getConsecutiveDatapointsToAlarm() {
return this.consecutiveDatapointsToAlarm;
}
/**
*
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm occurs.
* If not specified, the default is 1.
*
*
* @param consecutiveDatapointsToAlarm
* If a device is in violation of the behavior for the specified number of consecutive datapoints, an alarm
* occurs. If not specified, the default is 1.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BehaviorCriteria withConsecutiveDatapointsToAlarm(Integer consecutiveDatapointsToAlarm) {
setConsecutiveDatapointsToAlarm(consecutiveDatapointsToAlarm);
return this;
}
/**
*
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified
* number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*
*
* @param consecutiveDatapointsToClear
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the
* specified number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*/
public void setConsecutiveDatapointsToClear(Integer consecutiveDatapointsToClear) {
this.consecutiveDatapointsToClear = consecutiveDatapointsToClear;
}
/**
*
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified
* number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*
*
* @return If an alarm has occurred and the offending device is no longer in violation of the behavior for the
* specified number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*/
public Integer getConsecutiveDatapointsToClear() {
return this.consecutiveDatapointsToClear;
}
/**
*
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the specified
* number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
*
*
* @param consecutiveDatapointsToClear
* If an alarm has occurred and the offending device is no longer in violation of the behavior for the
* specified number of consecutive datapoints, the alarm is cleared. If not specified, the default is 1.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BehaviorCriteria withConsecutiveDatapointsToClear(Integer consecutiveDatapointsToClear) {
setConsecutiveDatapointsToClear(consecutiveDatapointsToClear);
return this;
}
/**
*
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in
* compliance or in violation of the behavior.
*
*
* @param statisticalThreshold
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to
* be in compliance or in violation of the behavior.
*/
public void setStatisticalThreshold(StatisticalThreshold statisticalThreshold) {
this.statisticalThreshold = statisticalThreshold;
}
/**
*
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in
* compliance or in violation of the behavior.
*
*
* @return A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to
* be in compliance or in violation of the behavior.
*/
public StatisticalThreshold getStatisticalThreshold() {
return this.statisticalThreshold;
}
/**
*
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to be in
* compliance or in violation of the behavior.
*
*
* @param statisticalThreshold
* A statistical ranking (percentile) which indicates a threshold value by which a behavior is determined to
* be in compliance or in violation of the behavior.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BehaviorCriteria withStatisticalThreshold(StatisticalThreshold statisticalThreshold) {
setStatisticalThreshold(statisticalThreshold);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getComparisonOperator() != null)
sb.append("ComparisonOperator: ").append(getComparisonOperator()).append(",");
if (getValue() != null)
sb.append("Value: ").append(getValue()).append(",");
if (getDurationSeconds() != null)
sb.append("DurationSeconds: ").append(getDurationSeconds()).append(",");
if (getConsecutiveDatapointsToAlarm() != null)
sb.append("ConsecutiveDatapointsToAlarm: ").append(getConsecutiveDatapointsToAlarm()).append(",");
if (getConsecutiveDatapointsToClear() != null)
sb.append("ConsecutiveDatapointsToClear: ").append(getConsecutiveDatapointsToClear()).append(",");
if (getStatisticalThreshold() != null)
sb.append("StatisticalThreshold: ").append(getStatisticalThreshold());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof BehaviorCriteria == false)
return false;
BehaviorCriteria other = (BehaviorCriteria) obj;
if (other.getComparisonOperator() == null ^ this.getComparisonOperator() == null)
return false;
if (other.getComparisonOperator() != null && other.getComparisonOperator().equals(this.getComparisonOperator()) == false)
return false;
if (other.getValue() == null ^ this.getValue() == null)
return false;
if (other.getValue() != null && other.getValue().equals(this.getValue()) == false)
return false;
if (other.getDurationSeconds() == null ^ this.getDurationSeconds() == null)
return false;
if (other.getDurationSeconds() != null && other.getDurationSeconds().equals(this.getDurationSeconds()) == false)
return false;
if (other.getConsecutiveDatapointsToAlarm() == null ^ this.getConsecutiveDatapointsToAlarm() == null)
return false;
if (other.getConsecutiveDatapointsToAlarm() != null && other.getConsecutiveDatapointsToAlarm().equals(this.getConsecutiveDatapointsToAlarm()) == false)
return false;
if (other.getConsecutiveDatapointsToClear() == null ^ this.getConsecutiveDatapointsToClear() == null)
return false;
if (other.getConsecutiveDatapointsToClear() != null && other.getConsecutiveDatapointsToClear().equals(this.getConsecutiveDatapointsToClear()) == false)
return false;
if (other.getStatisticalThreshold() == null ^ this.getStatisticalThreshold() == null)
return false;
if (other.getStatisticalThreshold() != null && other.getStatisticalThreshold().equals(this.getStatisticalThreshold()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getComparisonOperator() == null) ? 0 : getComparisonOperator().hashCode());
hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode());
hashCode = prime * hashCode + ((getDurationSeconds() == null) ? 0 : getDurationSeconds().hashCode());
hashCode = prime * hashCode + ((getConsecutiveDatapointsToAlarm() == null) ? 0 : getConsecutiveDatapointsToAlarm().hashCode());
hashCode = prime * hashCode + ((getConsecutiveDatapointsToClear() == null) ? 0 : getConsecutiveDatapointsToClear().hashCode());
hashCode = prime * hashCode + ((getStatisticalThreshold() == null) ? 0 : getStatisticalThreshold().hashCode());
return hashCode;
}
@Override
public BehaviorCriteria clone() {
try {
return (BehaviorCriteria) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.iot.model.transform.BehaviorCriteriaMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}