| Total Complexity | 4 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
| 18 | class AddHeartbeatAction(OpsGenieBaseAction): |
||
| 19 | def run(self, name, interval=None, intervalUnit=None, description=None, enabled=False): |
||
| 20 | """ |
||
| 21 | """ |
||
| 22 | |||
| 23 | body = {"apiKey": self.api_key, |
||
| 24 | "name": name, |
||
| 25 | "enabled": enabled} |
||
| 26 | |||
| 27 | if interval: |
||
| 28 | body["interval"] = interval |
||
| 29 | |||
| 30 | if intervalUnit: |
||
| 31 | body["intervalUnit"] = intervalUnit |
||
| 32 | |||
| 33 | if description: |
||
| 34 | body["description"] = description |
||
| 35 | |||
| 36 | data = self._req("POST", |
||
| 37 | "v1/json/heartbeat", |
||
| 38 | body=body) |
||
| 39 | |||
| 40 | return data |
||
| 41 |