Skip to content

Commit bd1ae71

Browse files
feat: ✨ introduce support for custom search times in get_appliance_flows
1 parent 9599f58 commit bd1ae71

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

pyedgeconnect/orch/_flow.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def get_appliance_flows( # noqa: C901, silences flake8 complexity
3333
edge_ha: bool = False,
3434
built_in: bool = False,
3535
uptime: str = None,
36+
active_uptime_start: int = None,
37+
active_uptime_end: int = None,
38+
term_uptime_start: int = None,
39+
term_uptime_end: int = None,
3640
bytes_transferred: str = "total",
3741
duration: str = None,
3842
anytime_slow_flows: str = None,
@@ -89,7 +93,7 @@ def get_appliance_flows( # noqa: C901, silences flake8 complexity
8993
:param application_group: Filter for application-group flows,
9094
defaults to None
9195
:type application_group: str, optional
92-
:param protocl: Filter by protocol, e.g. ``ip``, ``icmp``, ``bgp``,
96+
:param protocol: Filter by protocol, e.g. ``ip``, ``icmp``, ``bgp``,
9397
etc., defaults to None
9498
:type protocol: str, optional
9599
:param vlan: Filter for VLAN ID, defaults to None
@@ -133,8 +137,27 @@ def get_appliance_flows( # noqa: C901, silences flake8 complexity
133137
:param uptime: Filter for uptime of flow. Term for ended within.
134138
Accepted values include ``anytime``, ``last5m``, ``term5m``,
135139
``term``, ``last1hr``, ``term1hr``, ``last4hr``, ``term4h``,
136-
``last24hr``, ``term24hr``, defaults to None
140+
``last24hr``, ``term24hr``. ``last`` implies started, ``term``
141+
implies ended. Values can be combined with ``%7C``, e.g.,
142+
value of ``anytime%7Cterm24hr`` would implie started anytime or
143+
ended within past 24 hours. Defaults to None
137144
:type uptime: str, optional
145+
:param active_uptime_start: Custom start time filter for active
146+
flows, units in epoch milliseconds, must be used along with
147+
``active_uptime_end``, otherwise ignored. Defaults to None
148+
:type active_uptime_start: int, optional
149+
:param active_uptime_end: Custom end time filter for active
150+
flows, units in epoch milliseconds, must be used along with
151+
``active_uptime_start``, otherwise ignored. Defaults to None
152+
:type active_uptime_end: int, optional
153+
:param term_uptime_start: Custom start time filter for ended
154+
flows, units in epoch milliseconds, must be used along with
155+
``term_uptime_end``, otherwise ignored. Defaults to None
156+
:type term_uptime_start: int, optional
157+
:param term_uptime_end: Custom end time filter for ended
158+
flows, units in epoch milliseconds, must be used along with
159+
``term_uptime_start``, otherwise ignored. Defaults to None
160+
:type term_uptime_end: int, optional
138161
:param bytes_transferred: Bytes transfered, accepted values are
139162
``total`` and ``last5m``, defaults to "total"
140163
:type bytes_transferred: str, optional
@@ -345,6 +368,12 @@ def get_appliance_flows( # noqa: C901, silences flake8 complexity
345368

346369
if uptime is not None:
347370
path = path + "&uptime={}".format(uptime)
371+
if active_uptime_start is not None and active_uptime_end is not None:
372+
path += f"&anyStartTime={active_uptime_start}&anyEndTime={active_uptime_end}"
373+
if term_uptime_start is not None and term_uptime_end is not None:
374+
path += (
375+
f"&termStartTime={term_uptime_start}&termEndTime={term_uptime_end}"
376+
)
348377

349378
path = path + "&bytes={}".format(bytes_transferred)
350379
path = path + "&duration={}".format(duration)

0 commit comments

Comments
 (0)