UNPKG

3.32 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { ICfnConditionExpression } from './cfn-condition';
3import { CfnRefElement } from './cfn-element';
4/**
5 * A rule can include a RuleCondition property and must include an Assertions property.
6 * For each rule, you can define only one rule condition; you can define one or more asserts within the Assertions property.
7 * You define a rule condition and assertions by using rule-specific intrinsic functions.
8 *
9 * You can use the following rule-specific intrinsic functions to define rule conditions and assertions:
10 *
11 * Fn::And
12 * Fn::Contains
13 * Fn::EachMemberEquals
14 * Fn::EachMemberIn
15 * Fn::Equals
16 * Fn::If
17 * Fn::Not
18 * Fn::Or
19 * Fn::RefAll
20 * Fn::ValueOf
21 * Fn::ValueOfAll
22 *
23 * https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html
24 */
25export interface CfnRuleProps {
26 /**
27 * If the rule condition evaluates to false, the rule doesn't take effect.
28 * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied.
29 *
30 * @default - Rule's assertions will always take effect.
31 */
32 readonly ruleCondition?: ICfnConditionExpression;
33 /**
34 * Assertions which define the rule.
35 *
36 * @default - No assertions for the rule.
37 */
38 readonly assertions?: CfnRuleAssertion[];
39}
40/**
41 * The Rules that define template constraints in an AWS Service Catalog portfolio describe when
42 * end users can use the template and which values they can specify for parameters that are declared
43 * in the AWS CloudFormation template used to create the product they are attempting to use. Rules
44 * are useful for preventing end users from inadvertently specifying an incorrect value.
45 * For example, you can add a rule to verify whether end users specified a valid subnet in a
46 * given VPC or used m1.small instance types for test environments. AWS CloudFormation uses
47 * rules to validate parameter values before it creates the resources for the product.
48 *
49 * A rule can include a RuleCondition property and must include an Assertions property.
50 * For each rule, you can define only one rule condition; you can define one or more asserts within the Assertions property.
51 * You define a rule condition and assertions by using rule-specific intrinsic functions.
52 *
53 * @link https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html
54 */
55export declare class CfnRule extends CfnRefElement {
56 private ruleCondition?;
57 private assertions?;
58 /**
59 * Creates and adds a rule.
60 * @param scope The parent construct.
61 * @param props The rule props.
62 */
63 constructor(scope: Construct, id: string, props?: CfnRuleProps);
64 /**
65 * Adds an assertion to the rule.
66 * @param condition The expression to evaluation.
67 * @param description The description of the assertion.
68 */
69 addAssertion(condition: ICfnConditionExpression, description: string): void;
70 /**
71 * @internal
72 */
73 _toCloudFormation(): object;
74}
75/**
76 * A rule assertion.
77 */
78export interface CfnRuleAssertion {
79 /**
80 * The assertion.
81 */
82 readonly assert: ICfnConditionExpression;
83 /**
84 * The assertion description.
85 */
86 readonly assertDescription: string;
87}