forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensor.py
More file actions
104 lines (72 loc) · 3.38 KB
/
Copy pathsensor.py
File metadata and controls
104 lines (72 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import urllib
class ActionBatchSensor(object):
def __init__(self):
super(ActionBatchSensor, self).__init__()
def createNetworkSensorAlertsProfile(self, networkId: str, name: str, conditions: list, **kwargs):
"""
**Creates a sensor alert profile for a network.**
https://developer.cisco.com/meraki/api-v1/#!create-network-sensor-alerts-profile
- networkId (string): (required)
- name (string): Name of the sensor alert profile.
- conditions (array): List of conditions that will cause the profile to send an alert.
- schedule (object): The sensor schedule to use with the alert profile.
- recipients (object): List of recipients that will recieve the alert.
- serials (array): List of device serials assigned to this sensor alert profile.
"""
kwargs.update(locals())
metadata = {
'tags': ['sensor', 'configure', 'alerts', 'profiles'],
'operation': 'createNetworkSensorAlertsProfile'
}
resource = f'/networks/{networkId}/sensor/alerts/profiles'
body_params = ['name', 'schedule', 'conditions', 'recipients', 'serials', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "create",
"body": payload
}
return action
def updateNetworkSensorAlertsProfile(self, networkId: str, id: str, **kwargs):
"""
**Updates a sensor alert profile for a network.**
https://developer.cisco.com/meraki/api-v1/#!update-network-sensor-alerts-profile
- networkId (string): (required)
- id (string): (required)
- name (string): Name of the sensor alert profile.
- schedule (object): The sensor schedule to use with the alert profile.
- conditions (array): List of conditions that will cause the profile to send an alert.
- recipients (object): List of recipients that will recieve the alert.
- serials (array): List of device serials assigned to this sensor alert profile.
"""
kwargs.update(locals())
metadata = {
'tags': ['sensor', 'configure', 'alerts', 'profiles'],
'operation': 'updateNetworkSensorAlertsProfile'
}
resource = f'/networks/{networkId}/sensor/alerts/profiles/{id}'
body_params = ['name', 'schedule', 'conditions', 'recipients', 'serials', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "update",
"body": payload
}
return action
def deleteNetworkSensorAlertsProfile(self, networkId: str, id: str):
"""
**Deletes a sensor alert profile from a network.**
https://developer.cisco.com/meraki/api-v1/#!delete-network-sensor-alerts-profile
- networkId (string): (required)
- id (string): (required)
"""
metadata = {
'tags': ['sensor', 'configure', 'alerts', 'profiles'],
'operation': 'deleteNetworkSensorAlertsProfile'
}
resource = f'/networks/{networkId}/sensor/alerts/profiles/{id}'
action = {
"resource": resource,
"operation": "destroy",
}
return action