Skip to content

Check User Status Example

  • Use Case: Automated infrastructure provisioning cannot fulfill user requests unless the users are authorized for access.
  • Example Recipe: In this example, the Ops Engineering Team uses a recipe to query a Microsoft SQL database and load new requests for infrastructure resources. Two action nodes verify that a request is valid and that the requesting user is authorized. An ingredient node calls a provisioning ingredient variation to set up new virtual machines, new databases, EC2 instances in AWS, or other resources to fulfill the request.
  • Conditional Node Role: Following the action nodes that verify a request and user, a conditional node determines if the graph should call the provisioning workflow or reject the request based on the value of a verification variable.

()

A conditional node determines if automated infrastructure provision should execute or not.

Web App Configuration

The following images show how the conditional node is configured using the web app forms.

  • Exporting the variable from a SQL script in an upstream node
  • Writing the condition statement for evaluation of the variable

()

The action node upstream of the conditional node generates a variable from a user lookup.

()

The conditional node evaluates the user_auth_verification variable for a value of 1 to continue the provisioning workflow.

File Contents

The platform records the condition node configuration shown above in the recipe's variations.json file.

{
    "variation-list": {
        "ops_request_provisioning": {
            "description": "Variation verifies user requests and triggers provisioning ingredient",
            "graph-setting": "provisioning_graph",
            "schedule-setting": "daily_4am"
        }
    },
    "graph-setting-list": {
        "usage_graph": [
            [
                "Query_Load_Requests",
                "Verify_Requests"
            ],
            [
                "Verify_Requests",
                "Verify_User"
            ],
            [
                "Verify_User",
                "Check_User_Auth"
            ],
            [
                "Check_User_Auth",
                "Provision_Infra",
                {
                    "condition": "condition_1_true"
                }
            ],
            [
                "Check_User_Auth",
                "Update_Request_Send_Email",
                {
                    "condition": "condition_1_false"
                }
            ],
            [
                "Provision_Infra",
                "Send_Confirmation"
            ]
        ]
    },
    "conditions-list": {
        "condition_1_true": {
            "mode": "condition",
            "index": 1,
            "condition": {
                "list": [
                    {
                        "metric": "1",
                        "variable": "user_auth_verification",
                        "compare": "equal-to",
                        "execute": [
                            "Provision_Infra"
                        ],
                        "isTrueExecution": true,
                        "type": "test-contents-as-integer"
                    }
                ]
            },
            "node": "Check_User_Auth"
        },
        "condition_1_false": {
            "mode": "condition",
            "index": 1,
            "condition": {
                "list": [
                    {
                        "metric": "1",
                        "variable": "user_auth_verification",
                        "compare": "equal-to",
                        "execute": [
                            "Update_Request_Send_Email"
                        ],
                        "isTrueExecution": false,
                        "type": "test-contents-as-integer"
                    }
                ]
            },
            "node": "Check_User_Auth"
        }
    },
    "schedule-setting-list": {
        "daily_4am": {
            "schedule": "0 4 * * *",
            "scheduleTimeZone": "America/New York"
        }
    }
}