Show / Hide Table of Contents

Class CfnRule

The Rules that define template constraints in an AWS Service Catalog portfolio describe when end users can use the template and which values they can specify for parameters that are declared in the AWS CloudFormation template used to create the product they are attempting to use.

Inheritance
object
CfnElement
CfnRefElement
CfnRule
Inherited Members
CfnRefElement.Ref
CfnElement.IsCfnElement(object)
CfnElement.OverrideLogicalId(string)
CfnElement.With(params IMixin[])
CfnElement.CreationStack
CfnElement.LogicalId
CfnElement.Stack
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnRule : CfnRefElement
Syntax (vb)
Public Class CfnRule Inherits CfnRefElement
Remarks

Rules are useful for preventing end users from inadvertently specifying an incorrect value. For example, you can add a rule to verify whether end users specified a valid subnet in a given VPC or used m1.small instance types for test environments. AWS CloudFormation uses rules to validate parameter values before it creates the resources for the product.

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.

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

ExampleMetadata: infused

Examples
CfnInclude cfnTemplate;

             // mutating the rule
             CfnParameter myParameter;

             var rule = cfnTemplate.GetRule("MyRule");
             rule.AddAssertion(Fn.ConditionContains(new [] { "m1.small" }, myParameter.ValueAsString), "MyParameter has to be m1.small");

Synopsis

Constructors

CfnRule(Construct, string, ICfnRuleProps?)

Creates and adds a rule.

Methods

AddAssertion(ICfnConditionExpression, string)

Adds an assertion to the rule.

Constructors

CfnRule(Construct, string, ICfnRuleProps?)

Creates and adds a rule.

public CfnRule(Construct scope, string id, ICfnRuleProps? props = null)
Parameters
scope Construct

The parent construct.

id string

The parent construct.

props ICfnRuleProps

The rule props.

Remarks

Rules are useful for preventing end users from inadvertently specifying an incorrect value. For example, you can add a rule to verify whether end users specified a valid subnet in a given VPC or used m1.small instance types for test environments. AWS CloudFormation uses rules to validate parameter values before it creates the resources for the product.

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.

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

ExampleMetadata: infused

Methods

AddAssertion(ICfnConditionExpression, string)

Adds an assertion to the rule.

public virtual void AddAssertion(ICfnConditionExpression condition, string description)
Parameters
condition ICfnConditionExpression

The expression to evaluation.

description string

The description of the assertion.

Remarks

Rules are useful for preventing end users from inadvertently specifying an incorrect value. For example, you can add a rule to verify whether end users specified a valid subnet in a given VPC or used m1.small instance types for test environments. AWS CloudFormation uses rules to validate parameter values before it creates the resources for the product.

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.

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

ExampleMetadata: infused

Back to top Generated by DocFX