forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmalware_settings.py
More file actions
49 lines (37 loc) · 2.14 KB
/
Copy pathmalware_settings.py
File metadata and controls
49 lines (37 loc) · 2.14 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
class MalwareSettings(object):
def __init__(self, session):
super(MalwareSettings, self).__init__()
self._session = session
def getNetworkSecurityMalwareSettings(self, networkId: str):
"""
**Returns all supported malware settings for an MX network**
https://developer.cisco.com/meraki/api/#!get-network-security-malware-settings
- networkId (string)
"""
metadata = {
'tags': ['Malware settings'],
'operation': 'getNetworkSecurityMalwareSettings',
}
resource = f'/networks/{networkId}/security/malwareSettings'
return self._session.get(metadata, resource)
def updateNetworkSecurityMalwareSettings(self, networkId: str, mode: str, **kwargs):
"""
**Set the supported malware settings for an MX network**
https://developer.cisco.com/meraki/api/#!update-network-security-malware-settings
- networkId (string)
- mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled'
- allowedUrls (array): The urls that should be permitted by the malware detection engine. If omitted, the current config will remain unchanged. This is available only if your network supports AMP whitelisting
- allowedFiles (array): The sha256 digests of files that should be permitted by the malware detection engine. If omitted, the current config will remain unchanged. This is available only if your network supports AMP whitelisting
"""
kwargs.update(locals())
if 'mode' in kwargs:
options = ['enabled', 'disabled']
assert kwargs['mode'] in options, f'''"mode" cannot be "{kwargs['mode']}", & must be set to one of: {options}'''
metadata = {
'tags': ['Malware settings'],
'operation': 'updateNetworkSecurityMalwareSettings',
}
resource = f'/networks/{networkId}/security/malwareSettings'
body_params = ['mode', 'allowedUrls', 'allowedFiles']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)