# CfnRuleProps

A rule can include a RuleCondition property and must include an Assertions property.

For each rule, you can define only one rule condition; you can define one or more asserts within the Assertions property.
You define a rule condition and assertions by using rule-specific intrinsic functions.

You can use the following rule-specific intrinsic functions to define rule conditions and assertions:

 Fn::And
 Fn::Contains
 Fn::EachMemberEquals
 Fn::EachMemberIn
 Fn::Equals
 Fn::If
 Fn::Not
 Fn::Or
 Fn::RefAll
 Fn::ValueOf
 Fn::ValueOfAll

https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html

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

- Source: [`core/lib/cfn-rule.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/core/lib/cfn-rule.ts#L27)

## 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';

declare const cfnConditionExpression: cdk.ICfnConditionExpression;
const cfnRuleProps: cdk.CfnRuleProps = {
  assertions: [{
    assert: cfnConditionExpression,
    assertDescription: 'assertDescription',
  }],
  ruleCondition: cfnConditionExpression,
};
```

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_condition_expression: cdk.ICfnConditionExpression

cfn_rule_props = cdk.CfnRuleProps(
    assertions=[cdk.CfnRuleAssertion(
        assert=cfn_condition_expression,
        assert_description="assertDescription"
    )],
    rule_condition=cfn_condition_expression
)
```

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

ICfnConditionExpression cfnConditionExpression;

CfnRuleProps cfnRuleProps = CfnRuleProps.builder()
        .assertions(List.of(CfnRuleAssertion.builder()
                .assert(cfnConditionExpression)
                .assertDescription("assertDescription")
                .build()))
        .ruleCondition(cfnConditionExpression)
        .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;

ICfnConditionExpression cfnConditionExpression;

var cfnRuleProps = new CfnRuleProps {
    Assertions = new [] { new CfnRuleAssertion {
        Assert = cfnConditionExpression,
        AssertDescription = "assertDescription"
    } },
    RuleCondition = cfnConditionExpression
};
```

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"

var cfnConditionExpression ICfnConditionExpression

cfnRuleProps := &CfnRuleProps{
	Assertions: []CfnRuleAssertion{
		&CfnRuleAssertion{
			Assert: cfnConditionExpression,
			AssertDescription: jsii.String("assertDescription"),
		},
	},
	RuleCondition: cfnConditionExpression,
}
```

## Properties

- `assertions`: [CfnRuleAssertion](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnRuleAssertion.html)[] — Assertions which define the rule.

  **Default:** No assertions for the rule.

- `ruleCondition`: [ICfnConditionExpression](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.ICfnConditionExpression.html) — If the rule condition evaluates to false, the rule doesn't take effect.

  **Default:** Rule's assertions will always take effect.

  If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied.
