# DeploymentPreferenceProperty

- Source: Generated at build time
- Type last changed: v2.106.0 · 10 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_sam as sam } from 'aws-cdk-lib';
const deploymentPreferenceProperty: sam.CfnFunction.DeploymentPreferenceProperty = {
  alarms: ['alarms'],
  enabled: false,
  hooks: {
    postTraffic: 'postTraffic',
    preTraffic: 'preTraffic',
  },
  role: 'role',
  type: 'type',
};
```

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_sam as sam

deployment_preference_property = sam.CfnFunction.DeploymentPreferenceProperty(
    alarms=["alarms"],
    enabled=False,
    hooks=sam.CfnFunction.HooksProperty(
        post_traffic="postTraffic",
        pre_traffic="preTraffic"
    ),
    role="role",
    type="type"
)
```

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.sam.*;

DeploymentPreferenceProperty deploymentPreferenceProperty = DeploymentPreferenceProperty.builder()
        .alarms(List.of("alarms"))
        .enabled(false)
        .hooks(HooksProperty.builder()
                .postTraffic("postTraffic")
                .preTraffic("preTraffic")
                .build())
        .role("role")
        .type("type")
        .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.SAM;

var deploymentPreferenceProperty = new DeploymentPreferenceProperty {
    Alarms = new [] { "alarms" },
    Enabled = false,
    Hooks = new HooksProperty {
        PostTraffic = "postTraffic",
        PreTraffic = "preTraffic"
    },
    Role = "role",
    Type = "type"
};
```

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"

deploymentPreferenceProperty := &DeploymentPreferenceProperty{
	Alarms: []*string{
		jsii.String("alarms"),
	},
	Enabled: jsii.Boolean(false),
	Hooks: &HooksProperty{
		PostTraffic: jsii.String("postTraffic"),
		PreTraffic: jsii.String("preTraffic"),
	},
	Role: jsii.String("role"),
	Type: jsii.String("type"),
}
```

## Properties

- `alarms`: string[]

- `enabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html)

- `hooks`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnFunction.HooksProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sam.CfnFunction.HooksProperty.html)

- `role`: string

- `type`: string
