# BehaviorProperty

A Device Defender security profile behavior.

- Source: Generated at build time
- Type last changed: v2.110.0 · 17 Nov 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iot as iot } from 'aws-cdk-lib';
const behaviorProperty: iot.CfnSecurityProfile.BehaviorProperty = {
  name: 'name',

  // the properties below are optional
  criteria: {
    comparisonOperator: 'comparisonOperator',
    consecutiveDatapointsToAlarm: 123,
    consecutiveDatapointsToClear: 123,
    durationSeconds: 123,
    mlDetectionConfig: {
      confidenceLevel: 'confidenceLevel',
    },
    statisticalThreshold: {
      statistic: 'statistic',
    },
    value: {
      cidrs: ['cidrs'],
      count: 'count',
      number: 123,
      numbers: [123],
      ports: [123],
      strings: ['strings'],
    },
  },
  exportMetric: false,
  metric: 'metric',
  metricDimension: {
    dimensionName: 'dimensionName',

    // the properties below are optional
    operator: 'operator',
  },
  suppressAlerts: false,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iot as iot

behavior_property = iot.CfnSecurityProfile.BehaviorProperty(
    name="name",

    # the properties below are optional
    criteria=iot.CfnSecurityProfile.BehaviorCriteriaProperty(
        comparison_operator="comparisonOperator",
        consecutive_datapoints_to_alarm=123,
        consecutive_datapoints_to_clear=123,
        duration_seconds=123,
        ml_detection_config=iot.CfnSecurityProfile.MachineLearningDetectionConfigProperty(
            confidence_level="confidenceLevel"
        ),
        statistical_threshold=iot.CfnSecurityProfile.StatisticalThresholdProperty(
            statistic="statistic"
        ),
        value=iot.CfnSecurityProfile.MetricValueProperty(
            cidrs=["cidrs"],
            count="count",
            number=123,
            numbers=[123],
            ports=[123],
            strings=["strings"]
        )
    ),
    export_metric=False,
    metric="metric",
    metric_dimension=iot.CfnSecurityProfile.MetricDimensionProperty(
        dimension_name="dimensionName",

        # the properties below are optional
        operator="operator"
    ),
    suppress_alerts=False
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iot.*;

BehaviorProperty behaviorProperty = BehaviorProperty.builder()
        .name("name")

        // the properties below are optional
        .criteria(BehaviorCriteriaProperty.builder()
                .comparisonOperator("comparisonOperator")
                .consecutiveDatapointsToAlarm(123)
                .consecutiveDatapointsToClear(123)
                .durationSeconds(123)
                .mlDetectionConfig(MachineLearningDetectionConfigProperty.builder()
                        .confidenceLevel("confidenceLevel")
                        .build())
                .statisticalThreshold(StatisticalThresholdProperty.builder()
                        .statistic("statistic")
                        .build())
                .value(MetricValueProperty.builder()
                        .cidrs(List.of("cidrs"))
                        .count("count")
                        .number(123)
                        .numbers(List.of(123))
                        .ports(List.of(123))
                        .strings(List.of("strings"))
                        .build())
                .build())
        .exportMetric(false)
        .metric("metric")
        .metricDimension(MetricDimensionProperty.builder()
                .dimensionName("dimensionName")

                // the properties below are optional
                .operator("operator")
                .build())
        .suppressAlerts(false)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IoT;

var behaviorProperty = new BehaviorProperty {
    Name = "name",

    // the properties below are optional
    Criteria = new BehaviorCriteriaProperty {
        ComparisonOperator = "comparisonOperator",
        ConsecutiveDatapointsToAlarm = 123,
        ConsecutiveDatapointsToClear = 123,
        DurationSeconds = 123,
        MlDetectionConfig = new MachineLearningDetectionConfigProperty {
            ConfidenceLevel = "confidenceLevel"
        },
        StatisticalThreshold = new StatisticalThresholdProperty {
            Statistic = "statistic"
        },
        Value = new MetricValueProperty {
            Cidrs = new [] { "cidrs" },
            Count = "count",
            Number = 123,
            Numbers = new [] { 123 },
            Ports = new [] { 123 },
            Strings = new [] { "strings" }
        }
    },
    ExportMetric = false,
    Metric = "metric",
    MetricDimension = new MetricDimensionProperty {
        DimensionName = "dimensionName",

        // the properties below are optional
        Operator = "operator"
    },
    SuppressAlerts = false
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

behaviorProperty := &BehaviorProperty{
	Name: jsii.String("name"),

	// the properties below are optional
	Criteria: &BehaviorCriteriaProperty{
		ComparisonOperator: jsii.String("comparisonOperator"),
		ConsecutiveDatapointsToAlarm: jsii.Number(123),
		ConsecutiveDatapointsToClear: jsii.Number(123),
		DurationSeconds: jsii.Number(123),
		MlDetectionConfig: &MachineLearningDetectionConfigProperty{
			ConfidenceLevel: jsii.String("confidenceLevel"),
		},
		StatisticalThreshold: &StatisticalThresholdProperty{
			Statistic: jsii.String("statistic"),
		},
		Value: &MetricValueProperty{
			Cidrs: []*string{
				jsii.String("cidrs"),
			},
			Count: jsii.String("count"),
			Number: jsii.Number(123),
			Numbers: []interface{}{
				jsii.Number(123),
			},
			Ports: []interface{}{
				jsii.Number(123),
			},
			Strings: []*string{
				jsii.String("strings"),
			},
		},
	},
	ExportMetric: jsii.Boolean(false),
	Metric: jsii.String("metric"),
	MetricDimension: &MetricDimensionProperty{
		DimensionName: jsii.String("dimensionName"),

		// the properties below are optional
		Operator: jsii.String("operator"),
	},
	SuppressAlerts: jsii.Boolean(false),
}
```

## Properties

- `criteria`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnSecurityProfile.BehaviorCriteriaProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnSecurityProfile.BehaviorCriteriaProperty.html) — The criteria that determine if a device is behaving normally in regard to the `metric` .

  > In the AWS IoT console, you can choose to be sent an alert through Amazon SNS when AWS IoT Device Defender detects that a device is behaving anomalously.

- `exportMetric`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Value indicates exporting metrics related to the behavior when it is true.

- `metric`: string — What is measured by the behavior.

- `metricDimension`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnSecurityProfile.MetricDimensionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnSecurityProfile.MetricDimensionProperty.html) — The dimension of the metric.

- `name`: string (required) — The name you've given to the behavior.

- `suppressAlerts`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — The alert status.

  If you set the value to `true` , alerts will be suppressed.
