install.py
def install_openwhisk_rules(available_sequences, available_actions):
    """
    This installs a rule that connects a trigger (an alarm in our case) to an action.
    For examle, this will cause the fetch-aws-keys-write-doc action to run every four hours:

    $ wsk rule create scheduled-fetch-aws-keys-write-doc every4Hours fetch-aws-keys-write-doc
    """

    rules = {
        "scheduled-github-user-events-scanner-nuker": {
            "trigger": KEYNUKER_ALARM_TRIGGER,
            "action": "github-user-events-scanner-nuker",
        },
        "scheduled-monitor-activations": {
            "trigger": KEYNUKER_ALARM_TRIGGER,
            "action": "monitor-activations",
        },
        "scheduled-activity-report": {
            "trigger": KEYNUKER_WEEKLY_ALARM_TRIGGER,
            "action": "activity-report",
        },
    }

    for rule, rule_target in rules.iteritems():
        trigger = rule_target["trigger"]
        action = rule_target["action"]

        # Make sure all the actions in this sequence are valid.  This protects
        # against bugs due to renaming actions, and forgetting to update the action_sequences dictionary
        if action not in available_actions and action not in available_sequences:
            raise Exception("Invalid action: {}.  Not in available_actions: {} or available_sequences: {}".format(action, available_actions, available_sequences))

        if openwhisk_rule_exists(rule):
            delete_openwhisk_rule(rule)
        
        command = "{} rule create {} {} {}".format(
            WSK_CMD,
            rule,
            trigger,
            action,
        )

        print(command)
        subprocess.check_call(command, shell=True)

    This installs a rule that connects a trigger (an alarm in our case) to an action.
    For examle, this will cause the fetch-aws-keys-write-doc action to run every four hours:

    $ wsk rule create scheduled-fetch-aws-keys-write-doc every4Hours fetch-aws-keys-write-doc
    
This installs a rule that connects a trigger (an alarm in our case) to an action.
For examle, this will cause the fetch-aws-keys-write-doc action to run every four hours.


This installs a rule that connects a trigger ( an alarm in our case ) to an action . For examle this will cause the fetch - aws - keys - write - doc action to run every four hours .
def install_openwhisk_rules(available_sequences, available_actions):
    rules = {
        "scheduled-github-user-events-scanner-nuker": {
            "trigger": KEYNUKER_ALARM_TRIGGER,
            "action": "github-user-events-scanner-nuker",
        },
        "scheduled-monitor-activations": {
            "trigger": KEYNUKER_ALARM_TRIGGER,
            "action": "monitor-activations",
        },
        "scheduled-activity-report": {
            "trigger": KEYNUKER_WEEKLY_ALARM_TRIGGER,
            "action": "activity-report",
        },
    }
    for rule, rule_target in rules.iteritems():
        trigger = rule_target["trigger"]
        action = rule_target["action"]
        if action not in available_actions and action not in available_sequences:
            raise Exception("Invalid action: {}.  Not in available_actions: {} or available_sequences: {}".format(action, available_actions, available_sequences))
        if openwhisk_rule_exists(rule):
            delete_openwhisk_rule(rule)
        command = "{} rule create {} {} {}".format(
            WSK_CMD,
            rule,
            trigger,
            action,
        )
        print(command)
        subprocess.check_call(command, shell=True)
def install_openwhisk_rules ( available_sequences , available_actions ) : rules = { "scheduled-github-user-events-scanner-nuker" : { "trigger" : KEYNUKER_ALARM_TRIGGER , "action" : "github-user-events-scanner-nuker" , } , "scheduled-monitor-activations" : { "trigger" : KEYNUKER_ALARM_TRIGGER , "action" : "monitor-activations" , } , "scheduled-activity-report" : { "trigger" : KEYNUKER_WEEKLY_ALARM_TRIGGER , "action" : "activity-report" , } , } for rule , rule_target in rules . iteritems ( ) : trigger = rule_target [ "trigger" ] action = rule_target [ "action" ] if action not in available_actions and action not in available_sequences : raise Exception ( "Invalid action: {}.  Not in available_actions: {} or available_sequences: {}" . format ( action , available_actions , available_sequences ) ) if openwhisk_rule_exists ( rule ) : delete_openwhisk_rule ( rule ) command = "{} rule create {} {} {}" . format ( WSK_CMD , rule , trigger , action , ) print ( command ) subprocess . check_call ( command , shell = True )
This installs a rule that connects a trigger (an alarm in our case) to an action.
This installs a rule that connects a trigger ( an alarm in our case ) to an action .
"""
    This installs a rule that connects a trigger (an alarm in our case) to an action.
    For examle, this will cause the fetch-aws-keys-write-doc action to run every four hours:

    $ wsk rule create scheduled-fetch-aws-keys-write-doc every4Hours fetch-aws-keys-write-doc
    """ # Make sure all the actions in this sequence are valid.  This protects # against bugs due to renaming actions, and forgetting to update the action_sequences dictionary
available_sequences
available_actions