# CfnGuardHookProps

Properties for defining a `CfnGuardHook`.

Used as props by: [CfnGuardHook](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnGuardHook.html)

- Source: Generated at build time
- Type last changed: v2.168.0 · 20 Nov 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const cfnGuardHookProps: cdk.CfnGuardHookProps = {
  alias: 'alias',
  executionRole: 'executionRole',
  failureMode: 'failureMode',
  hookStatus: 'hookStatus',
  ruleLocation: {
    uri: 'uri',

    // the properties below are optional
    versionId: 'versionId',
  },
  targetOperations: ['targetOperations'],

  // the properties below are optional
  logBucket: 'logBucket',
  options: {
    inputParams: {
      uri: 'uri',

      // the properties below are optional
      versionId: 'versionId',
    },
  },
  stackFilters: {
    filteringCriteria: 'filteringCriteria',

    // the properties below are optional
    stackNames: {
      exclude: ['exclude'],
      include: ['include'],
    },
    stackRoles: {
      exclude: ['exclude'],
      include: ['include'],
    },
  },
  targetFilters: {
    targets: [{
      action: 'action',
      invocationPoint: 'invocationPoint',
      targetName: 'targetName',
    }],

    // the properties below are optional
    actions: ['actions'],
    invocationPoints: ['invocationPoints'],
    targetNames: ['targetNames'],
  },
};
```

Python:

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

cfn_guard_hook_props = cdk.CfnGuardHookProps(
    alias="alias",
    execution_role="executionRole",
    failure_mode="failureMode",
    hook_status="hookStatus",
    rule_location=cdk.CfnGuardHook.S3LocationProperty(
        uri="uri",

        # the properties below are optional
        version_id="versionId"
    ),
    target_operations=["targetOperations"],

    # the properties below are optional
    log_bucket="logBucket",
    options=cdk.CfnGuardHook.OptionsProperty(
        input_params=cdk.CfnGuardHook.S3LocationProperty(
            uri="uri",

            # the properties below are optional
            version_id="versionId"
        )
    ),
    stack_filters=cdk.CfnGuardHook.StackFiltersProperty(
        filtering_criteria="filteringCriteria",

        # the properties below are optional
        stack_names=cdk.CfnGuardHook.StackNamesProperty(
            exclude=["exclude"],
            include=["include"]
        ),
        stack_roles=cdk.CfnGuardHook.StackRolesProperty(
            exclude=["exclude"],
            include=["include"]
        )
    ),
    target_filters=cdk.CfnGuardHook.TargetFiltersProperty(
        targets=[cdk.CfnGuardHook.HookTargetProperty(
            action="action",
            invocation_point="invocationPoint",
            target_name="targetName"
        )],

        # the properties below are optional
        actions=["actions"],
        invocation_points=["invocationPoints"],
        target_names=["targetNames"]
    )
)
```

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

CfnGuardHookProps cfnGuardHookProps = CfnGuardHookProps.builder()
        .alias("alias")
        .executionRole("executionRole")
        .failureMode("failureMode")
        .hookStatus("hookStatus")
        .ruleLocation(S3LocationProperty.builder()
                .uri("uri")

                // the properties below are optional
                .versionId("versionId")
                .build())
        .targetOperations(List.of("targetOperations"))

        // the properties below are optional
        .logBucket("logBucket")
        .options(OptionsProperty.builder()
                .inputParams(S3LocationProperty.builder()
                        .uri("uri")

                        // the properties below are optional
                        .versionId("versionId")
                        .build())
                .build())
        .stackFilters(StackFiltersProperty.builder()
                .filteringCriteria("filteringCriteria")

                // the properties below are optional
                .stackNames(StackNamesProperty.builder()
                        .exclude(List.of("exclude"))
                        .include(List.of("include"))
                        .build())
                .stackRoles(StackRolesProperty.builder()
                        .exclude(List.of("exclude"))
                        .include(List.of("include"))
                        .build())
                .build())
        .targetFilters(TargetFiltersProperty.builder()
                .targets(List.of(HookTargetProperty.builder()
                        .action("action")
                        .invocationPoint("invocationPoint")
                        .targetName("targetName")
                        .build()))

                // the properties below are optional
                .actions(List.of("actions"))
                .invocationPoints(List.of("invocationPoints"))
                .targetNames(List.of("targetNames"))
                .build())
        .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;

