Describe Rule

Get All Action Rule

It lists all the available action rules.

  • Click on GET actionRules API in swagger and hit Try it out! button , it wil display all the action rules created by the user as mentioned below:

[
  {
    "RuleId": 2081,
    "RuleName": "ESRegister1",
    "Status": "stopped",
    "RuleDescription": "checking rule",
    "noOfInstance": 3,
    "input": {
      "type": "Direct",
      "exchange": "Direct.Exchange.Register",
      "topic": "testTopic.*",
      "MQName": null
    },
    "actions": [
      {
        "type": "ElasticSearchRegister",
        "parameter": [
          {
            "name": "connectorURL",
            "value": "10.100.10.224:9300"
          },
          {
            "name": "connectionTimeout",
            "value": "6000"
          },
          {
            "name": "clusterName",
            "value": "cto_dev_cluster"
          },
          {
            "name": "mappingName",
            "value": "sensors:sensor"
          },
          {
            "name": "indexName",
            "value": "uKK6WjaZZnnYBj1G6rONQgNAIuc="
          },
          {
            "name": "schema",
            "value": "[{\"spec\":{\"sensors\":{\"*\":{\"output\":{\"*\":{\"@type\":\"[&3].output.properties.@name.type\"}}}}},
                     \"operation\":\"shift\"},{\"spec\":{\"*\":{\"endtime\":{\"format\":\"dateOptionalTime\",\"type\":\"date\"},
                     \"sensor\":{\"type\":\"string\"},\"position_global\":{\"properties\":{\"location\":{\"type\":\"geo_point\"},
                     \"altitude\":{\"type\":\"string\"}}},\"starttime\":{\"format\":\"dateOptionalTime\",\"type\":\"date\"},
                     \"validUpto\":{\"format\":\"dateOptionalTime\",\"type\":\"date\"},\"privacy\":{\"type\":\"string\"},
                     \"composedOfSensors\":{\"type\":\"string\"},\"feature\":{\"type\":\"string\"},\"offering\":{\"type\":\"string\"},
                     \"isMobile\":{\"type\":\"string\"},\"position-local\":{\"properties\":{\"name\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"},
                     \"type\":{\"type\":\"string\"}}},\"isComposite\":{\"type\":\"string\"}}},\"operation\":\"default\"}]"
          }
        ]
      }
    ]
   },
   {
    "RuleId": 2101,
    "RuleName": "TestRule7",
    "Status": "stopped",
    "RuleDescription": "checking",
    "noOfInstance": 1,
    "input": {
      "type": "topic",
      "exchange": "testTopicExchange1",
      "topic": "testTopic.*",
      "MQName": null
    },
    "actions": [
      {
        "type": "SOS",
        "parameter": [
          {
            "name": "x-api-key",
            "value": "NZOlaIbIQikF9FoNbdbLsOwK9M=",
            "type": "header",
            "dataType": ""
          },
          {
            "name": "content-type",
            "value": "application/json",
            "type": "header",
            "dataType": ""
          },
          {
            "name": "payload",
            "value": "asInput"
          },
          {
            "name": "connectorURL",
            "value": "http://10.100.10.224:80/api/sos/v2.0/observations"
          },
          {
            "name": "connectionTimeout",
            "value": "5000"
          }
        ]
      }
     ]
    }
 ]

The swagger image for get all action rule is as follows:

../../_images/getallaction.png

Get a Specific Action Type Rule

It is also possible to get all the rules of a specific action type.

  • Click on GET actionRules API in swagger, give the action type name and hit Try it out! button, it wil display all the action rules created by user as below:

[
             {
                     "RuleId": 61,
                     "RuleName": "TestRule7",
                     "Status": "stopped",
                     "RuleDescription": "checking",
                     "noOfInstance": 1,
                     "input": {
                       "type": "topic",
                       "exchange": "testTopicExchange1",
                       "topic": "testTopic.*",
                       "MQName": null
                     },
                     "actions": [
                       {
                             "type": "RDBMS",
                             "parameter": [
                               {
                                     "name": "connectionTimeout",
                                     "value": "5000"
                               },
                               {
                                     "name": "connectorURL",
                                     "value": "10.10.10.219:5432"
                               },
                               {
                                     "name": "tableName",
                                     "value": "actionmod333"
                               },
                               {
                                     "name": "password",
                                     "value": "postgres"
                               },
                               {
                                     "name": "username",
                                     "value": "postgres"
                               },
                               {
                                     "name": "dbName",
                                     "value": "ActionModuleTEST"
                               },
                               {
                                     "name": "Illumination",
                                     "value": "observations:record:output:Illumination",
                                     "type": "columnName",
                                     "dataType": "integer"
                               },
                               {
                                     "name": "Sensor",
                                     "value": "observations:sensor",
                                     "type": "columnName",
                                     "dataType": "String"
                               }
                             ]
                       }
                     ]
             },
             {
                     "RuleId": 3,
                     "RuleName": "EONRule3",
                     "Status": "stopped",
                     "RuleDescription": "checking",
                     "noOfInstance": 2,
                     "input": {
                       "type": "topic",
                       "exchange": "EONExchnage",
                       "topic": "EONTopic.*",
                       "MQName": null
                     },
                     "actions": [
                       {
                             "type": "RDBMS",
                             "parameter": [
                               {
                                     "name": "Sensor",
                                     "value": "observation:sensor",
                                     "type": "columnName",
                                     "dataType": "String"
                               },
                               {
                                     "name": "consumption",
                                     "value": "observations:record:output:consumption",
                                     "type": "columnName",
                                     "dataType": "integer"
                               },
                               {
                                     "name": "starttime",
                                     "value": "observations:record:starttime",
                                     "type": "columnName",
                                     "dataType": "integer"
                               },
                               {
                                     "name": "dbName",
                                     "value": "connectedhome1"
                               },
                               {
                                     "name": "username",
                                     "value": "postgres"
                               },
                               {
                                     "name": "password",
                                     "value": "postgres"
                               },
                               {
                                     "name": "tableName",
                                     "value": "alerttable"
                               },
                               {
                                     "name": "connectorURL",
                                     "value": "50.16.234.106:5432"
                               },
                               {
                                     "name": "connectionTimeout",
                                     "value": "5000"
                               }
                             ]
                       }
                     ]
             }
     ]

The swagger image for get all action rule of a specific type is as follows:

../../_images/getallactionrdbms.png

Get a Specific Action Rule

It gives a specific action rule based on rule ID.

  • Click on GET actionRules/{rule_id} API in swagger ,give rule ID and hit Try it out! button, it will display the action rule of the mentioned rule ID as below:

{
    "RuleId": 2101,
    "RuleName": "TestRule7",
    "Status": "stopped",
    "RuleDescription": "checking",
    "noOfInstance": 1,
    "input": {
      "type": "topic",
      "exchange": "testTopicExchange1",
      "topic": "testTopic.*",
      "MQName": null
     },
     "actions": [
      {
        "type": "SOS",
        "parameter": [
          {
            "name": "x-api-key",
            "value": "NZOlaIbIQikF9FoNbdbLsOwK9M=",
            "type": "header",
            "dataType": ""
          },
          {
            "name": "content-type",
            "value": "application/json",
            "type": "header",
            "dataType": ""
          },
          {
            "name": "payload",
            "value": "asInput"
          },
          {
            "name": "connectorURL",
            "value": "http://10.100.10.224:80/api/sos/v2.0/observations"
          },
          {
            "name": "connectionTimeout",
            "value": "5000"
          }
        ]
      }
    ]
 }

The swagger image for getting a specific action rule is as follows:

../../_images/getaction.png