/* * Copyright 2010-2023 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; /** *
* The criteria by which the behavior is determined to be normal. *
*/ public class BehaviorCriteria implements Serializable { /** *
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*/
private String comparisonOperator;
/**
*
* The value to be compared with the metric
.
*
* Use this to specify the time duration over which the behavior is
* evaluated, for those criteria that 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. Cannot be used with
* list-based metric datatypes.
*
* 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. *
*
* Constraints:
* Range: 1 - 10
*/
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. *
*
* Constraints:
* Range: 1 - 10
*/
private Integer consecutiveDatapointsToClear;
/**
*
* A statistical ranking (percentile)that indicates a threshold value by * which a behavior is determined to be in compliance or in violation of the * behavior. *
*/ private StatisticalThreshold statisticalThreshold; /** ** The configuration of an ML Detect *
*/ private MachineLearningDetectionConfig mlDetectionConfig; /** *
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*
* @return
* The operator that relates the thing measured (metric
* ) to the criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and
* not-in-set
*
* number-list
: in-set
and
* not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*
* @param comparisonOperator
* The operator that relates the thing measured (
* metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* Valid operators include:
*
* string-list
: in-set
and
* not-in-set
*
* number-list
: in-set
and
* not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*
* @param comparisonOperator
* The operator that relates the thing measured (
* metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* Valid operators include:
*
* string-list
: in-set
and
* not-in-set
*
* number-list
: in-set
and
* not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*
* @param comparisonOperator
* The operator that relates the thing measured (
* metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* Valid operators include:
*
* string-list
: in-set
and
* not-in-set
*
* number-list
: in-set
and
* not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* The operator that relates the thing measured (metric
) to the
* criteria (containing a value
or
* statisticalThreshold
). Valid operators include:
*
* string-list
: in-set
and not-in-set
*
* number-list
: in-set
and not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: less-than, less-than-equals, greater-than,
* greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set,
* not-in-port-set, in-set, not-in-set
*
* @param comparisonOperator
* The operator that relates the thing measured (
* metric
) to the criteria (containing a
* value
or statisticalThreshold
).
* Valid operators include:
*
* string-list
: in-set
and
* not-in-set
*
* number-list
: in-set
and
* not-in-set
*
* ip-address-list
: in-cidr-set
and
* not-in-cidr-set
*
* number
: less-than
,
* less-than-equals
, greater-than
, and
* greater-than-equals
*
* The value to be compared with the metric
.
*
* The value to be compared with the metric
.
*
* The value to be compared with the metric
.
*
* The value to be compared with the metric
.
*
* The value to be compared with the metric
.
*
* Returns a reference to this object so that method calls can be chained * together. * * @param value
* The value to be compared with the metric
.
*
* Use this to specify the time duration over which the behavior is
* evaluated, for those criteria that 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. Cannot be used with
* list-based metric datatypes.
*
* Use this to specify the time duration over which the behavior is
* evaluated, for those criteria that 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. Cannot
* be used with list-based metric datatypes.
*
* Use this to specify the time duration over which the behavior is
* evaluated, for those criteria that 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. Cannot be used with
* list-based metric datatypes.
*
* Use this to specify the time duration over which the behavior
* is evaluated, for those criteria that 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. Cannot be used with list-based metric
* datatypes.
*
* Use this to specify the time duration over which the behavior is
* evaluated, for those criteria that 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. Cannot be used with
* list-based metric datatypes.
*
* Returns a reference to this object so that method calls can be chained * together. * * @param durationSeconds
* Use this to specify the time duration over which the behavior
* is evaluated, for those criteria that 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. Cannot be used with list-based metric
* datatypes.
*
* 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. *
*
* Constraints:
* Range: 1 - 10
*
* @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 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. *
*
* Constraints:
* Range: 1 - 10
*
* @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. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Range: 1 - 10
*
* @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 A reference to this updated object so that method calls can be * chained together. */ public BehaviorCriteria withConsecutiveDatapointsToAlarm(Integer consecutiveDatapointsToAlarm) { this.consecutiveDatapointsToAlarm = 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. *
*
* Constraints:
* Range: 1 - 10
*
* @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 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. *
*
* Constraints:
* Range: 1 - 10
*
* @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. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Range: 1 - 10
*
* @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 A reference to this updated object so that method calls can be * chained together. */ public BehaviorCriteria withConsecutiveDatapointsToClear(Integer consecutiveDatapointsToClear) { this.consecutiveDatapointsToClear = consecutiveDatapointsToClear; return this; } /** ** A statistical ranking (percentile)that 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)that indicates a threshold * value by which a behavior is determined to be in compliance or in * violation of the behavior. *
*/ public StatisticalThreshold getStatisticalThreshold() { return statisticalThreshold; } /** ** A statistical ranking (percentile)that 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)that 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)that indicates a threshold value by * which a behavior is determined to be in compliance or in violation of the * behavior. *
** Returns a reference to this object so that method calls can be chained * together. * * @param statisticalThreshold
* A statistical ranking (percentile)that indicates a threshold * value by which a behavior is determined to be in compliance or * in violation of the behavior. *
* @return A reference to this updated object so that method calls can be * chained together. */ public BehaviorCriteria withStatisticalThreshold(StatisticalThreshold statisticalThreshold) { this.statisticalThreshold = statisticalThreshold; return this; } /** ** The configuration of an ML Detect *
* * @return* The configuration of an ML Detect *
*/ public MachineLearningDetectionConfig getMlDetectionConfig() { return mlDetectionConfig; } /** ** The configuration of an ML Detect *
* * @param mlDetectionConfig* The configuration of an ML Detect *
*/ public void setMlDetectionConfig(MachineLearningDetectionConfig mlDetectionConfig) { this.mlDetectionConfig = mlDetectionConfig; } /** ** The configuration of an ML Detect *
** Returns a reference to this object so that method calls can be chained * together. * * @param mlDetectionConfig
* The configuration of an ML Detect *
* @return A reference to this updated object so that method calls can be * chained together. */ public BehaviorCriteria withMlDetectionConfig(MachineLearningDetectionConfig mlDetectionConfig) { this.mlDetectionConfig = mlDetectionConfig; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @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: " + getComparisonOperator() + ","); if (getValue() != null) sb.append("value: " + getValue() + ","); if (getDurationSeconds() != null) sb.append("durationSeconds: " + getDurationSeconds() + ","); if (getConsecutiveDatapointsToAlarm() != null) sb.append("consecutiveDatapointsToAlarm: " + getConsecutiveDatapointsToAlarm() + ","); if (getConsecutiveDatapointsToClear() != null) sb.append("consecutiveDatapointsToClear: " + getConsecutiveDatapointsToClear() + ","); if (getStatisticalThreshold() != null) sb.append("statisticalThreshold: " + getStatisticalThreshold() + ","); if (getMlDetectionConfig() != null) sb.append("mlDetectionConfig: " + getMlDetectionConfig()); sb.append("}"); return sb.toString(); } @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()); hashCode = prime * hashCode + ((getMlDetectionConfig() == null) ? 0 : getMlDetectionConfig().hashCode()); return hashCode; } @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; if (other.getMlDetectionConfig() == null ^ this.getMlDetectionConfig() == null) return false; if (other.getMlDetectionConfig() != null && other.getMlDetectionConfig().equals(this.getMlDetectionConfig()) == false) return false; return true; } }