forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp_servers.py
More file actions
143 lines (108 loc) · 4.83 KB
/
Copy pathhttp_servers.py
File metadata and controls
143 lines (108 loc) · 4.83 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
class AsyncHTTPServers:
def __init__(self, session):
super().__init__()
self._session = session
async def getNetworkHttpServers(self, networkId: str):
"""
**List the HTTP servers for a network**
https://developer.cisco.com/meraki/api/#!get-network-http-servers
- networkId (string)
"""
metadata = {
'tags': ['HTTP servers'],
'operation': 'getNetworkHttpServers',
}
resource = f'/networks/{networkId}/httpServers'
return await self._session.get(metadata, resource)
async def createNetworkHttpServer(self, networkId: str, name: str, url: str, **kwargs):
"""
**Add an HTTP server to a network**
https://developer.cisco.com/meraki/api/#!create-network-http-server
- networkId (string)
- name (string): A name for easy reference to the HTTP server
- url (string): The URL of the HTTP server
- sharedSecret (string): A shared secret that will be included in POSTs sent to the HTTP server. This secret can be used to verify that the request was sent by Meraki.
"""
kwargs.update(locals())
metadata = {
'tags': ['HTTP servers'],
'operation': 'createNetworkHttpServer',
}
resource = f'/networks/{networkId}/httpServers'
body_params = ['name', 'url', 'sharedSecret']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return await self._session.post(metadata, resource, payload)
async def createNetworkHttpServersWebhookTest(self, networkId: str, url: str):
"""
**Send a test webhook for a network**
https://developer.cisco.com/meraki/api/#!create-network-http-servers-webhook-test
- networkId (string)
- url (string): The URL where the test webhook will be sent
"""
kwargs = locals()
metadata = {
'tags': ['HTTP servers'],
'operation': 'createNetworkHttpServersWebhookTest',
}
resource = f'/networks/{networkId}/httpServers/webhookTests'
body_params = ['url']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return await self._session.post(metadata, resource, payload)
async def getNetworkHttpServersWebhookTest(self, networkId: str, id: str):
"""
**Return the status of a webhook test for a network**
https://developer.cisco.com/meraki/api/#!get-network-http-servers-webhook-test
- networkId (string)
- id (string)
"""
metadata = {
'tags': ['HTTP servers'],
'operation': 'getNetworkHttpServersWebhookTest',
}
resource = f'/networks/{networkId}/httpServers/webhookTests/{id}'
return await self._session.get(metadata, resource)
async def getNetworkHttpServer(self, networkId: str, id: str):
"""
**Return an HTTP server for a network**
https://developer.cisco.com/meraki/api/#!get-network-http-server
- networkId (string)
- id (string)
"""
metadata = {
'tags': ['HTTP servers'],
'operation': 'getNetworkHttpServer',
}
resource = f'/networks/{networkId}/httpServers/{id}'
return await self._session.get(metadata, resource)
async def updateNetworkHttpServer(self, networkId: str, id: str, **kwargs):
"""
**Update an HTTP server**
https://developer.cisco.com/meraki/api/#!update-network-http-server
- networkId (string)
- id (string)
- name (string): A name for easy reference to the HTTP server
- url (string): The URL of the HTTP server
- sharedSecret (string): A shared secret that will be included in POSTs sent to the HTTP server. This secret can be used to verify that the request was sent by Meraki.
"""
kwargs.update(locals())
metadata = {
'tags': ['HTTP servers'],
'operation': 'updateNetworkHttpServer',
}
resource = f'/networks/{networkId}/httpServers/{id}'
body_params = ['name', 'url', 'sharedSecret']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return await self._session.put(metadata, resource, payload)
async def deleteNetworkHttpServer(self, networkId: str, id: str):
"""
**Delete an HTTP server from a network**
https://developer.cisco.com/meraki/api/#!delete-network-http-server
- networkId (string)
- id (string)
"""
metadata = {
'tags': ['HTTP servers'],
'operation': 'deleteNetworkHttpServer',
}
resource = f'/networks/{networkId}/httpServers/{id}'
return await self._session.delete(metadata, resource)