Skip to content

Commit 7ab64df

Browse files
committed
feat(flow_capture): add functions to manage site flow capture status
1 parent e376697 commit 7ab64df

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"""
2+
--------------------------------------------------------------------------------
3+
------------------------- Mist API Python CLI Session --------------------------
4+
5+
Written by: Thomas Munzer (tmunzer@juniper.net)
6+
Github : https://github.com/tmunzer/mistapi_python
7+
8+
This package is licensed under the MIT License.
9+
10+
--------------------------------------------------------------------------------
11+
"""
12+
13+
from mistapi import APISession as _APISession
14+
from mistapi.__api_response import APIResponse as _APIResponse
15+
16+
17+
def getSiteFlowCaptureStatus(mist_session: _APISession, site_id: str) -> _APIResponse:
18+
"""
19+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/pcaps/get-site-flow-capture-status
20+
21+
PARAMS
22+
-----------
23+
mistapi.APISession : mist_session
24+
mistapi session including authentication and Mist host information
25+
26+
PATH PARAMS
27+
-----------
28+
site_id : str
29+
30+
RETURN
31+
-----------
32+
mistapi.APIResponse
33+
response from the API call
34+
"""
35+
36+
uri = f"/api/v1/sites/{site_id}/flow_capture"
37+
query_params: dict[str, str] = {}
38+
resp = mist_session.mist_get(uri=uri, query=query_params)
39+
return resp
40+
41+
42+
def stopSiteFlowCapture(mist_session: _APISession, site_id: str) -> _APIResponse:
43+
"""
44+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/pcaps/stop-site-flow-capture
45+
46+
PARAMS
47+
-----------
48+
mistapi.APISession : mist_session
49+
mistapi session including authentication and Mist host information
50+
51+
PATH PARAMS
52+
-----------
53+
site_id : str
54+
55+
RETURN
56+
-----------
57+
mistapi.APIResponse
58+
response from the API call
59+
"""
60+
61+
uri = f"/api/v1/sites/{site_id}/flow_capture"
62+
query_params: dict[str, str] = {}
63+
resp = mist_session.mist_delete(uri=uri, query=query_params)
64+
return resp
65+
66+
67+
def startSiteFlowCapture(
68+
mist_session: _APISession, site_id: str, body: dict | list
69+
) -> _APIResponse:
70+
"""
71+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/pcaps/start-site-flow-capture
72+
73+
PARAMS
74+
-----------
75+
mistapi.APISession : mist_session
76+
mistapi session including authentication and Mist host information
77+
78+
PATH PARAMS
79+
-----------
80+
site_id : str
81+
82+
BODY PARAMS
83+
-----------
84+
body : dict
85+
JSON object to send to Mist Cloud (see API doc above for more details)
86+
87+
RETURN
88+
-----------
89+
mistapi.APIResponse
90+
response from the API call
91+
"""
92+
93+
uri = f"/api/v1/sites/{site_id}/flow_capture"
94+
resp = mist_session.mist_post(uri=uri, body=body)
95+
return resp

0 commit comments

Comments
 (0)