1aebb3ee5SShawn McCarney# if 2aebb3ee5SShawn McCarney 3aebb3ee5SShawn McCarney## Description 40dbce568SPatrick Williams 5aebb3ee5SShawn McCarneyPerforms actions based on whether a condition is true. 6aebb3ee5SShawn McCarney 7aebb3ee5SShawn McCarneyThe "condition" property specifies an action to execute. The condition is true 8aebb3ee5SShawn McCarneyif the action returns true. Otherwise the condition is false. 9aebb3ee5SShawn McCarney 10aebb3ee5SShawn McCarneyIf the condition is true, the actions within the "then" property are executed. 11aebb3ee5SShawn McCarney 12aebb3ee5SShawn McCarneyIf the condition is false, the actions within the "else" property are executed 13aebb3ee5SShawn McCarney(if specified). 14aebb3ee5SShawn McCarney 15aebb3ee5SShawn McCarney## Properties 160dbce568SPatrick Williams 17aebb3ee5SShawn McCarney| Name | Required | Type | Description | 180dbce568SPatrick Williams| :-------- | :------: | :---------------------------- | :---------------------------------------------------- | 19aebb3ee5SShawn McCarney| condition | yes | [action](action.md) | Action that tests whether condition is true. | 20aebb3ee5SShawn McCarney| then | yes | array of [actions](action.md) | One or more actions to perform if condition is true. | 21aebb3ee5SShawn McCarney| else | no | array of [actions](action.md) | One or more actions to perform if condition is false. | 22aebb3ee5SShawn McCarney 23aebb3ee5SShawn McCarney## Return Value 240dbce568SPatrick Williams 25aebb3ee5SShawn McCarneyIf the condition was true, returns the value of the last action in the "then" 26aebb3ee5SShawn McCarneyproperty. 27aebb3ee5SShawn McCarney 28aebb3ee5SShawn McCarneyIf the condition was false, returns the value of the last action in the "else" 29aebb3ee5SShawn McCarneyproperty. If no "else" property was specified, returns false. 30aebb3ee5SShawn McCarney 31aebb3ee5SShawn McCarney## Example 320dbce568SPatrick Williams 33*6151c286SGeorge Liu```json 34aebb3ee5SShawn McCarney{ 35aebb3ee5SShawn McCarney "comments": ["If regulator is downlevel use different configuration rule"], 36aebb3ee5SShawn McCarney "if": { 37aebb3ee5SShawn McCarney "condition": { 38aebb3ee5SShawn McCarney "run_rule": "is_downlevel_regulator" 39aebb3ee5SShawn McCarney }, 40*6151c286SGeorge Liu "then": [{ "run_rule": "configure_downlevel_regulator" }], 41*6151c286SGeorge Liu "else": [{ "run_rule": "configure_standard_regulator" }] 42aebb3ee5SShawn McCarney } 43aebb3ee5SShawn McCarney} 44aebb3ee5SShawn McCarney``` 45