Skip to content

Commit ba1da16

Browse files
committed
0.60.0
OAS 2602.1.1
1 parent 0a73857 commit ba1da16

17 files changed

Lines changed: 659 additions & 407 deletions

CHANGELOG.md

Lines changed: 97 additions & 151 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "mistapi"
7-
version = "0.59.5"
7+
version = "0.60.0"
88
authors = [{ name = "Thomas Munzer", email = "tmunzer@juniper.net" }]
99
description = "Python package to simplify the Mist System APIs usage"
1010
keywords = ["Mist", "Juniper", "API"]

src/mistapi/__version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.59.5"
1+
__version__ = "0.60.0"
22
__author__ = "Thomas Munzer <tmunzer@juniper.net>"

src/mistapi/api/v1/orgs/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
admins,
1717
alarms,
1818
alarmtemplates,
19+
aos,
1920
apitokens,
2021
aptemplates,
2122
assetfilters,
@@ -98,6 +99,7 @@
9899
"admins",
99100
"alarms",
100101
"alarmtemplates",
102+
"aos",
101103
"apitokens",
102104
"aptemplates",
103105
"assetfilters",

src/mistapi/api/v1/orgs/aos.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 getOrgAosRegisterCmd(mist_session: _APISession, org_id: str) -> _APIResponse:
18+
"""
19+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/devices/aos/get-org-aos-register-cmd
20+
21+
PARAMS
22+
-----------
23+
mistapi.APISession : mist_session
24+
mistapi session including authentication and Mist host information
25+
26+
PATH PARAMS
27+
-----------
28+
org_id : str
29+
30+
RETURN
31+
-----------
32+
mistapi.APIResponse
33+
response from the API call
34+
"""
35+
36+
uri = f"/api/v1/orgs/{org_id}/aos/register_cmd"
37+
query_params: dict[str, str] = {}
38+
resp = mist_session.mist_get(uri=uri, query=query_params)
39+
return resp