var cfnGuardHookProps = new CfnGuardHookProps {
    Alias = "alias",
    ExecutionRole = "executionRole",
    FailureMode = "failureMode",
    HookStatus = "hookStatus",
    RuleLocation = new S3LocationProperty {
        Uri = "uri",

        // the properties below are optional
        VersionId = "versionId"
    },
    TargetOperations = new [] { "targetOperations" },

    // the properties below are optional
    LogBucket = "logBucket",
    Options = new OptionsProperty {
        InputParams = new S3LocationProperty {
            Uri = "uri",

            // the properties below are optional
            VersionId = "versionId"
        }
    },
    StackFilters = new StackFiltersProperty {
        FilteringCriteria = "filteringCriteria",

        // the properties below are optional
        StackNames = new StackNamesProperty {
            Exclude = new [] { "exclude" },
            Include = new [] { "include" }
        },
        StackRoles = new StackRolesProperty {
            Exclude = new [] { "exclude" },
            Include = new [] { "include" }
        }
    },
    TargetFilters = new TargetFiltersProperty {
        Targets = new [] { new HookTargetProperty {
            Action = "action",
            InvocationPoint = "invocationPoint",
            TargetName = "targetName"
        } },

        // the properties below are optional
        Actions = new [] { "actions" },
        InvocationPoints = new [] { "invocationPoints" },
        TargetNames = new [] { "targetNames" }
    }
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"

cfnGuardHookProps := &CfnGuardHookProps{
	Alias: jsii.String("alias"),
	ExecutionRole: jsii.String("executionRole"),
	FailureMode: jsii.String("failureMode"),
	HookStatus: jsii.String("hookStatus"),
	RuleLocation: &S3LocationProperty{
		Uri: jsii.String("uri"),

		// the properties below are optional
		VersionId: jsii.String("versionId"),
	},
	TargetOperations: []*string{
		jsii.String("targetOperations"),
	},

	// the properties below are optional
	LogBucket: jsii.String("logBucket"),
	Options: &OptionsProperty{
		InputParams: &S3LocationProperty{
			Uri: jsii.String("uri"),

			// the properties below are optional
			VersionId: jsii.String("versionId"),
		},
	},
	StackFilters: &StackFiltersProperty{
		FilteringCriteria: jsii.String("filteringCriteria"),

		// the properties below are optional
		StackNames: &StackNamesProperty{
			Exclude: []*string{
				jsii.String("exclude"),
			},
			Include: []*string{
				jsii.String("include"),
			},
		},
		StackRoles: &StackRolesProperty{
			Exclude: []*string{
				jsii.String("exclude"),
			},
			Include: []*string{
				jsii.String("include"),
			},
		},
	},
	TargetFilters: &TargetFiltersProperty{
		Targets: []interface{}{
			&HookTargetProperty{
				Action: jsii.String("action"),
				InvocationPoint: jsii.String("invocationPoint"),
				TargetName: jsii.String("targetName"),
			},
		},

		// the properties below are optional
		Actions: []*string{
			jsii.String("actions"),
		},
		InvocationPoints: []*string{
			jsii.String("invocationPoints"),
		},
		TargetNames: []*string{
			jsii.String("targetNames"),
		},
	},
}
```

## Properties

- `alias`: string (required) — The type name alias for the Hook. This alias must be unique per account and Region.

  The alias must be in the form `Name1::Name2::Name3` and must not begin with `AWS` . For example, `Private::Guard::MyTestHook` .

- `executionRole`: string (required) — The IAM role that the Hook assumes to retrieve your Guard rules from S3 and optionally write a detailed Guard output report back.

- `failureMode`: string (required) = "WARN" — Specifies how the Hook responds when rules fail their evaluation.

  - `FAIL` : Prevents the action from proceeding. This is helpful for enforcing strict compliance or security policies.
  - `WARN` : Issues warnings to users but allows actions to continue. This is useful for non-critical validations or informational checks.

- `hookStatus`: string (required) = "DISABLED" — Specifies if the Hook is `ENABLED` or `DISABLED` .

- `logBucket`: string — Specifies the name of an S3 bucket to store the Guard output report.

  This report contains the results of your Guard rule validations.

- `options`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.OptionsProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnGuardHook.OptionsProperty.html) — Specifies the S3 location of your input parameters.

- `ruleLocation`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.S3LocationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnGuardHook.S3LocationProperty.html) (required) — Specifies the S3 location of your Guard rules.

- `stackFilters`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.StackFiltersProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnGuardHook.StackFiltersProperty.html) — Specifies the stack level filters for the Hook.

  Example stack level filter in JSON:

  `"StackFilters": {"FilteringCriteria": "ALL", "StackNames": {"Exclude": [ "stack-1", "stack-2"]}}`

  Example stack level filter in YAML:

  `StackFilters: FilteringCriteria: ALL StackNames: Exclude: - stack-1 - stack-2`

- `targetFilters`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.TargetFiltersProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnGuardHook.TargetFiltersProperty.html) — Specifies the target filters for the Hook.

  Example target filter in JSON:

  `"TargetFilters": {"Actions": [ "CREATE", "UPDATE", "DELETE" ]}`

  Example target filter in YAML:

  `TargetFilters: Actions: - CREATE - UPDATE - DELETE`

- `targetOperations`: string[] (required) — Specifies the list of operations the Hook is run against.

  For more information, see [Hook targets](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/hooks-concepts.html#hook-terms-hook-target) in the *CloudFormation Hooks User Guide* .

  Valid values: `STACK` | `RESOURCE` | `CHANGE_SET` | `CLOUD_CONTROL`