src/mistapi/api/v1/orgs/jsi.py

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,237 @@ def searchOrgJsiAssetsAndContracts(
319319
query_params["search_after"] = str(search_after)
320320
resp = mist_session.mist_get(uri=uri, query=query_params)
321321
return resp
322+
323+
324+
def countOrgJsiPbn(
325+
mist_session: _APISession,
326+
org_id: str,
327+
distinct: str,
328+
limit: int | None = None,
329+
start: str | None = None,
330+
end: str | None = None,
331+
) -> _APIResponse:
332+
"""
333+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/jsi/count-org-jsi-pbn
334+
335+
PARAMS
336+
-----------
337+
mistapi.APISession : mist_session
338+
mistapi session including authentication and Mist host information
339+
340+
PATH PARAMS
341+
-----------
342+
org_id : str
343+
344+
QUERY PARAMS
345+
------------
346+
distinct : str{'versions', 'models', 'customer_risk', 'bug_type'}
347+
Field to group by enum: `versions`, `models`, `customer_risk`, `bug_type`
348+
limit : int, default: 100
349+
start : str
350+
end : str
351+
352+
RETURN
353+
-----------
354+
mistapi.APIResponse
355+
response from the API call
356+
"""
357+
358+
uri = f"/api/v1/orgs/{org_id}/jsi/pbn/count"
359+
query_params: dict[str, str] = {}
360+
if distinct:
361+
query_params["distinct"] = str(distinct)
362+
if limit:
363+
query_params["limit"] = str(limit)
364+
if start:
365+
query_params["start"] = str(start)
366+
if end:
367+
query_params["end"] = str(end)
368+
resp = mist_session.mist_get(uri=uri, query=query_params)
369+
return resp
370+
371+
372+
def searchOrgJsiPbn(
373+
mist_session: _APISession,
374+
org_id: str,
375+
versions: str | None = None,
376+
models: str | None = None,
377+
customer_risk: str | None = None,
378+
id: str | None = None,
379+
bug_type: str | None = None,
380+
limit: int | None = None,
381+
page: int | None = None,
382+
search_after: str | None = None,
383+
start: str | None = None,
384+
end: str | None = None,
385+
) -> _APIResponse:
386+
"""
387+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/jsi/search-org-jsi-pbn
388+
389+
PARAMS
390+
-----------
391+
mistapi.APISession : mist_session
392+
mistapi session including authentication and Mist host information
393+
394+
PATH PARAMS
395+
-----------
396+
org_id : str
397+
398+
QUERY PARAMS
399+
------------
400+
versions : str
401+
models : str
402+
customer_risk : str
403+
id : str
404+
bug_type : str
405+
limit : int, default: 100
406+
page : int, default: 1
407+
search_after : str
408+
start : str
409+
end : str
410+
411+
RETURN
412+
-----------
413+
mistapi.APIResponse
414+
response from the API call
415+
"""
416+
417+
uri = f"/api/v1/orgs/{org_id}/jsi/pbn/search"
418+
query_params: dict[str, str] = {}
419+
if versions:
420+
query_params["versions"] = str(versions)
421+
if models:
422+
query_params["models"] = str(models)
423+
if customer_risk:
424+
query_params["customer_risk"] = str(customer_risk)
425+
if id:
426+
query_params["id"] = str(id)
427+
if bug_type:
428+
query_params["bug_type"] = str(bug_type)
429+
if limit:
430+
query_params["limit"] = str(limit)
431+
if page:
432+
query_params["page"] = str(page)
433+
if search_after:
434+
query_params["search_after"] = str(search_after)
435+
if start:
436+
query_params["start"] = str(start)
437+
if end:
438+
query_params["end"] = str(end)
439+
resp = mist_session.mist_get(uri=uri, query=query_params)
440+
return resp
441+
442+
443+
def countOrgJsiSirt(
444+
mist_session: _APISession,
445+
org_id: str,
446+
distinct: str,
447+
limit: int | None = None,
448+
start: str | None = None,
449+
end: str | None = None,
450+
) -> _APIResponse:
451+
"""
452+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/jsi/count-org-jsi-sirt
453+
454+
PARAMS
455+
-----------
456+
mistapi.APISession : mist_session
457+
mistapi session including authentication and Mist host information
458+
459+
PATH PARAMS
460+
-----------
461+
org_id : str
462+
463+
QUERY PARAMS
464+
------------
465+
distinct : str{'versions', 'models', 'severity', 'jsa_updated_date'}
466+
Field to group by. enum: `jsa_updated_date`, `models`, `severity`, `versions`
467+
limit : int, default: 100
468+
start : str
469+
end : str
470+
471+
RETURN
472+
-----------
473+
mistapi.APIResponse
474+
response from the API call
475+
"""
476+
477+
uri = f"/api/v1/orgs/{org_id}/jsi/sirt/count"
478+
query_params: dict[str, str] = {}
479+
if distinct:
480+
query_params["distinct"] = str(distinct)
481+
if limit:
482+
query_params["limit"] = str(limit)
483+
if start:
484+
query_params["start"] = str(start)
485+
if end:
486+
query_params["end"] = str(end)
487+
resp = mist_session.mist_get(uri=uri, query=query_params)
488+
return resp
489+
490+
491+
def searchOrgJsiSirt(
492+
mist_session: _APISession,
493+
org_id: str,
494+
versions: str | None = None,
495+
models: str | None = None,
496+
severity: str | None = None,
497+
id: str | None = None,
498+
limit: int | None = None,
499+
page: int | None = None,
500+
search_after: str | None = None,
501+
start: str | None = None,
502+
end: str | None = None,
503+
) -> _APIResponse:
504+
"""
505+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/jsi/search-org-jsi-sirt
506+
507+
PARAMS
508+
-----------
509+
mistapi.APISession : mist_session
510+
mistapi session including authentication and Mist host information
511+
512+
PATH PARAMS
513+
-----------
514+
org_id : str
515+
516+
QUERY PARAMS
517+
------------
518+
versions : str
519+
models : str
520+
severity : str
521+
id : str
522+
limit : int, default: 100
523+
page : int, default: 1
524+
search_after : str
525+
start : str
526+
end : str
527+
528+
RETURN
529+
-----------
530+
mistapi.APIResponse
531+
response from the API call
532+
"""
533+
534+
uri = f"/api/v1/orgs/{org_id}/jsi/sirt/search"
535+
query_params: dict[str, str] = {}
536+
if versions:
537+
query_params["versions"] = str(versions)
538+
if models:
539+
query_params["models"] = str(models)
540+
if severity:
541+
query_params["severity"] = str(severity)
542+
if id:
543+
query_params["id"] = str(id)
544+
if limit:
545+
query_params["limit"] = str(limit)
546+
if page:
547+
query_params["page"] = str(page)
548+
if search_after:
549+
query_params["search_after"] = str(search_after)
550+
if start:
551+
query_params["start"] = str(start)
552+
if end:
553+
query_params["end"] = str(end)
554+
resp = mist_session.mist_get(uri=uri, query=query_params)
555+
return resp

src/mistapi/api/v1/orgs/mxedges.py

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def getOrgMxEdgeUpgradeInfo(
604604
response from the API call
605605
"""
606606

607-
uri = f"/api/v1/orgs/{org_id}/mxedges/version"
607+
uri = f"/api/v1/orgs/{org_id}/mxedges/versions"
608608
query_params: dict[str, str] = {}
609609
if channel:
610610
query_params["channel"] = str(channel)
@@ -731,12 +731,13 @@ def deleteOrgMxEdgeImage(
731731
return resp
732732

733733

734-
def addOrgMxEdgeImage(
734+
def addOrgMxEdgeImageFile(
735735
mist_session: _APISession,
736736
org_id: str,
737737
mxedge_id: str,
738738
image_number: int,
739-
body: dict | list,
739+
file: str | None = None,
740+
json: str | None = None,
740741
) -> _APIResponse:
741742
"""
742743
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/mxedges/add-org-mx-edge-image
@@ -754,17 +755,22 @@ def addOrgMxEdgeImage(
754755
755756
BODY PARAMS
756757
-----------
757-
body : dict
758-
JSON object to send to Mist Cloud (see API doc above for more details)
758+
file : str
759+
path to the file to upload. Binary file
760+
json : str
759761
760762
RETURN
761763
-----------
762764
mistapi.APIResponse
763765
response from the API call
764766
"""
765767

768+
multipart_form_data = {
769+
"file": file,
770+
"json": json,
771+
}
766772
uri = f"/api/v1/orgs/{org_id}/mxedges/{mxedge_id}/image/{image_number}"
767-
resp = mist_session.mist_post(uri=uri, body=body)
773+
resp = mist_session.mist_post_file(uri=uri, multipart_form_data=multipart_form_data)
768774
return resp
769775

770776

@@ -942,3 +948,31 @@ def unregisterOrgMxEdge(
942948
uri = f"/api/v1/orgs/{org_id}/mxedges/{mxedge_id}/unregister"
943949
resp = mist_session.mist_post(uri=uri)
944950
return resp
951+
952+
953+
def getOrgMxEdgeVmParams(
954+
mist_session: _APISession, org_id: str, mxedge_id: str
955+
) -> _APIResponse:
956+
"""
957+
API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/mxedges/get-org-mx-edge-vm-params
958+
959+
PARAMS
960+
-----------
961+
mistapi.APISession : mist_session
962+
mistapi session including authentication and Mist host information
963+
964+
PATH PARAMS
965+
-----------
966+
org_id : str
967+
mxedge_id : str
968+
969+
RETURN
970+
-----------
971+
mistapi.APIResponse
972+
response from the API call
973+
"""
974+
975+
uri = f"/api/v1/orgs/{org_id}/mxedges/{mxedge_id}/vm_params"
976+
query_params: dict[str, str] = {}
977+
resp = mist_session.mist_get(uri=uri, query=query_params)
978+
return resp

0 commit comments

Comments
 (0)