├── tests ├── __init__.py ├── unit │ ├── __init__.py │ ├── test_cli.py │ ├── test_models.py │ ├── test_api_request.py │ ├── test_api_response.py │ └── test_pagination.py ├── fixtures │ ├── __init__.py │ └── mock_responses.py └── integration │ ├── __init__.py │ ├── test_api_endpoints.py │ └── test_authentication_flow.py ├── src ├── mistapi │ ├── __models │ │ ├── __init__.py │ │ └── privilege.py │ ├── __version.py │ ├── api │ │ ├── __init__.py │ │ └── v1 │ │ │ ├── invite │ │ │ ├── __init__.py │ │ │ └── verify.py │ │ │ ├── logout │ │ │ ├── __init__.py │ │ │ └── logout.py │ │ │ ├── mobile │ │ │ ├── __init__.py │ │ │ └── verify.py │ │ │ ├── installer │ │ │ ├── __init__.py │ │ │ ├── sites │ │ │ │ ├── __init__.py │ │ │ │ └── optimize.py │ │ │ └── orgs │ │ │ │ ├── __init__.py │ │ │ │ ├── sitegroups.py │ │ │ │ ├── alarmtemplates.py │ │ │ │ ├── rftemplates.py │ │ │ │ └── deviceprofiles.py │ │ │ ├── recover │ │ │ ├── __init__.py │ │ │ ├── verify.py │ │ │ └── recover.py │ │ │ ├── register │ │ │ ├── __init__.py │ │ │ ├── verify.py │ │ │ ├── register.py │ │ │ └── recaptcha.py │ │ │ ├── login │ │ │ ├── __init__.py │ │ │ ├── login.py │ │ │ ├── lookup.py │ │ │ └── two_factor.py │ │ │ ├── utils │ │ │ ├── __init__.py │ │ │ ├── test_smsglobal.py │ │ │ ├── test_telstra.py │ │ │ └── test_twilio.py │ │ │ ├── self │ │ │ ├── __init__.py │ │ │ ├── usage.py │ │ │ ├── login_failures.py │ │ │ ├── subscriptions.py │ │ │ ├── logs.py │ │ │ ├── update.py │ │ │ ├── two_factor.py │ │ │ ├── oauth.py │ │ │ └── self.py │ │ │ ├── __init__.py │ │ │ ├── msps │ │ │ ├── __init__.py │ │ │ ├── inventory.py │ │ │ ├── claim.py │ │ │ ├── suggestion.py │ │ │ ├── insights.py │ │ │ ├── logo.py │ │ │ ├── search.py │ │ │ ├── licenses.py │ │ │ ├── stats.py │ │ │ ├── tickets.py │ │ │ └── invites.py │ │ │ ├── const │ │ │ ├── alarm_defs.py │ │ │ ├── applications.py │ │ │ ├── device_models.py │ │ │ ├── languages.py │ │ │ ├── mxedge_models.py │ │ │ ├── license_types.py │ │ │ ├── traffic_types.py │ │ │ ├── ap_led_status.py │ │ │ ├── nac_events.py │ │ │ ├── webhook_topics.py │ │ │ ├── ap_esl_versions.py │ │ │ ├── insight_metrics.py │ │ │ ├── fingerprint_types.py │ │ │ ├── client_events.py │ │ │ ├── device_events.py │ │ │ ├── mxedge_events.py │ │ │ ├── system_events.py │ │ │ ├── app_categories.py │ │ │ ├── gateway_applications.py │ │ │ ├── app_subcategories.py │ │ │ ├── marvisclient_versions.py │ │ │ ├── otherdevice_models.py │ │ │ ├── otherdevice_events.py │ │ │ ├── states.py │ │ │ ├── countries.py │ │ │ ├── ap_channels.py │ │ │ ├── default_gateway_config.py │ │ │ └── __init__.py │ │ │ ├── sites │ │ │ ├── apps.py │ │ │ ├── licenses.py │ │ │ ├── mxtunnels.py │ │ │ ├── vpns.py │ │ │ ├── networks.py │ │ │ ├── aptemplates.py │ │ │ ├── rftemplates.py │ │ │ ├── sitetemplates.py │ │ │ ├── deviceprofiles.py │ │ │ ├── servicepolicies.py │ │ │ ├── gatewaytemplates.py │ │ │ ├── networktemplates.py │ │ │ ├── secintelprofiles.py │ │ │ ├── idpprofiles.py │ │ │ ├── avprofiles.py │ │ │ ├── aamwprofiles.py │ │ │ ├── subscriptions.py │ │ │ ├── wan_client.py │ │ │ ├── analyze_spectrum.py │ │ │ ├── ssr.py │ │ │ ├── count.py │ │ │ ├── sites.py │ │ │ ├── visits.py │ │ │ ├── __init__.py │ │ │ └── anomaly.py │ │ │ └── orgs │ │ │ ├── ssl_proxy_cert.py │ │ │ ├── clone.py │ │ │ ├── mist_nac.py │ │ │ ├── sdkclients.py │ │ │ ├── ocdevices.py │ │ │ ├── pma.py │ │ │ ├── maps.py │ │ │ ├── subscriptions.py │ │ │ ├── troubleshoot.py │ │ │ ├── vars.py │ │ │ ├── crl.py │ │ │ ├── wan_client.py │ │ │ ├── claim.py │ │ │ ├── cert.py │ │ │ ├── licenses.py │ │ │ ├── admins.py │ │ │ └── invites.py │ ├── __init__.py │ ├── __pagination.py │ └── __logger.py └── .DS_Store ├── .DS_Store ├── .gitattributes ├── .gitmodules ├── .idea ├── .gitignore ├── vcs.xml ├── modules.xml └── python_package.iml ├── generate.sh ├── .github └── workflows │ └── test.yml ├── LICENSE ├── .pre-commit-config.yaml └── .vscode └── settings.json /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/test_cli.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/fixtures/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/test_models.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/mistapi/__models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/fixtures/mock_responses.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/test_api_request.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/test_api_response.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/test_pagination.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/test_api_endpoints.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/test_authentication_flow.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmunzer/mistapi_python/HEAD/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmunzer/mistapi_python/HEAD/src/.DS_Store -------------------------------------------------------------------------------- /src/mistapi/__version.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.58.0" 2 | __author__ = "Thomas Munzer " 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "mist_openapi"] 2 | path = mist_openapi 3 | url = https://github.com/Mist-Automation-Programmability/mist_openapi.git 4 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/python_package.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/mistapi/api/__init__.py: -------------------------------------------------------------------------------- 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.api import v1 14 | 15 | __all__ = ["v1"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/invite/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.invite import verify 14 | 15 | __all__ = ["verify"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/logout/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.logout import logout 14 | 15 | __all__ = ["logout"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/mobile/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.mobile import verify 14 | 15 | __all__ = ["verify"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.installer import orgs, sites 14 | 15 | __all__ = ["orgs", "sites"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/sites/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.installer.sites import optimize 14 | 15 | __all__ = ["optimize"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/recover/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.recover import recover, verify 14 | 15 | __all__ = ["recover", "verify"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/register/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.register import register, recaptcha, verify 14 | 15 | __all__ = ["register", "recaptcha", "verify"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/login/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.login import login, lookup, oauth, two_factor 14 | 15 | __all__ = ["login", "lookup", "oauth", "two_factor"] 16 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/utils/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.utils import test_smsglobal, test_telstra, test_twilio 14 | 15 | __all__ = ["test_smsglobal", "test_telstra", "test_twilio"] 16 | -------------------------------------------------------------------------------- /src/mistapi/__init__.py: -------------------------------------------------------------------------------- 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.__api_session import APISession as APISession 14 | from mistapi import api as api 15 | from mistapi import cli as cli 16 | from mistapi.__pagination import get_all as get_all 17 | from mistapi.__pagination import get_next as get_next 18 | from mistapi.__version import __author__ as __author__ 19 | from mistapi.__version import __version__ as __version__ 20 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/orgs/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.installer.orgs import ( 14 | alarmtemplates, 15 | deviceprofiles, 16 | devices, 17 | rftemplates, 18 | sitegroups, 19 | sites, 20 | ) 21 | 22 | __all__ = [ 23 | "alarmtemplates", 24 | "deviceprofiles", 25 | "devices", 26 | "rftemplates", 27 | "sitegroups", 28 | "sites", 29 | ] 30 | -------------------------------------------------------------------------------- /generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | if [ ! $1 ] 4 | then 5 | echo "Missing version" 6 | exit 0 7 | fi 8 | 9 | echo "Updating OPENAPI local repo" 10 | cd mist_openapi 11 | git pull 12 | cd .. 13 | 14 | echo "Updating version in pyproject.toml to $1" 15 | sed -e "s/version = .*/version = \"$1\"/g" pyproject.toml > new_pyproject.toml 16 | mv new_pyproject.toml pyproject.toml 17 | 18 | echo "Updating version in __version.py to $1" 19 | sed -e "s/__version__ = .*/__version__ = \"$1\"/g" ./src/mistapi/__version.py > ./src/mistapi/new__version.py 20 | mv ./src/mistapi/new__version.py ./src/mistapi/__version.py 21 | 22 | echo "Updating version in __init__.py to $1" 23 | sed -e "s/__version__ = .*/__version__ = \"$1\"/g" ./src/mistapi/__init__.py > ./src/mistapi/__init__.py.new 24 | mv ./src/mistapi/__init__.py.new ./src/mistapi/__init__.py 25 | 26 | python3 ./generate_from_openapi.py $1 27 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.self import ( 14 | self, 15 | apitokens, 16 | login_failures, 17 | logs, 18 | oauth, 19 | subscriptions, 20 | two_factor, 21 | update, 22 | usage, 23 | ) 24 | 25 | __all__ = [ 26 | "self", 27 | "apitokens", 28 | "login_failures", 29 | "logs", 30 | "oauth", 31 | "subscriptions", 32 | "two_factor", 33 | "update", 34 | "usage", 35 | ] 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/__init__.py: -------------------------------------------------------------------------------- 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.api.v1 import ( 14 | const, 15 | installer, 16 | invite, 17 | login, 18 | logout, 19 | mobile, 20 | msps, 21 | orgs, 22 | recover, 23 | register, 24 | self, 25 | sites, 26 | utils, 27 | ) 28 | 29 | __all__ = [ 30 | "const", 31 | "installer", 32 | "invite", 33 | "login", 34 | "logout", 35 | "mobile", 36 | "msps", 37 | "orgs", 38 | "recover", 39 | "register", 40 | "self", 41 | "sites", 42 | "utils", 43 | ] 44 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: [ main, master ] 6 | pull_request: 7 | branches: [ main, master ] 8 | 9 | permissions: 10 | contents: read 11 | pull-requests: write 12 | 13 | jobs: 14 | test: 15 | runs-on: ubuntu-latest 16 | strategy: 17 | matrix: 18 | python-version: ["3.10", "3.11", "3.12", "3.13"] 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Install uv 24 | uses: astral-sh/setup-uv@v3 25 | with: 26 | version: "latest" 27 | 28 | - name: Set up Python ${{ matrix.python-version }} 29 | run: uv python install ${{ matrix.python-version }} 30 | 31 | - name: Install dependencies 32 | run: uv sync 33 | 34 | - name: Run tests 35 | run: uv run pytest --cov=src/mistapi --cov-report=xml 36 | 37 | - name: Upload coverage to Codecov (optional) 38 | uses: codecov/codecov-action@v3 39 | with: 40 | file: ./coverage.xml 41 | if: matrix.python-version == '3.11' # Only upload once 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Thomas Munzer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.msps import ( 14 | msps, 15 | admins, 16 | claim, 17 | insights, 18 | inventory, 19 | invites, 20 | licenses, 21 | logo, 22 | logs, 23 | orggroups, 24 | orgs, 25 | search, 26 | ssoroles, 27 | ssos, 28 | stats, 29 | suggestion, 30 | tickets, 31 | ) 32 | 33 | __all__ = [ 34 | "msps", 35 | "admins", 36 | "claim", 37 | "insights", 38 | "inventory", 39 | "invites", 40 | "licenses", 41 | "logo", 42 | "logs", 43 | "orggroups", 44 | "orgs", 45 | "search", 46 | "ssoroles", 47 | "ssos", 48 | "stats", 49 | "suggestion", 50 | "tickets", 51 | ] 52 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/logout/logout.py: -------------------------------------------------------------------------------- 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 logout(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/logout/logout 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/logout" 33 | resp = mist_session.mist_post(uri=uri) 34 | return resp 35 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/usage.py: -------------------------------------------------------------------------------- 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 getSelfApiUsage(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/get-self-api-usage 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/self/usage" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/alarm_defs.py: -------------------------------------------------------------------------------- 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 listAlarmDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-alarm-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/alarm_defs" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/applications.py: -------------------------------------------------------------------------------- 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 listApplications(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-applications 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/applications" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/device_models.py: -------------------------------------------------------------------------------- 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 listDeviceModels(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/models/list-device-models 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/device_models" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/languages.py: -------------------------------------------------------------------------------- 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 listSiteLanguages(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-site-languages 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/languages" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/mxedge_models.py: -------------------------------------------------------------------------------- 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 listMxEdgeModels(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/models/list-mx-edge-models 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/mxedge_models" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/license_types.py: -------------------------------------------------------------------------------- 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 listLicenseTypes(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-license-types 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/license_types" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/traffic_types.py: -------------------------------------------------------------------------------- 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 listTrafficTypes(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-traffic-types 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/traffic_types" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/login_failures.py: -------------------------------------------------------------------------------- 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 getSelfLoginFailures(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/get-self-login-failures 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/self/login_failures" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/subscriptions.py: -------------------------------------------------------------------------------- 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 listAlarmSubscriptions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/alarms/list-alarm-subscriptions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/self/subscriptions" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/ap_led_status.py: -------------------------------------------------------------------------------- 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 listApLedDefinition(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-ap-led-definition 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/ap_led_status" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/nac_events.py: -------------------------------------------------------------------------------- 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 listNacEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-nac-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/nac_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/webhook_topics.py: -------------------------------------------------------------------------------- 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 listWebhookTopics(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-webhook-topics 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/webhook_topics" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/invite/verify.py: -------------------------------------------------------------------------------- 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 verifyAdminInvite(mist_session: _APISession, token: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/verify-admin-invite 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | token : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/invite/verify/{token}" 37 | resp = mist_session.mist_post(uri=uri) 38 | return resp 39 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/ap_esl_versions.py: -------------------------------------------------------------------------------- 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 listApLEslVersions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-ap-l-esl-versions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/ap_esl_versions" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/insight_metrics.py: -------------------------------------------------------------------------------- 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 listInsightMetrics(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-insight-metrics 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/insight_metrics" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/register/verify.py: -------------------------------------------------------------------------------- 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 verifyRegistration(mist_session: _APISession, token: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/verify-registration 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | token : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/register/verify/{token}" 37 | resp = mist_session.mist_post(uri=uri) 38 | return resp 39 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/fingerprint_types.py: -------------------------------------------------------------------------------- 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 listFingerprintTypes(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-fingerprint-types 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/fingerprint_types" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/client_events.py: -------------------------------------------------------------------------------- 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 listClientEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-client-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/client_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/device_events.py: -------------------------------------------------------------------------------- 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 listDeviceEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-device-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/device_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/mxedge_events.py: -------------------------------------------------------------------------------- 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 listMxEdgeEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-mx-edge-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/mxedge_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/system_events.py: -------------------------------------------------------------------------------- 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 listSystemEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-system-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/system_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/app_categories.py: -------------------------------------------------------------------------------- 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 listAppCategoryDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-app-category-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/app_categories" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/gateway_applications.py: -------------------------------------------------------------------------------- 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 listGatewayApplications(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-gateway-applications 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/gateway_applications" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/recover/verify.py: -------------------------------------------------------------------------------- 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 verifyRecoverPassword(mist_session: _APISession, token: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/recover-password/verify-recover-password 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | token : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/recover/verify/{token}" 37 | resp = mist_session.mist_post(uri=uri) 38 | return resp 39 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/app_subcategories.py: -------------------------------------------------------------------------------- 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 listAppSubCategoryDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-app-sub-category-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/app_subcategories" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/marvisclient_versions.py: -------------------------------------------------------------------------------- 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 listMarvisClientVersions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-marvis-client-versions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/marvisclient_versions" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/otherdevice_models.py: -------------------------------------------------------------------------------- 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 listSupportedOtherDeviceModels(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/models/list-supported-other-device-models 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/otherdevice_models" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/otherdevice_events.py: -------------------------------------------------------------------------------- 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 listOtherDeviceEventsDefinitions(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/events/list-other-device-events-definitions 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/const/otherdevice_events" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/login/login.py: -------------------------------------------------------------------------------- 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 login(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/login/login 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/login" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/apps.py: -------------------------------------------------------------------------------- 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 listSiteApps(mist_session: _APISession, site_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/applications/list-site-apps 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}/apps" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/login/lookup.py: -------------------------------------------------------------------------------- 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 lookup(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/lookup/lookup 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/login/lookup" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/ssl_proxy_cert.py: -------------------------------------------------------------------------------- 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 getOrgSslProxyCert(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/cert/get-org-ssl-proxy-cert 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}/ssl_proxy_cert" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/login/two_factor.py: -------------------------------------------------------------------------------- 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 twoFactor(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/login/two-factor 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/login/two_factor" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/register/register.py: -------------------------------------------------------------------------------- 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 registerNewAdmin(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/register-new-admin 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/register" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/licenses.py: -------------------------------------------------------------------------------- 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 getSiteLicenseUsage(mist_session: _APISession, site_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/licenses/get-site-license-usage 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}/licenses/usages" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/recover/recover.py: -------------------------------------------------------------------------------- 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 recoverPassword(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/recover-password/recover-password 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/recover" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/orgs/sitegroups.py: -------------------------------------------------------------------------------- 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 listInstallerSiteGroups(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/installer/list-installer-site-groups 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/installer/orgs/{org_id}/sitegroups" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/sites/optimize.py: -------------------------------------------------------------------------------- 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 optimizeInstallerRrm(mist_session: _APISession, site_name: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/installer/optimize-installer-rrm 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_name : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/installer/sites/{site_name}/optimize" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/mxtunnels.py: -------------------------------------------------------------------------------- 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 preemptSitesMxTunnel( 18 | mist_session: _APISession, site_id: str, mxtunnel_id: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/mxedge/preempt-sites-mx-tunnel 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | mxtunnel_id : str 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = f"/api/v1/sites/{site_id}/mxtunnels/{mxtunnel_id}/preempt_aps" 40 | resp = mist_session.mist_post(uri=uri) 41 | return resp 42 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/orgs/alarmtemplates.py: -------------------------------------------------------------------------------- 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 listInstallerAlarmTemplates(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/installer/list-installer-alarm-templates 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/installer/orgs/{org_id}/alarmtemplates" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/utils/test_smsglobal.py: -------------------------------------------------------------------------------- 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 testSiteWlanSmsGlobal(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/wi-fi/test-site-wlan-sms-global 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/utils/test_smsglobal" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/orgs/rftemplates.py: -------------------------------------------------------------------------------- 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 listInstallerRfTemplatesNames( 18 | mist_session: _APISession, org_id: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/installer/list-installer-rf-templates-names 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | RETURN 33 | ----------- 34 | mistapi.APIResponse 35 | response from the API call 36 | """ 37 | 38 | uri = f"/api/v1/installer/orgs/{org_id}/rftemplates" 39 | query_params: dict[str, str] = {} 40 | resp = mist_session.mist_get(uri=uri, query=query_params) 41 | return resp 42 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/utils/test_telstra.py: -------------------------------------------------------------------------------- 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 testSiteWlanTelstraSetup( 18 | mist_session: _APISession, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/wi-fi/test-site-wlan-telstra-setup 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | BODY PARAMS 29 | ----------- 30 | body : dict 31 | JSON object to send to Mist Cloud (see API doc above for more details) 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = "/api/v1/utils/test_telstra" 40 | resp = mist_session.mist_post(uri=uri, body=body) 41 | return resp 42 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/utils/test_twilio.py: -------------------------------------------------------------------------------- 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 testSiteWlanTwilioSetup( 18 | mist_session: _APISession, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/wi-fi/test-site-wlan-twilio-setup 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | BODY PARAMS 29 | ----------- 30 | body : dict 31 | JSON object to send to Mist Cloud (see API doc above for more details) 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = "/api/v1/utils/test_twilio" 40 | resp = mist_session.mist_post(uri=uri, body=body) 41 | return resp 42 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/states.py: -------------------------------------------------------------------------------- 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 listStates(mist_session: _APISession, country_code: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-states 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | QUERY PARAMS 27 | ------------ 28 | country_code : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = "/api/v1/const/states" 37 | query_params: dict[str, str] = {} 38 | if country_code: 39 | query_params["country_code"] = str(country_code) 40 | resp = mist_session.mist_get(uri=uri, query=query_params) 41 | return resp 42 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/inventory.py: -------------------------------------------------------------------------------- 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 getMspInventoryByMac( 18 | mist_session: _APISession, msp_id: str, device_mac: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/inventory/get-msp-inventory-by-mac 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | msp_id : str 31 | device_mac : str 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = f"/api/v1/msps/{msp_id}/inventory/{device_mac}" 40 | query_params: dict[str, str] = {} 41 | resp = mist_session.mist_get(uri=uri, query=query_params) 42 | return resp 43 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/clone.py: -------------------------------------------------------------------------------- 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 cloneOrg(mist_session: _APISession, org_id: str, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/clone-org 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 | BODY PARAMS 31 | ----------- 32 | body : dict 33 | JSON object to send to Mist Cloud (see API doc above for more details) 34 | 35 | RETURN 36 | ----------- 37 | mistapi.APIResponse 38 | response from the API call 39 | """ 40 | 41 | uri = f"/api/v1/orgs/{org_id}/clone" 42 | resp = mist_session.mist_post(uri=uri, body=body) 43 | return resp 44 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/countries.py: -------------------------------------------------------------------------------- 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 listCountryCodes( 18 | mist_session: _APISession, extend: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-country-codes 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | QUERY PARAMS 29 | ------------ 30 | extend : bool 31 | 32 | RETURN 33 | ----------- 34 | mistapi.APIResponse 35 | response from the API call 36 | """ 37 | 38 | uri = "/api/v1/const/countries" 39 | query_params: dict[str, str] = {} 40 | if extend: 41 | query_params["extend"] = str(extend) 42 | resp = mist_session.mist_get(uri=uri, query=query_params) 43 | return resp 44 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/claim.py: -------------------------------------------------------------------------------- 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 claimMspLicense( 18 | mist_session: _APISession, msp_id: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/licenses/claim-msp-license 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | msp_id : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/msps/{msp_id}/claim" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/ap_channels.py: -------------------------------------------------------------------------------- 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 listApChannels( 18 | mist_session: _APISession, country_code: str | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/definitions/list-ap-channels 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | QUERY PARAMS 29 | ------------ 30 | country_code : str 31 | 32 | RETURN 33 | ----------- 34 | mistapi.APIResponse 35 | response from the API call 36 | """ 37 | 38 | uri = "/api/v1/const/ap_channels" 39 | query_params: dict[str, str] = {} 40 | if country_code: 41 | query_params["country_code"] = str(country_code) 42 | resp = mist_session.mist_get(uri=uri, query=query_params) 43 | return resp 44 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/mobile/verify.py: -------------------------------------------------------------------------------- 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 activateSdkInvite( 18 | mist_session: _APISession, secret: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/sdk-invites/activate-sdk-invite 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | secret : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/mobile/verify/{secret}" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/mist_nac.py: -------------------------------------------------------------------------------- 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 validateOrgIdpCredential( 18 | mist_session: _APISession, org_id: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/nac-idp/validate-org-idp-credential 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/orgs/{org_id}/mist_nac/test_idp" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/astral-sh/ruff-pre-commit 3 | rev: v0.11.10 4 | hooks: 5 | - id: ruff 6 | args: [--fix] 7 | - id: ruff-format 8 | 9 | - repo: https://github.com/JelleZijlstra/autotyping 10 | rev: 24.9.0 11 | hooks: 12 | - id: autotyping 13 | types: [python] 14 | args: [--safe] # or alternatively, --aggressive, or any of the other flags mentioned above 15 | 16 | - repo: https://github.com/pre-commit/pre-commit-hooks 17 | rev: v5.0.0 18 | hooks: 19 | - id: trailing-whitespace 20 | - id: end-of-file-fixer 21 | - id: check-yaml 22 | - id: check-toml 23 | - id: check-json 24 | exclude: ".vscode/" 25 | - id: check-added-large-files 26 | - id: detect-private-key 27 | - id: check-ast 28 | - id: check-case-conflict 29 | 30 | - repo: https://github.com/gitleaks/gitleaks 31 | rev: v8.26.0 32 | hooks: 33 | - id: gitleaks 34 | 35 | - repo: https://github.com/pre-commit/mirrors-mypy 36 | rev: v1.15.0 37 | hooks: 38 | - id: mypy 39 | additional_dependencies: 40 | [types-requests, pydantic, types-pyyaml, types-tabulate] 41 | 42 | - repo: https://github.com/PyCQA/bandit 43 | rev: 1.8.3 44 | hooks: 45 | - id: bandit 46 | args: ["-c", "pyproject.toml"] 47 | additional_dependencies: ["bandit[toml]"] 48 | 49 | - repo: https://github.com/ubersan/pylic 50 | rev: v5.0.1 51 | hooks: 52 | - id: pylic 53 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/sdkclients.py: -------------------------------------------------------------------------------- 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 updateSdkClient( 18 | mist_session: _APISession, org_id: str, sdkclient_id: str, body: dict 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/clients/sdk/update-sdk-client 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | sdkclient_id : str 32 | 33 | BODY PARAMS 34 | ----------- 35 | body : dict 36 | JSON object to send to Mist Cloud (see API doc above for more details) 37 | 38 | RETURN 39 | ----------- 40 | mistapi.APIResponse 41 | response from the API call 42 | """ 43 | 44 | uri = f"/api/v1/orgs/{org_id}/sdkclients/{sdkclient_id}" 45 | resp = mist_session.mist_put(uri=uri, body=body) 46 | return resp 47 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/register/recaptcha.py: -------------------------------------------------------------------------------- 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 getAdminRegistrationInfo( 18 | mist_session: _APISession, recaptcha_flavor: str = "google" 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/admins/get-admin-registration-info 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | QUERY PARAMS 29 | ------------ 30 | recaptcha_flavor : str{'google', 'hcaptcha'}, default: google 31 | 32 | RETURN 33 | ----------- 34 | mistapi.APIResponse 35 | response from the API call 36 | """ 37 | 38 | uri = "/api/v1/register/recaptcha" 39 | query_params: dict[str, str] = {} 40 | if recaptcha_flavor: 41 | query_params["recaptcha_flavor"] = str(recaptcha_flavor) 42 | resp = mist_session.mist_get(uri=uri, query=query_params) 43 | return resp 44 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/vpns.py: -------------------------------------------------------------------------------- 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 listSiteVpnsDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/vpns/list-site-vpns-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/vpns/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/default_gateway_config.py: -------------------------------------------------------------------------------- 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 getGatewayDefaultConfig( 18 | mist_session: _APISession, model: str, ha: str | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/constants/models/get-gateway-default-config 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | QUERY PARAMS 29 | ------------ 30 | model : str 31 | ha : str 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = "/api/v1/const/default_gateway_config" 40 | query_params: dict[str, str] = {} 41 | if model: 42 | query_params["model"] = str(model) 43 | if ha: 44 | query_params["ha"] = str(ha) 45 | resp = mist_session.mist_get(uri=uri, query=query_params) 46 | return resp 47 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/networks.py: -------------------------------------------------------------------------------- 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 listSiteNetworksDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/networks/list-site-networks-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/networks/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/ocdevices.py: -------------------------------------------------------------------------------- 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 getOrgJuniperDevicesCommand( 18 | mist_session: _APISession, org_id: str, site_id: str | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/devices/get-org-juniper-devices-command 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | site_id : str 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/orgs/{org_id}/ocdevices/outbound_ssh_cmd" 43 | query_params: dict[str, str] = {} 44 | if site_id: 45 | query_params["site_id"] = str(site_id) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/aptemplates.py: -------------------------------------------------------------------------------- 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 listSiteApTemplatesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/ap-templates/list-site-ap-templates-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/aptemplates/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/rftemplates.py: -------------------------------------------------------------------------------- 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 listSiteRfTemplatesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/rf-templates/list-site-rf-templates-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/rftemplates/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/sitetemplates.py: -------------------------------------------------------------------------------- 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 listSiteSiteTemplatesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/site-templates/list-site-site-templates-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/sitetemplates/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/deviceprofiles.py: -------------------------------------------------------------------------------- 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 listSiteDeviceProfilesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/device-profiles/list-site-device-profiles-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/deviceprofiles/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/installer/orgs/deviceprofiles.py: -------------------------------------------------------------------------------- 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 listInstallerDeviceProfiles( 18 | mist_session: _APISession, org_id: str, type: str = "ap" 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/installer/list-installer-device-profiles 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | type : str{'ap', 'gateway', 'switch'}, default: ap 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/installer/orgs/{org_id}/deviceprofiles" 43 | query_params: dict[str, str] = {} 44 | if type: 45 | query_params["type"] = str(type) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/servicepolicies.py: -------------------------------------------------------------------------------- 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 listSiteServicePoliciesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/service-policies/list-site-service-policies-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/servicepolicies/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/gatewaytemplates.py: -------------------------------------------------------------------------------- 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 listSiteGatewayTemplatesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/gateway-templates/list-site-gateway-templates-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/gatewaytemplates/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/networktemplates.py: -------------------------------------------------------------------------------- 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 listSiteNetworkTemplatesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/network-templates/list-site-network-templates-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/networktemplates/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/secintelprofiles.py: -------------------------------------------------------------------------------- 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 listSiteSecIntelProfilesDerived( 18 | mist_session: _APISession, site_id: str, resolve: bool | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/secintel-profiles/list-site-sec-intel-profiles-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | resolve : bool 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/sites/{site_id}/secintelprofiles/derived" 43 | query_params: dict[str, str] = {} 44 | if resolve: 45 | query_params["resolve"] = str(resolve) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/pma.py: -------------------------------------------------------------------------------- 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 listOrgPmaDashboards( 18 | mist_session: _APISession, org_id: str, limit: int = 100, page: int = 1 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/premium-analytics/list-org-pma-dashboards 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | limit : int, default: 100 35 | page : int, default: 1 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/orgs/{org_id}/pma/dashboards" 44 | query_params: dict[str, str] = {} 45 | if limit: 46 | query_params["limit"] = str(limit) 47 | if page: 48 | query_params["page"] = str(page) 49 | resp = mist_session.mist_get(uri=uri, query=query_params) 50 | return resp 51 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/idpprofiles.py: -------------------------------------------------------------------------------- 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 listSiteIdpProfilesDerived( 18 | mist_session: _APISession, site_id: str, limit: int = 100, page: int = 1 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/idp-profiles/list-site-idp-profiles-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | limit : int, default: 100 35 | page : int, default: 1 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/sites/{site_id}/idpprofiles/derived" 44 | query_params: dict[str, str] = {} 45 | if limit: 46 | query_params["limit"] = str(limit) 47 | if page: 48 | query_params["page"] = str(page) 49 | resp = mist_session.mist_get(uri=uri, query=query_params) 50 | return resp 51 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/avprofiles.py: -------------------------------------------------------------------------------- 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 listSiteAntivirusProfilesDerived( 18 | mist_session: _APISession, site_id: str, limit: int = 100, page: int = 1 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/antivirus-profiles/list-site-antivirus-profiles-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | limit : int, default: 100 35 | page : int, default: 1 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/sites/{site_id}/avprofiles/derived" 44 | query_params: dict[str, str] = {} 45 | if limit: 46 | query_params["limit"] = str(limit) 47 | if page: 48 | query_params["page"] = str(page) 49 | resp = mist_session.mist_get(uri=uri, query=query_params) 50 | return resp 51 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/aamwprofiles.py: -------------------------------------------------------------------------------- 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 listSiteAAMWProfilesDerived( 18 | mist_session: _APISession, site_id: str, limit: int = 100, page: int = 1 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/advanced-anti-malware-profiles/list-site-a-a-m-w-profiles-derived 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | limit : int, default: 100 35 | page : int, default: 1 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/sites/{site_id}/aamwprofiles/derived" 44 | query_params: dict[str, str] = {} 45 | if limit: 46 | query_params["limit"] = str(limit) 47 | if page: 48 | query_params["page"] = str(page) 49 | resp = mist_session.mist_get(uri=uri, query=query_params) 50 | return resp 51 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/suggestion.py: -------------------------------------------------------------------------------- 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 countMspsMarvisActions( 18 | mist_session: _APISession, msp_id: str, distinct: str = "org_id", limit: int = 100 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/marvis/count-msps-marvis-actions 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | msp_id : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | distinct : str{'org_id', 'status'}, default: org_id 35 | limit : int, default: 100 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/msps/{msp_id}/suggestion/count" 44 | query_params: dict[str, str] = {} 45 | if distinct: 46 | query_params["distinct"] = str(distinct) 47 | if limit: 48 | query_params["limit"] = str(limit) 49 | resp = mist_session.mist_get(uri=uri, query=query_params) 50 | return resp 51 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "apimatic.notifications.whenApiFileIsDetected.enabled": false, 3 | "pylint.args": [ 4 | "--disable=logging-fstring-interpolation", 5 | "--disable=logging-format-interpolation", 6 | ], 7 | "cSpell.words": [ 8 | "apirequest", 9 | "apiresponse", 10 | "keepit", 11 | "notif", 12 | "werein" 13 | ], 14 | "editor.formatOnSave": true, 15 | "editor.codeActionsOnSave": { 16 | "source.fixAll.ruff": "explicit", 17 | "source.organizeImports.ruff": "explicit" 18 | }, 19 | "[python]": { 20 | "editor.defaultFormatter": "charliermarsh.ruff", 21 | "editor.formatOnSave": true, 22 | "editor.codeActionsOnSave": { 23 | "source.fixAll.ruff": "explicit", 24 | "source.organizeImports.ruff": "explicit" 25 | }, 26 | "editor.rulers": [ 27 | 120 28 | ], 29 | "editor.tabSize": 4 30 | }, 31 | "ruff.enable": true, 32 | "ruff.organizeImports": true, 33 | "ruff.fixAll": true, 34 | "files.exclude": { 35 | "**/__pycache__": true, 36 | "**/.pytest_cache": true, 37 | "**/.mypy_cache": true, 38 | "**/.ruff_cache": true 39 | }, 40 | "files.watcherExclude": { 41 | "**/.git/objects/**": true, 42 | "**/.git/subtree-cache/**": true, 43 | "**/node_modules/**": true, 44 | "**/.hg/store/**": true, 45 | "**/.venv/**": true, 46 | "**/.mypy_cache/**": true, 47 | "**/.ruff_cache/**": true 48 | }, 49 | "python.testing.pytestArgs": [ 50 | "tests" 51 | ], 52 | "python.testing.unittestEnabled": false, 53 | "python.testing.pytestEnabled": true 54 | } -------------------------------------------------------------------------------- /src/mistapi/api/v1/const/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.const import ( 14 | alarm_defs, 15 | ap_channels, 16 | ap_esl_versions, 17 | ap_led_status, 18 | app_categories, 19 | app_subcategories, 20 | applications, 21 | client_events, 22 | countries, 23 | default_gateway_config, 24 | device_events, 25 | device_models, 26 | fingerprint_types, 27 | gateway_applications, 28 | insight_metrics, 29 | languages, 30 | license_types, 31 | marvisclient_versions, 32 | mxedge_events, 33 | mxedge_models, 34 | nac_events, 35 | otherdevice_events, 36 | otherdevice_models, 37 | states, 38 | system_events, 39 | traffic_types, 40 | webhook_topics, 41 | ) 42 | 43 | __all__ = [ 44 | "alarm_defs", 45 | "ap_channels", 46 | "ap_esl_versions", 47 | "ap_led_status", 48 | "app_categories", 49 | "app_subcategories", 50 | "applications", 51 | "client_events", 52 | "countries", 53 | "default_gateway_config", 54 | "device_events", 55 | "device_models", 56 | "fingerprint_types", 57 | "gateway_applications", 58 | "insight_metrics", 59 | "languages", 60 | "license_types", 61 | "marvisclient_versions", 62 | "mxedge_events", 63 | "mxedge_models", 64 | "nac_events", 65 | "otherdevice_events", 66 | "otherdevice_models", 67 | "states", 68 | "system_events", 69 | "traffic_types", 70 | "webhook_topics", 71 | ] 72 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/logs.py: -------------------------------------------------------------------------------- 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 listSelfAuditLogs( 18 | mist_session: _APISession, 19 | start: str | None = None, 20 | end: str | None = None, 21 | duration: str = "1d", 22 | limit: int = 100, 23 | page: int = 1, 24 | ) -> _APIResponse: 25 | """ 26 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/audit-logs/list-self-audit-logs 27 | 28 | PARAMS 29 | ----------- 30 | mistapi.APISession : mist_session 31 | mistapi session including authentication and Mist host information 32 | 33 | QUERY PARAMS 34 | ------------ 35 | start : str 36 | end : str 37 | duration : str, default: 1d 38 | limit : int, default: 100 39 | page : int, default: 1 40 | 41 | RETURN 42 | ----------- 43 | mistapi.APIResponse 44 | response from the API call 45 | """ 46 | 47 | uri = "/api/v1/self/logs" 48 | query_params: dict[str, str] = {} 49 | if start: 50 | query_params["start"] = str(start) 51 | if end: 52 | query_params["end"] = str(end) 53 | if duration: 54 | query_params["duration"] = str(duration) 55 | if limit: 56 | query_params["limit"] = str(limit) 57 | if page: 58 | query_params["page"] = str(page) 59 | resp = mist_session.mist_get(uri=uri, query=query_params) 60 | return resp 61 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/maps.py: -------------------------------------------------------------------------------- 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 importOrgMapsFile( 18 | mist_session: _APISession, 19 | org_id: str, 20 | auto_deviceprofile_assignment: bool | None = None, 21 | csv: str | None = None, 22 | file: str | None = None, 23 | json: dict | None = None, 24 | ) -> _APIResponse: 25 | """ 26 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/maps/import-org-maps 27 | 28 | PARAMS 29 | ----------- 30 | mistapi.APISession : mist_session 31 | mistapi session including authentication and Mist host information 32 | 33 | PATH PARAMS 34 | ----------- 35 | org_id : str 36 | 37 | BODY PARAMS 38 | ----------- 39 | auto_deviceprofile_assignment : bool 40 | Whether to auto assign device to deviceprofile by name 41 | csv : str 42 | path to the file to upload. CSV file for ap name mapping, optional 43 | file : str 44 | path to the file to upload. Ekahau or ibwave file 45 | json : dict 46 | 47 | RETURN 48 | ----------- 49 | mistapi.APIResponse 50 | response from the API call 51 | """ 52 | 53 | multipart_form_data = { 54 | "auto_deviceprofile_assignment": auto_deviceprofile_assignment, 55 | "csv": csv, 56 | "file": file, 57 | "json": json, 58 | } 59 | uri = f"/api/v1/orgs/{org_id}/maps/import" 60 | resp = mist_session.mist_post_file(uri=uri, multipart_form_data=multipart_form_data) 61 | return resp 62 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/insights.py: -------------------------------------------------------------------------------- 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 getMspSle( 18 | mist_session: _APISession, 19 | msp_id: str, 20 | metric: str, 21 | sle: str | None = None, 22 | duration: str = "1d", 23 | interval: str | None = None, 24 | start: str | None = None, 25 | end: str | None = None, 26 | ) -> _APIResponse: 27 | """ 28 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/sles/get-msp-sle 29 | 30 | PARAMS 31 | ----------- 32 | mistapi.APISession : mist_session 33 | mistapi session including authentication and Mist host information 34 | 35 | PATH PARAMS 36 | ----------- 37 | msp_id : str 38 | metric : str 39 | 40 | QUERY PARAMS 41 | ------------ 42 | sle : str 43 | duration : str, default: 1d 44 | interval : str 45 | start : str 46 | end : str 47 | 48 | RETURN 49 | ----------- 50 | mistapi.APIResponse 51 | response from the API call 52 | """ 53 | 54 | uri = f"/api/v1/msps/{msp_id}/insights/{metric}" 55 | query_params: dict[str, str] = {} 56 | if sle: 57 | query_params["sle"] = str(sle) 58 | if duration: 59 | query_params["duration"] = str(duration) 60 | if interval: 61 | query_params["interval"] = str(interval) 62 | if start: 63 | query_params["start"] = str(start) 64 | if end: 65 | query_params["end"] = str(end) 66 | resp = mist_session.mist_get(uri=uri, query=query_params) 67 | return resp 68 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/subscriptions.py: -------------------------------------------------------------------------------- 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 UnsubscribeSiteAlarms(mist_session: _APISession, site_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/alarms/unsubscribe-site-alarms 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}/subscriptions" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_delete(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def SubscribeSiteAlarms(mist_session: _APISession, site_id: str) -> _APIResponse: 43 | """ 44 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/alarms/subscribe-site-alarms 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}/subscriptions" 62 | resp = mist_session.mist_post(uri=uri) 63 | return resp 64 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/subscriptions.py: -------------------------------------------------------------------------------- 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 unsubscribeOrgAlarmsReports(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/alarms/unsubscribe-org-alarms-reports 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}/subscriptions" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_delete(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def subscribeOrgAlarmsReports(mist_session: _APISession, org_id: str) -> _APIResponse: 43 | """ 44 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/alarms/subscribe-org-alarms-reports 45 | 46 | PARAMS 47 | ----------- 48 | mistapi.APISession : mist_session 49 | mistapi session including authentication and Mist host information 50 | 51 | PATH PARAMS 52 | ----------- 53 | org_id : str 54 | 55 | RETURN 56 | ----------- 57 | mistapi.APIResponse 58 | response from the API call 59 | """ 60 | 61 | uri = f"/api/v1/orgs/{org_id}/subscriptions" 62 | resp = mist_session.mist_post(uri=uri) 63 | return resp 64 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/troubleshoot.py: -------------------------------------------------------------------------------- 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 troubleshootOrg( 18 | mist_session: _APISession, 19 | org_id: str, 20 | mac: str | None = None, 21 | site_id: str | None = None, 22 | start: str | None = None, 23 | end: str | None = None, 24 | type: str | None = None, 25 | ) -> _APIResponse: 26 | """ 27 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/marvis/troubleshoot-org 28 | 29 | PARAMS 30 | ----------- 31 | mistapi.APISession : mist_session 32 | mistapi session including authentication and Mist host information 33 | 34 | PATH PARAMS 35 | ----------- 36 | org_id : str 37 | 38 | QUERY PARAMS 39 | ------------ 40 | mac : str 41 | site_id : str 42 | start : str 43 | end : str 44 | type : str{'wan', 'wired', 'wireless'} 45 | When troubleshooting site, type of network to troubleshoot 46 | 47 | RETURN 48 | ----------- 49 | mistapi.APIResponse 50 | response from the API call 51 | """ 52 | 53 | uri = f"/api/v1/orgs/{org_id}/troubleshoot" 54 | query_params: dict[str, str] = {} 55 | if mac: 56 | query_params["mac"] = str(mac) 57 | if site_id: 58 | query_params["site_id"] = str(site_id) 59 | if start: 60 | query_params["start"] = str(start) 61 | if end: 62 | query_params["end"] = str(end) 63 | if type: 64 | query_params["type"] = str(type) 65 | resp = mist_session.mist_get(uri=uri, query=query_params) 66 | return resp 67 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/update.py: -------------------------------------------------------------------------------- 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 updateSelfEmail(mist_session: _APISession, body: dict | list) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/update-self-email 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | BODY PARAMS 27 | ----------- 28 | body : dict 29 | JSON object to send to Mist Cloud (see API doc above for more details) 30 | 31 | RETURN 32 | ----------- 33 | mistapi.APIResponse 34 | response from the API call 35 | """ 36 | 37 | uri = "/api/v1/self/update" 38 | resp = mist_session.mist_post(uri=uri, body=body) 39 | return resp 40 | 41 | 42 | def verifySelfEmail(mist_session: _APISession, token: str) -> _APIResponse: 43 | """ 44 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/verify-self-email 45 | 46 | PARAMS 47 | ----------- 48 | mistapi.APISession : mist_session 49 | mistapi session including authentication and Mist host information 50 | 51 | PATH PARAMS 52 | ----------- 53 | token : str 54 | 55 | RETURN 56 | ----------- 57 | mistapi.APIResponse 58 | response from the API call 59 | """ 60 | 61 | uri = f"/api/v1/self/update/verify/{token}" 62 | query_params: dict[str, str] = {} 63 | resp = mist_session.mist_get(uri=uri, query=query_params) 64 | return resp 65 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/vars.py: -------------------------------------------------------------------------------- 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 searchOrgVars( 18 | mist_session: _APISession, 19 | org_id: str, 20 | site_id: str | None = None, 21 | var: str | None = None, 22 | src: str | None = None, 23 | limit: int = 100, 24 | page: int = 1, 25 | sort: str = "timestamp", 26 | ) -> _APIResponse: 27 | """ 28 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/vars/search-org-vars 29 | 30 | PARAMS 31 | ----------- 32 | mistapi.APISession : mist_session 33 | mistapi session including authentication and Mist host information 34 | 35 | PATH PARAMS 36 | ----------- 37 | org_id : str 38 | 39 | QUERY PARAMS 40 | ------------ 41 | site_id : str 42 | var : str 43 | src : str{'deviceprofile', 'site'} 44 | limit : int, default: 100 45 | page : int, default: 1 46 | sort : str, default: timestamp 47 | 48 | RETURN 49 | ----------- 50 | mistapi.APIResponse 51 | response from the API call 52 | """ 53 | 54 | uri = f"/api/v1/orgs/{org_id}/vars/search" 55 | query_params: dict[str, str] = {} 56 | if site_id: 57 | query_params["site_id"] = str(site_id) 58 | if var: 59 | query_params["var"] = str(var) 60 | if src: 61 | query_params["src"] = str(src) 62 | if limit: 63 | query_params["limit"] = str(limit) 64 | if page: 65 | query_params["page"] = str(page) 66 | if sort: 67 | query_params["sort"] = str(sort) 68 | resp = mist_session.mist_get(uri=uri, query=query_params) 69 | return resp 70 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/logo.py: -------------------------------------------------------------------------------- 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 deleteMspLogo(mist_session: _APISession, msp_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/logo/delete-msp-logo 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | msp_id : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/msps/{msp_id}/logo" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_delete(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def postMspLogo( 43 | mist_session: _APISession, msp_id: str, body: dict | list 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/logo/post-msp-logo 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | msp_id : str 56 | 57 | BODY PARAMS 58 | ----------- 59 | body : dict 60 | JSON object to send to Mist Cloud (see API doc above for more details) 61 | 62 | RETURN 63 | ----------- 64 | mistapi.APIResponse 65 | response from the API call 66 | """ 67 | 68 | uri = f"/api/v1/msps/{msp_id}/logo" 69 | resp = mist_session.mist_post(uri=uri, body=body) 70 | return resp 71 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/crl.py: -------------------------------------------------------------------------------- 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 getOrgCrlFile(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/crl/get-org-crl-file 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}/crl" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def truncateOrgCrlFile( 43 | mist_session: _APISession, org_id: str, body: dict | list 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/cert/truncate-org-crl-file 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | org_id : str 56 | 57 | BODY PARAMS 58 | ----------- 59 | body : dict 60 | JSON object to send to Mist Cloud (see API doc above for more details) 61 | 62 | RETURN 63 | ----------- 64 | mistapi.APIResponse 65 | response from the API call 66 | """ 67 | 68 | uri = f"/api/v1/orgs/{org_id}/crl/truncate" 69 | resp = mist_session.mist_post(uri=uri, body=body) 70 | return resp 71 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/wan_client.py: -------------------------------------------------------------------------------- 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 countOrgWanClientEvents( 18 | mist_session: _APISession, 19 | org_id: str, 20 | distinct: str = "type", 21 | type: str | None = None, 22 | start: str | None = None, 23 | end: str | None = None, 24 | duration: str = "1d", 25 | limit: int = 100, 26 | ) -> _APIResponse: 27 | """ 28 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/clients/wan/count-org-wan-client-events 29 | 30 | PARAMS 31 | ----------- 32 | mistapi.APISession : mist_session 33 | mistapi session including authentication and Mist host information 34 | 35 | PATH PARAMS 36 | ----------- 37 | org_id : str 38 | 39 | QUERY PARAMS 40 | ------------ 41 | distinct : str{'hostname', 'ip', 'mac', 'mfg', 'type'}, default: type 42 | type : str 43 | start : str 44 | end : str 45 | duration : str, default: 1d 46 | limit : int, default: 100 47 | 48 | RETURN 49 | ----------- 50 | mistapi.APIResponse 51 | response from the API call 52 | """ 53 | 54 | uri = f"/api/v1/orgs/{org_id}/wan_client/events/count" 55 | query_params: dict[str, str] = {} 56 | if distinct: 57 | query_params["distinct"] = str(distinct) 58 | if type: 59 | query_params["type"] = str(type) 60 | if start: 61 | query_params["start"] = str(start) 62 | if end: 63 | query_params["end"] = str(end) 64 | if duration: 65 | query_params["duration"] = str(duration) 66 | if limit: 67 | query_params["limit"] = str(limit) 68 | resp = mist_session.mist_get(uri=uri, query=query_params) 69 | return resp 70 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/wan_client.py: -------------------------------------------------------------------------------- 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 countSiteWanClientEvents( 18 | mist_session: _APISession, 19 | site_id: str, 20 | distinct: str = "type", 21 | type: str | None = None, 22 | start: str | None = None, 23 | end: str | None = None, 24 | duration: str = "1d", 25 | limit: int = 100, 26 | ) -> _APIResponse: 27 | """ 28 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/clients/wan/count-site-wan-client-events 29 | 30 | PARAMS 31 | ----------- 32 | mistapi.APISession : mist_session 33 | mistapi session including authentication and Mist host information 34 | 35 | PATH PARAMS 36 | ----------- 37 | site_id : str 38 | 39 | QUERY PARAMS 40 | ------------ 41 | distinct : str{'hostname', 'ip', 'mac', 'mfg', 'type'}, default: type 42 | type : str 43 | start : str 44 | end : str 45 | duration : str, default: 1d 46 | limit : int, default: 100 47 | 48 | RETURN 49 | ----------- 50 | mistapi.APIResponse 51 | response from the API call 52 | """ 53 | 54 | uri = f"/api/v1/sites/{site_id}/wan_client/events/count" 55 | query_params: dict[str, str] = {} 56 | if distinct: 57 | query_params["distinct"] = str(distinct) 58 | if type: 59 | query_params["type"] = str(type) 60 | if start: 61 | query_params["start"] = str(start) 62 | if end: 63 | query_params["end"] = str(end) 64 | if duration: 65 | query_params["duration"] = str(duration) 66 | if limit: 67 | query_params["limit"] = str(limit) 68 | resp = mist_session.mist_get(uri=uri, query=query_params) 69 | return resp 70 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/search.py: -------------------------------------------------------------------------------- 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 searchMspOrgGroup( 18 | mist_session: _APISession, 19 | msp_id: str, 20 | type: str, 21 | q: str | None = None, 22 | limit: int = 100, 23 | start: str | None = None, 24 | end: str | None = None, 25 | duration: str = "1d", 26 | sort: str = "timestamp", 27 | ) -> _APIResponse: 28 | """ 29 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/search-msp-org-group 30 | 31 | PARAMS 32 | ----------- 33 | mistapi.APISession : mist_session 34 | mistapi session including authentication and Mist host information 35 | 36 | PATH PARAMS 37 | ----------- 38 | msp_id : str 39 | 40 | QUERY PARAMS 41 | ------------ 42 | type : str{'orgs'} 43 | Orgs 44 | q : str 45 | limit : int, default: 100 46 | start : str 47 | end : str 48 | duration : str, default: 1d 49 | sort : str, default: timestamp 50 | 51 | RETURN 52 | ----------- 53 | mistapi.APIResponse 54 | response from the API call 55 | """ 56 | 57 | uri = f"/api/v1/msps/{msp_id}/search" 58 | query_params: dict[str, str] = {} 59 | if type: 60 | query_params["type"] = str(type) 61 | if q: 62 | query_params["q"] = str(q) 63 | if limit: 64 | query_params["limit"] = str(limit) 65 | if start: 66 | query_params["start"] = str(start) 67 | if end: 68 | query_params["end"] = str(end) 69 | if duration: 70 | query_params["duration"] = str(duration) 71 | if sort: 72 | query_params["sort"] = str(sort) 73 | resp = mist_session.mist_get(uri=uri, query=query_params) 74 | return resp 75 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/licenses.py: -------------------------------------------------------------------------------- 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 listMspLicenses(mist_session: _APISession, msp_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/licenses/list-msp-licenses 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | msp_id : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/msps/{msp_id}/licenses" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def moveOrDeleteMspLicenseToAnotherOrg( 43 | mist_session: _APISession, msp_id: str, body: dict 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/licenses/move-or-delete-msp-license-to-another-org 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | msp_id : str 56 | 57 | BODY PARAMS 58 | ----------- 59 | body : dict 60 | JSON object to send to Mist Cloud (see API doc above for more details) 61 | 62 | RETURN 63 | ----------- 64 | mistapi.APIResponse 65 | response from the API call 66 | """ 67 | 68 | uri = f"/api/v1/msps/{msp_id}/licenses" 69 | resp = mist_session.mist_put(uri=uri, body=body) 70 | return resp 71 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/two_factor.py: -------------------------------------------------------------------------------- 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 generateSecretFor2faVerification( 18 | mist_session: _APISession, by: str = "qrcode" 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/mfa/generate-secret-for2fa-verification 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | QUERY PARAMS 29 | ------------ 30 | by : str{'qrcode'}, default: qrcode 31 | If `by`==`qrcode`, returns the secret as a qrcode image 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = "/api/v1/self/two_factor/token" 40 | query_params: dict[str, str] = {} 41 | if by: 42 | query_params["by"] = str(by) 43 | resp = mist_session.mist_get(uri=uri, query=query_params) 44 | return resp 45 | 46 | 47 | def verifyTwoFactor(mist_session: _APISession, body: dict | list) -> _APIResponse: 48 | """ 49 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/mfa/verify-two-factor 50 | 51 | PARAMS 52 | ----------- 53 | mistapi.APISession : mist_session 54 | mistapi session including authentication and Mist host information 55 | 56 | BODY PARAMS 57 | ----------- 58 | body : dict 59 | JSON object to send to Mist Cloud (see API doc above for more details) 60 | 61 | RETURN 62 | ----------- 63 | mistapi.APIResponse 64 | response from the API call 65 | """ 66 | 67 | uri = "/api/v1/self/two_factor/verify" 68 | resp = mist_session.mist_post(uri=uri, body=body) 69 | return resp 70 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/analyze_spectrum.py: -------------------------------------------------------------------------------- 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 getSiteRunningSpectrumAnalysis( 18 | mist_session: _APISession, site_id: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/spectrum-analysis/get-site-running-spectrum-analysis 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | 32 | RETURN 33 | ----------- 34 | mistapi.APIResponse 35 | response from the API call 36 | """ 37 | 38 | uri = f"/api/v1/sites/{site_id}/analyze_spectrum" 39 | query_params: dict[str, str] = {} 40 | resp = mist_session.mist_get(uri=uri, query=query_params) 41 | return resp 42 | 43 | 44 | def initiateSiteAnalyzeSpectrum( 45 | mist_session: _APISession, site_id: str, body: dict | list 46 | ) -> _APIResponse: 47 | """ 48 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/spectrum-analysis/initiate-site-analyze-spectrum 49 | 50 | PARAMS 51 | ----------- 52 | mistapi.APISession : mist_session 53 | mistapi session including authentication and Mist host information 54 | 55 | PATH PARAMS 56 | ----------- 57 | site_id : str 58 | 59 | BODY PARAMS 60 | ----------- 61 | body : dict 62 | JSON object to send to Mist Cloud (see API doc above for more details) 63 | 64 | RETURN 65 | ----------- 66 | mistapi.APIResponse 67 | response from the API call 68 | """ 69 | 70 | uri = f"/api/v1/sites/{site_id}/analyze_spectrum" 71 | resp = mist_session.mist_post(uri=uri, body=body) 72 | return resp 73 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/ssr.py: -------------------------------------------------------------------------------- 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 getSiteSsrUpgrade( 18 | mist_session: _APISession, site_id: str, upgrade_id: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/upgrade/get-site-ssr-upgrade 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | upgrade_id : str 32 | 33 | RETURN 34 | ----------- 35 | mistapi.APIResponse 36 | response from the API call 37 | """ 38 | 39 | uri = f"/api/v1/sites/{site_id}/ssr/upgrade/{upgrade_id}" 40 | query_params: dict[str, str] = {} 41 | resp = mist_session.mist_get(uri=uri, query=query_params) 42 | return resp 43 | 44 | 45 | def upgradeSsr( 46 | mist_session: _APISession, site_id: str, device_id: str, body: dict | list 47 | ) -> _APIResponse: 48 | """ 49 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/utilities/upgrade/upgrade-ssr 50 | 51 | PARAMS 52 | ----------- 53 | mistapi.APISession : mist_session 54 | mistapi session including authentication and Mist host information 55 | 56 | PATH PARAMS 57 | ----------- 58 | site_id : str 59 | device_id : str 60 | 61 | BODY PARAMS 62 | ----------- 63 | body : dict 64 | JSON object to send to Mist Cloud (see API doc above for more details) 65 | 66 | RETURN 67 | ----------- 68 | mistapi.APIResponse 69 | response from the API call 70 | """ 71 | 72 | uri = f"/api/v1/sites/{site_id}/ssr/{device_id}/upgrade" 73 | resp = mist_session.mist_post(uri=uri, body=body) 74 | return resp 75 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/stats.py: -------------------------------------------------------------------------------- 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 listMspOrgLicenses(mist_session: _APISession, msp_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/licenses/list-msp-org-licenses 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | PATH PARAMS 27 | ----------- 28 | msp_id : str 29 | 30 | RETURN 31 | ----------- 32 | mistapi.APIResponse 33 | response from the API call 34 | """ 35 | 36 | uri = f"/api/v1/msps/{msp_id}/stats/licenses" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def listMspOrgStats( 43 | mist_session: _APISession, msp_id: str, limit: int = 100, page: int = 1 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/orgs/list-msp-org-stats 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | msp_id : str 56 | 57 | QUERY PARAMS 58 | ------------ 59 | limit : int, default: 100 60 | page : int, default: 1 61 | 62 | RETURN 63 | ----------- 64 | mistapi.APIResponse 65 | response from the API call 66 | """ 67 | 68 | uri = f"/api/v1/msps/{msp_id}/stats/orgs" 69 | query_params: dict[str, str] = {} 70 | if limit: 71 | query_params["limit"] = str(limit) 72 | if page: 73 | query_params["page"] = str(page) 74 | resp = mist_session.mist_get(uri=uri, query=query_params) 75 | return resp 76 | -------------------------------------------------------------------------------- /src/mistapi/__pagination.py: -------------------------------------------------------------------------------- 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 get_next(mist_session: _APISession, response: _APIResponse) -> _APIResponse | None: 18 | """ 19 | Get the next page when previous response does not include all the items 20 | 21 | PARAMS 22 | ----------- 23 | mist_session : mistapi.APISession 24 | mistapi session including authentication and Mist host information 25 | response : mistapi.APIResponse 26 | mistapi previous response to use 27 | 28 | RETURN 29 | ----------- 30 | mistapi.APIResponse 31 | response from the API call passed in parameter 32 | """ 33 | if response.next: 34 | return mist_session.mist_get(response.next) 35 | else: 36 | return None 37 | 38 | 39 | def get_all(mist_session: _APISession, response: _APIResponse) -> list: 40 | """ 41 | Retrieve and return all the items after a first request 42 | 43 | PARAMS 44 | ----------- 45 | mist_session : mistapi.APISession 46 | mistapi session including authentication and Mist host information 47 | response : mistapi.APIResponse 48 | mistapi previous response to use 49 | 50 | RETURN 51 | ----------- 52 | list 53 | list of all the items 54 | """ 55 | data: list = [] 56 | if isinstance(response.data, list): 57 | data = list(response.data) 58 | while response.next: 59 | tmp = get_next(mist_session, response) 60 | if tmp: 61 | response = tmp 62 | data += response.data 63 | elif isinstance(response.data, dict) and "results" in response.data: 64 | data = response.data["results"].copy() 65 | while response.next: 66 | tmp = get_next(mist_session, response) 67 | if tmp: 68 | response = tmp 69 | data += response.data["results"] 70 | return data 71 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/claim.py: -------------------------------------------------------------------------------- 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 claimOrgLicense( 18 | mist_session: _APISession, org_id: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/licenses/claim-org-license 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/orgs/{org_id}/claim" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | 47 | 48 | def GetOrgLicenseAsyncClaimStatus( 49 | mist_session: _APISession, org_id: str, detail: bool | None = None 50 | ) -> _APIResponse: 51 | """ 52 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/licenses/get-org-license-async-claim-status 53 | 54 | PARAMS 55 | ----------- 56 | mistapi.APISession : mist_session 57 | mistapi session including authentication and Mist host information 58 | 59 | PATH PARAMS 60 | ----------- 61 | org_id : str 62 | 63 | QUERY PARAMS 64 | ------------ 65 | detail : bool 66 | 67 | RETURN 68 | ----------- 69 | mistapi.APIResponse 70 | response from the API call 71 | """ 72 | 73 | uri = f"/api/v1/orgs/{org_id}/claim/status" 74 | query_params: dict[str, str] = {} 75 | if detail: 76 | query_params["detail"] = str(detail) 77 | resp = mist_session.mist_get(uri=uri, query=query_params) 78 | return resp 79 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/oauth.py: -------------------------------------------------------------------------------- 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 getOauth2UrlForLinking( 18 | mist_session: _APISession, provider: str, forward: str | None = None 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/oauth2/get-oauth2-url-for-linking 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | provider : str 31 | 32 | QUERY PARAMS 33 | ------------ 34 | forward : str 35 | 36 | RETURN 37 | ----------- 38 | mistapi.APIResponse 39 | response from the API call 40 | """ 41 | 42 | uri = f"/api/v1/self/oauth/{provider}" 43 | query_params: dict[str, str] = {} 44 | if forward: 45 | query_params["forward"] = str(forward) 46 | resp = mist_session.mist_get(uri=uri, query=query_params) 47 | return resp 48 | 49 | 50 | def linkOauth2MistAccount( 51 | mist_session: _APISession, provider: str, body: dict | list 52 | ) -> _APIResponse: 53 | """ 54 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/oauth2/link-oauth2-mist-account 55 | 56 | PARAMS 57 | ----------- 58 | mistapi.APISession : mist_session 59 | mistapi session including authentication and Mist host information 60 | 61 | PATH PARAMS 62 | ----------- 63 | provider : str 64 | 65 | BODY PARAMS 66 | ----------- 67 | body : dict 68 | JSON object to send to Mist Cloud (see API doc above for more details) 69 | 70 | RETURN 71 | ----------- 72 | mistapi.APIResponse 73 | response from the API call 74 | """ 75 | 76 | uri = f"/api/v1/self/oauth/{provider}" 77 | resp = mist_session.mist_post(uri=uri, body=body) 78 | return resp 79 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/self/self.py: -------------------------------------------------------------------------------- 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 getSelf(mist_session: _APISession) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/get-self 20 | 21 | PARAMS 22 | ----------- 23 | mistapi.APISession : mist_session 24 | mistapi session including authentication and Mist host information 25 | 26 | RETURN 27 | ----------- 28 | mistapi.APIResponse 29 | response from the API call 30 | """ 31 | 32 | uri = "/api/v1/self" 33 | query_params: dict[str, str] = {} 34 | resp = mist_session.mist_get(uri=uri, query=query_params) 35 | return resp 36 | 37 | 38 | def deleteSelf(mist_session: _APISession) -> _APIResponse: 39 | """ 40 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/delete-self 41 | 42 | PARAMS 43 | ----------- 44 | mistapi.APISession : mist_session 45 | mistapi session including authentication and Mist host information 46 | 47 | RETURN 48 | ----------- 49 | mistapi.APIResponse 50 | response from the API call 51 | """ 52 | 53 | uri = "/api/v1/self" 54 | query_params: dict[str, str] = {} 55 | resp = mist_session.mist_delete(uri=uri, query=query_params) 56 | return resp 57 | 58 | 59 | def updateSelf(mist_session: _APISession, body: dict) -> _APIResponse: 60 | """ 61 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/self/account/update-self 62 | 63 | PARAMS 64 | ----------- 65 | mistapi.APISession : mist_session 66 | mistapi session including authentication and Mist host information 67 | 68 | BODY PARAMS 69 | ----------- 70 | body : dict 71 | JSON object to send to Mist Cloud (see API doc above for more details) 72 | 73 | RETURN 74 | ----------- 75 | mistapi.APIResponse 76 | response from the API call 77 | """ 78 | 79 | uri = "/api/v1/self" 80 | resp = mist_session.mist_put(uri=uri, body=body) 81 | return resp 82 | -------------------------------------------------------------------------------- /src/mistapi/__models/privilege.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Iterator 2 | 3 | from tabulate import tabulate 4 | 5 | 6 | class _Privilege: 7 | def __init__(self, privilege) -> None: 8 | self.scope: str = "" 9 | self.org_id: str = "" 10 | self.org_name: str = "" 11 | self.msp_id: str = "" 12 | self.msp_name: str = "" 13 | self.orggroup_ids: list[str] = [] 14 | self.name: str = "" 15 | self.role: str = "" 16 | self.site_id: str = "" 17 | self.sitegroup_ids: list[str] = [] 18 | self.views: list[str] = [] 19 | for key, val in privilege.items(): 20 | setattr(self, key, val) 21 | 22 | def __str__(self) -> str: 23 | fields = [ 24 | "scope", 25 | "role", 26 | "org_id", 27 | "org_name", 28 | "msp_id", 29 | "msp_name", 30 | "orggroup_ids", 31 | "name", 32 | "role", 33 | "site_id", 34 | "sitegroup_ids", 35 | ] 36 | string = "" 37 | for field in fields: 38 | if getattr(self, field) != "": 39 | string += f"{field}: {getattr(self, field)} \r\n" 40 | return string 41 | 42 | def get(self, key: str, default: Any | None = None) -> Any: 43 | if hasattr(self, key) and getattr(self, key): 44 | return getattr(self, key) 45 | else: 46 | return default 47 | 48 | 49 | class Privileges: 50 | def __init__(self, privileges: list[dict]) -> None: 51 | self.privileges: list[_Privilege] = [] 52 | for privilege in privileges: 53 | self.privileges.append(_Privilege(privilege)) 54 | 55 | def __iter__(self) -> Iterator[_Privilege]: 56 | """Return an iterator over the privileges.""" 57 | if not self.privileges: 58 | return iter([]) 59 | return iter(self.privileges) 60 | 61 | def __str__(self) -> str: 62 | columns_headers = [ 63 | "scope", 64 | "role", 65 | "name", 66 | "site_id", 67 | "org_name", 68 | "org_id", 69 | "msp_name", 70 | "msp_id", 71 | "views", 72 | ] 73 | table = [] 74 | for entry in self.privileges: 75 | temp = [] 76 | for field in columns_headers: 77 | if hasattr(entry, field): 78 | temp.append(str(getattr(entry, field))) 79 | else: 80 | temp.append("") 81 | table.append(temp) 82 | return tabulate(table, columns_headers) 83 | 84 | def display(self): 85 | return str(self) 86 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/cert.py: -------------------------------------------------------------------------------- 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 listOrgCertificates(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/cert/list-org-certificates 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}/cert" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def rotateOrgCertificate(mist_session: _APISession, org_id: str) -> _APIResponse: 43 | """ 44 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/cert/rotate-org-certificate 45 | 46 | PARAMS 47 | ----------- 48 | mistapi.APISession : mist_session 49 | mistapi session including authentication and Mist host information 50 | 51 | PATH PARAMS 52 | ----------- 53 | org_id : str 54 | 55 | RETURN 56 | ----------- 57 | mistapi.APIResponse 58 | response from the API call 59 | """ 60 | 61 | uri = f"/api/v1/orgs/{org_id}/cert/apply_pending" 62 | resp = mist_session.mist_post(uri=uri) 63 | return resp 64 | 65 | 66 | def clearOrgCertificates(mist_session: _APISession, org_id: str) -> _APIResponse: 67 | """ 68 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/cert/clear-org-certificates 69 | 70 | PARAMS 71 | ----------- 72 | mistapi.APISession : mist_session 73 | mistapi session including authentication and Mist host information 74 | 75 | PATH PARAMS 76 | ----------- 77 | org_id : str 78 | 79 | RETURN 80 | ----------- 81 | mistapi.APIResponse 82 | response from the API call 83 | """ 84 | 85 | uri = f"/api/v1/orgs/{org_id}/cert/regenerate" 86 | resp = mist_session.mist_post(uri=uri) 87 | return resp 88 | -------------------------------------------------------------------------------- /src/mistapi/__logger.py: -------------------------------------------------------------------------------- 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 | import logging 14 | import os 15 | 16 | os.system("") # nosec bandit B605 B607 17 | 18 | 19 | def magenta(text): 20 | return "\033[0;35m" + text + "\033[0m" 21 | 22 | 23 | def red(text): 24 | return "\033[0;31m" + text + "\033[0m" 25 | 26 | 27 | def yellow(text): 28 | return "\033[0;33m" + text + "\033[0m" 29 | 30 | 31 | def green(text): 32 | return "\033[0;32m" + text + "\033[0m" 33 | 34 | 35 | def white(text): 36 | return "\033[0;37m" + text + "\033[0m" 37 | 38 | 39 | def cyan(text): 40 | return "\033[0;36m" + text + "\033[0m" 41 | 42 | 43 | def blue(text): 44 | return "\033[0;34m" + text + "\033[0m" 45 | 46 | 47 | class Console: 48 | def __init__(self, level: int = 20) -> None: 49 | self.level: int = level 50 | 51 | def critical(self, message: str) -> None: 52 | if self.level <= 50 and self.level > 0: 53 | print(f"[{magenta('CRITICAL ')}] {message}") 54 | 55 | def error(self, message: str) -> None: 56 | if self.level <= 40 and self.level > 0: 57 | print(f"[{red(' ERROR ')}] {message}") 58 | 59 | def warning(self, message: str) -> None: 60 | if self.level <= 30 and self.level > 0: 61 | print(f"[{yellow(' WARNING ')}] {message}") 62 | 63 | def info(self, message: str) -> None: 64 | if self.level <= 20 and self.level > 0: 65 | print(f"[{green(' INFO ')}] {message}") 66 | 67 | def debug(self, message: str) -> None: 68 | if self.level <= 10 and self.level > 0: 69 | print(f"[{white('DEBUG ')}] {message}") 70 | 71 | def _set_log_level( 72 | self, console_log_level: int = 20, logging_log_level: int = 10 73 | ) -> None: 74 | """ 75 | set console and logging log level 76 | 77 | PARAMS 78 | ----------- 79 | console_log_level : int, default: 20 80 | logging_log_level : int, default: 10 81 | 82 | Values: 83 | 50 -> CRITICAL 84 | 40 -> ERROR 85 | 30 -> WARNING 86 | 20 -> INFO 87 | 10 -> DEBUG 88 | 0 -> DISABLED 89 | """ 90 | self.level = console_log_level 91 | logger.setLevel(logging_log_level) 92 | 93 | 94 | console = Console() 95 | logger = logging.getLogger("mistapi") 96 | logger.setLevel(logging.DEBUG) 97 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/count.py: -------------------------------------------------------------------------------- 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 countSiteZoneSessions( 18 | mist_session: _APISession, 19 | site_id: str, 20 | zone_type: str, 21 | distinct: str = "scope_id", 22 | user_type: str | None = None, 23 | user: str | None = None, 24 | scope_id: str | None = None, 25 | scope: str = "site", 26 | start: str | None = None, 27 | end: str | None = None, 28 | duration: str = "1d", 29 | limit: int = 100, 30 | ) -> _APIResponse: 31 | """ 32 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/zones/count-site-zone-sessions 33 | 34 | PARAMS 35 | ----------- 36 | mistapi.APISession : mist_session 37 | mistapi session including authentication and Mist host information 38 | 39 | PATH PARAMS 40 | ----------- 41 | site_id : str 42 | zone_type : str{'rssizones', 'zones'} 43 | 44 | QUERY PARAMS 45 | ------------ 46 | distinct : str{'scope', 'scope_id', 'user', 'user_type'}, default: scope_id 47 | user_type : str{'asset', 'client', 'sdkclient'} 48 | User type 49 | user : str 50 | scope_id : str 51 | scope : str{'map', 'rssizone', 'site', 'zone'}, default: site 52 | Scope 53 | start : str 54 | end : str 55 | duration : str, default: 1d 56 | limit : int, default: 100 57 | 58 | RETURN 59 | ----------- 60 | mistapi.APIResponse 61 | response from the API call 62 | """ 63 | 64 | uri = f"/api/v1/sites/{site_id}/{zone_type}/count" 65 | query_params: dict[str, str] = {} 66 | if distinct: 67 | query_params["distinct"] = str(distinct) 68 | if user_type: 69 | query_params["user_type"] = str(user_type) 70 | if user: 71 | query_params["user"] = str(user) 72 | if scope_id: 73 | query_params["scope_id"] = str(scope_id) 74 | if scope: 75 | query_params["scope"] = str(scope) 76 | if start: 77 | query_params["start"] = str(start) 78 | if end: 79 | query_params["end"] = str(end) 80 | if duration: 81 | query_params["duration"] = str(duration) 82 | if limit: 83 | query_params["limit"] = str(limit) 84 | resp = mist_session.mist_get(uri=uri, query=query_params) 85 | return resp 86 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/tickets.py: -------------------------------------------------------------------------------- 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 listMspTickets( 18 | mist_session: _APISession, 19 | msp_id: str, 20 | start: str | None = None, 21 | end: str | None = None, 22 | duration: str = "1d", 23 | ) -> _APIResponse: 24 | """ 25 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/tickets/list-msp-tickets 26 | 27 | PARAMS 28 | ----------- 29 | mistapi.APISession : mist_session 30 | mistapi session including authentication and Mist host information 31 | 32 | PATH PARAMS 33 | ----------- 34 | msp_id : str 35 | 36 | QUERY PARAMS 37 | ------------ 38 | start : str 39 | end : str 40 | duration : str, default: 1d 41 | 42 | RETURN 43 | ----------- 44 | mistapi.APIResponse 45 | response from the API call 46 | """ 47 | 48 | uri = f"/api/v1/msps/{msp_id}/tickets" 49 | query_params: dict[str, str] = {} 50 | if start: 51 | query_params["start"] = str(start) 52 | if end: 53 | query_params["end"] = str(end) 54 | if duration: 55 | query_params["duration"] = str(duration) 56 | resp = mist_session.mist_get(uri=uri, query=query_params) 57 | return resp 58 | 59 | 60 | def countMspTickets( 61 | mist_session: _APISession, msp_id: str, distinct: str = "status", limit: int = 100 62 | ) -> _APIResponse: 63 | """ 64 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/tickets/count-msp-tickets 65 | 66 | PARAMS 67 | ----------- 68 | mistapi.APISession : mist_session 69 | mistapi session including authentication and Mist host information 70 | 71 | PATH PARAMS 72 | ----------- 73 | msp_id : str 74 | 75 | QUERY PARAMS 76 | ------------ 77 | distinct : str{'org_id', 'status', 'type'}, default: status 78 | limit : int, default: 100 79 | 80 | RETURN 81 | ----------- 82 | mistapi.APIResponse 83 | response from the API call 84 | """ 85 | 86 | uri = f"/api/v1/msps/{msp_id}/tickets/count" 87 | query_params: dict[str, str] = {} 88 | if distinct: 89 | query_params["distinct"] = str(distinct) 90 | if limit: 91 | query_params["limit"] = str(limit) 92 | resp = mist_session.mist_get(uri=uri, query=query_params) 93 | return resp 94 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/sites.py: -------------------------------------------------------------------------------- 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 getSiteInfo(mist_session: _APISession, site_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/get-site-info 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}" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def deleteSite(mist_session: _APISession, site_id: str) -> _APIResponse: 43 | """ 44 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/delete-site 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}" 62 | query_params: dict[str, str] = {} 63 | resp = mist_session.mist_delete(uri=uri, query=query_params) 64 | return resp 65 | 66 | 67 | def updateSiteInfo(mist_session: _APISession, site_id: str, body: dict) -> _APIResponse: 68 | """ 69 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/update-site-info 70 | 71 | PARAMS 72 | ----------- 73 | mistapi.APISession : mist_session 74 | mistapi session including authentication and Mist host information 75 | 76 | PATH PARAMS 77 | ----------- 78 | site_id : str 79 | 80 | BODY PARAMS 81 | ----------- 82 | body : dict 83 | JSON object to send to Mist Cloud (see API doc above for more details) 84 | 85 | RETURN 86 | ----------- 87 | mistapi.APIResponse 88 | response from the API call 89 | """ 90 | 91 | uri = f"/api/v1/sites/{site_id}" 92 | resp = mist_session.mist_put(uri=uri, body=body) 93 | return resp 94 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/visits.py: -------------------------------------------------------------------------------- 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 searchSiteZoneSessions( 18 | mist_session: _APISession, 19 | site_id: str, 20 | zone_type: str, 21 | user_type: str | None = None, 22 | user: str | None = None, 23 | scope_id: str | None = None, 24 | scope: str = "site", 25 | limit: int = 100, 26 | page: int = 1, 27 | start: str | None = None, 28 | end: str | None = None, 29 | duration: str = "1d", 30 | sort: str = "timestamp", 31 | ) -> _APIResponse: 32 | """ 33 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/zones/search-site-zone-sessions 34 | 35 | PARAMS 36 | ----------- 37 | mistapi.APISession : mist_session 38 | mistapi session including authentication and Mist host information 39 | 40 | PATH PARAMS 41 | ----------- 42 | site_id : str 43 | zone_type : str{'rssizones', 'zones'} 44 | 45 | QUERY PARAMS 46 | ------------ 47 | user_type : str{'asset', 'client', 'sdkclient'} 48 | User type, client (default) / sdkclient / asset 49 | user : str 50 | scope_id : str 51 | scope : str{'map', 'rssizone', 'site', 'zone'}, default: site 52 | Scope 53 | limit : int, default: 100 54 | page : int, default: 1 55 | start : str 56 | end : str 57 | duration : str, default: 1d 58 | sort : str, default: timestamp 59 | 60 | RETURN 61 | ----------- 62 | mistapi.APIResponse 63 | response from the API call 64 | """ 65 | 66 | uri = f"/api/v1/sites/{site_id}/{zone_type}/visits/search" 67 | query_params: dict[str, str] = {} 68 | if user_type: 69 | query_params["user_type"] = str(user_type) 70 | if user: 71 | query_params["user"] = str(user) 72 | if scope_id: 73 | query_params["scope_id"] = str(scope_id) 74 | if scope: 75 | query_params["scope"] = str(scope) 76 | if limit: 77 | query_params["limit"] = str(limit) 78 | if page: 79 | query_params["page"] = str(page) 80 | if start: 81 | query_params["start"] = str(start) 82 | if end: 83 | query_params["end"] = str(end) 84 | if duration: 85 | query_params["duration"] = str(duration) 86 | if sort: 87 | query_params["sort"] = str(sort) 88 | resp = mist_session.mist_get(uri=uri, query=query_params) 89 | return resp 90 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/licenses.py: -------------------------------------------------------------------------------- 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 getOrgLicensesSummary(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/licenses/get-org-licenses-summary 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}/licenses" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def moveOrDeleteOrgLicenseToAnotherOrg( 43 | mist_session: _APISession, org_id: str, body: dict 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/licenses/move-or-delete-org-license-to-another-org 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | org_id : str 56 | 57 | BODY PARAMS 58 | ----------- 59 | body : dict 60 | JSON object to send to Mist Cloud (see API doc above for more details) 61 | 62 | RETURN 63 | ----------- 64 | mistapi.APIResponse 65 | response from the API call 66 | """ 67 | 68 | uri = f"/api/v1/orgs/{org_id}/licenses" 69 | resp = mist_session.mist_put(uri=uri, body=body) 70 | return resp 71 | 72 | 73 | def getOrgLicensesBySite(mist_session: _APISession, org_id: str) -> _APIResponse: 74 | """ 75 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/licenses/get-org-licenses-by-site 76 | 77 | PARAMS 78 | ----------- 79 | mistapi.APISession : mist_session 80 | mistapi session including authentication and Mist host information 81 | 82 | PATH PARAMS 83 | ----------- 84 | org_id : str 85 | 86 | RETURN 87 | ----------- 88 | mistapi.APIResponse 89 | response from the API call 90 | """ 91 | 92 | uri = f"/api/v1/orgs/{org_id}/licenses/usages" 93 | query_params: dict[str, str] = {} 94 | resp = mist_session.mist_get(uri=uri, query=query_params) 95 | return resp 96 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/admins.py: -------------------------------------------------------------------------------- 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 listOrgAdmins(mist_session: _APISession, org_id: str) -> _APIResponse: 18 | """ 19 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/list-org-admins 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}/admins" 37 | query_params: dict[str, str] = {} 38 | resp = mist_session.mist_get(uri=uri, query=query_params) 39 | return resp 40 | 41 | 42 | def revokeOrgAdmin( 43 | mist_session: _APISession, org_id: str, admin_id: str 44 | ) -> _APIResponse: 45 | """ 46 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/revoke-org-admin 47 | 48 | PARAMS 49 | ----------- 50 | mistapi.APISession : mist_session 51 | mistapi session including authentication and Mist host information 52 | 53 | PATH PARAMS 54 | ----------- 55 | org_id : str 56 | admin_id : str 57 | 58 | RETURN 59 | ----------- 60 | mistapi.APIResponse 61 | response from the API call 62 | """ 63 | 64 | uri = f"/api/v1/orgs/{org_id}/admins/{admin_id}" 65 | query_params: dict[str, str] = {} 66 | resp = mist_session.mist_delete(uri=uri, query=query_params) 67 | return resp 68 | 69 | 70 | def updateOrgAdmin( 71 | mist_session: _APISession, org_id: str, admin_id: str, body: dict 72 | ) -> _APIResponse: 73 | """ 74 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/update-org-admin 75 | 76 | PARAMS 77 | ----------- 78 | mistapi.APISession : mist_session 79 | mistapi session including authentication and Mist host information 80 | 81 | PATH PARAMS 82 | ----------- 83 | org_id : str 84 | admin_id : str 85 | 86 | BODY PARAMS 87 | ----------- 88 | body : dict 89 | JSON object to send to Mist Cloud (see API doc above for more details) 90 | 91 | RETURN 92 | ----------- 93 | mistapi.APIResponse 94 | response from the API call 95 | """ 96 | 97 | uri = f"/api/v1/orgs/{org_id}/admins/{admin_id}" 98 | resp = mist_session.mist_put(uri=uri, body=body) 99 | return resp 100 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/__init__.py: -------------------------------------------------------------------------------- 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.api.v1.sites import ( 14 | sites, 15 | aamwprofiles, 16 | alarms, 17 | analyze_spectrum, 18 | anomaly, 19 | apps, 20 | aptemplates, 21 | assetfilters, 22 | assets, 23 | avprofiles, 24 | beacons, 25 | clients, 26 | deviceprofiles, 27 | devices, 28 | events, 29 | evpn_topologies, 30 | gatewaytemplates, 31 | guests, 32 | idpprofiles, 33 | insights, 34 | licenses, 35 | location, 36 | maps, 37 | mxedges, 38 | mxtunnels, 39 | nac_clients, 40 | networks, 41 | networktemplates, 42 | otherdevices, 43 | pcaps, 44 | psks, 45 | rfdiags, 46 | rftemplates, 47 | rogues, 48 | rrm, 49 | rssizones, 50 | secintelprofiles, 51 | servicepolicies, 52 | services, 53 | setting, 54 | sitetemplates, 55 | skyatp, 56 | sle, 57 | ssr, 58 | stats, 59 | subscriptions, 60 | synthetic_test, 61 | uisettings, 62 | vbeacons, 63 | vpns, 64 | wan_client, 65 | wan_clients, 66 | wan_usages, 67 | webhooks, 68 | wired_clients, 69 | wlans, 70 | wxrules, 71 | wxtags, 72 | wxtunnels, 73 | zones, 74 | count, 75 | visits, 76 | ) 77 | 78 | __all__ = [ 79 | "sites", 80 | "aamwprofiles", 81 | "alarms", 82 | "analyze_spectrum", 83 | "anomaly", 84 | "apps", 85 | "aptemplates", 86 | "assetfilters", 87 | "assets", 88 | "avprofiles", 89 | "beacons", 90 | "clients", 91 | "deviceprofiles", 92 | "devices", 93 | "events", 94 | "evpn_topologies", 95 | "gatewaytemplates", 96 | "guests", 97 | "idpprofiles", 98 | "insights", 99 | "licenses", 100 | "location", 101 | "maps", 102 | "mxedges", 103 | "mxtunnels", 104 | "nac_clients", 105 | "networks", 106 | "networktemplates", 107 | "otherdevices", 108 | "pcaps", 109 | "psks", 110 | "rfdiags", 111 | "rftemplates", 112 | "rogues", 113 | "rrm", 114 | "rssizones", 115 | "secintelprofiles", 116 | "servicepolicies", 117 | "services", 118 | "setting", 119 | "sitetemplates", 120 | "skyatp", 121 | "sle", 122 | "ssr", 123 | "stats", 124 | "subscriptions", 125 | "synthetic_test", 126 | "uisettings", 127 | "vbeacons", 128 | "vpns", 129 | "wan_client", 130 | "wan_clients", 131 | "wan_usages", 132 | "webhooks", 133 | "wired_clients", 134 | "wlans", 135 | "wxrules", 136 | "wxtags", 137 | "wxtunnels", 138 | "zones", 139 | "count", 140 | "visits", 141 | ] 142 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/sites/anomaly.py: -------------------------------------------------------------------------------- 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 getSiteAnomalyEventsForClient( 18 | mist_session: _APISession, site_id: str, client_mac: str, metric: str 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/anomaly/get-site-anomaly-events-for-client 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | site_id : str 31 | client_mac : str 32 | metric : str 33 | 34 | RETURN 35 | ----------- 36 | mistapi.APIResponse 37 | response from the API call 38 | """ 39 | 40 | uri = f"/api/v1/sites/{site_id}/anomaly/client/{client_mac}/{metric}" 41 | query_params: dict[str, str] = {} 42 | resp = mist_session.mist_get(uri=uri, query=query_params) 43 | return resp 44 | 45 | 46 | def getSiteAnomalyEventsForDevice( 47 | mist_session: _APISession, site_id: str, metric: str, device_mac: str 48 | ) -> _APIResponse: 49 | """ 50 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/anomaly/get-site-anomaly-events-for-device 51 | 52 | PARAMS 53 | ----------- 54 | mistapi.APISession : mist_session 55 | mistapi session including authentication and Mist host information 56 | 57 | PATH PARAMS 58 | ----------- 59 | site_id : str 60 | metric : str 61 | device_mac : str 62 | 63 | RETURN 64 | ----------- 65 | mistapi.APIResponse 66 | response from the API call 67 | """ 68 | 69 | uri = f"/api/v1/sites/{site_id}/anomaly/device/{device_mac}/{metric}" 70 | query_params: dict[str, str] = {} 71 | resp = mist_session.mist_get(uri=uri, query=query_params) 72 | return resp 73 | 74 | 75 | def listSiteAnomalyEvents( 76 | mist_session: _APISession, site_id: str, metric: str 77 | ) -> _APIResponse: 78 | """ 79 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/sites/anomaly/list-site-anomaly-events 80 | 81 | PARAMS 82 | ----------- 83 | mistapi.APISession : mist_session 84 | mistapi session including authentication and Mist host information 85 | 86 | PATH PARAMS 87 | ----------- 88 | site_id : str 89 | metric : str 90 | 91 | RETURN 92 | ----------- 93 | mistapi.APIResponse 94 | response from the API call 95 | """ 96 | 97 | uri = f"/api/v1/sites/{site_id}/anomaly/{metric}" 98 | query_params: dict[str, str] = {} 99 | resp = mist_session.mist_get(uri=uri, query=query_params) 100 | return resp 101 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/msps/invites.py: -------------------------------------------------------------------------------- 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 inviteMspAdmin( 18 | mist_session: _APISession, msp_id: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/admins/invite-msp-admin 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | msp_id : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/msps/{msp_id}/invites" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | 47 | 48 | def uninviteMspAdmin( 49 | mist_session: _APISession, msp_id: str, invite_id: str 50 | ) -> _APIResponse: 51 | """ 52 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/admins/uninvite-msp-admin 53 | 54 | PARAMS 55 | ----------- 56 | mistapi.APISession : mist_session 57 | mistapi session including authentication and Mist host information 58 | 59 | PATH PARAMS 60 | ----------- 61 | msp_id : str 62 | invite_id : str 63 | 64 | RETURN 65 | ----------- 66 | mistapi.APIResponse 67 | response from the API call 68 | """ 69 | 70 | uri = f"/api/v1/msps/{msp_id}/invites/{invite_id}" 71 | query_params: dict[str, str] = {} 72 | resp = mist_session.mist_delete(uri=uri, query=query_params) 73 | return resp 74 | 75 | 76 | def updateMspAdminInvite( 77 | mist_session: _APISession, msp_id: str, invite_id: str, body: dict 78 | ) -> _APIResponse: 79 | """ 80 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/msps/admins/update-msp-admin-invite 81 | 82 | PARAMS 83 | ----------- 84 | mistapi.APISession : mist_session 85 | mistapi session including authentication and Mist host information 86 | 87 | PATH PARAMS 88 | ----------- 89 | msp_id : str 90 | invite_id : str 91 | 92 | BODY PARAMS 93 | ----------- 94 | body : dict 95 | JSON object to send to Mist Cloud (see API doc above for more details) 96 | 97 | RETURN 98 | ----------- 99 | mistapi.APIResponse 100 | response from the API call 101 | """ 102 | 103 | uri = f"/api/v1/msps/{msp_id}/invites/{invite_id}" 104 | resp = mist_session.mist_put(uri=uri, body=body) 105 | return resp 106 | -------------------------------------------------------------------------------- /src/mistapi/api/v1/orgs/invites.py: -------------------------------------------------------------------------------- 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 inviteOrgAdmin( 18 | mist_session: _APISession, org_id: str, body: dict | list 19 | ) -> _APIResponse: 20 | """ 21 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/invite-org-admin 22 | 23 | PARAMS 24 | ----------- 25 | mistapi.APISession : mist_session 26 | mistapi session including authentication and Mist host information 27 | 28 | PATH PARAMS 29 | ----------- 30 | org_id : str 31 | 32 | BODY PARAMS 33 | ----------- 34 | body : dict 35 | JSON object to send to Mist Cloud (see API doc above for more details) 36 | 37 | RETURN 38 | ----------- 39 | mistapi.APIResponse 40 | response from the API call 41 | """ 42 | 43 | uri = f"/api/v1/orgs/{org_id}/invites" 44 | resp = mist_session.mist_post(uri=uri, body=body) 45 | return resp 46 | 47 | 48 | def uninviteOrgAdmin( 49 | mist_session: _APISession, org_id: str, invite_id: str 50 | ) -> _APIResponse: 51 | """ 52 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/uninvite-org-admin 53 | 54 | PARAMS 55 | ----------- 56 | mistapi.APISession : mist_session 57 | mistapi session including authentication and Mist host information 58 | 59 | PATH PARAMS 60 | ----------- 61 | org_id : str 62 | invite_id : str 63 | 64 | RETURN 65 | ----------- 66 | mistapi.APIResponse 67 | response from the API call 68 | """ 69 | 70 | uri = f"/api/v1/orgs/{org_id}/invites/{invite_id}" 71 | query_params: dict[str, str] = {} 72 | resp = mist_session.mist_delete(uri=uri, query=query_params) 73 | return resp 74 | 75 | 76 | def updateOrgAdminInvite( 77 | mist_session: _APISession, org_id: str, invite_id: str, body: dict 78 | ) -> _APIResponse: 79 | """ 80 | API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/admins/update-org-admin-invite 81 | 82 | PARAMS 83 | ----------- 84 | mistapi.APISession : mist_session 85 | mistapi session including authentication and Mist host information 86 | 87 | PATH PARAMS 88 | ----------- 89 | org_id : str 90 | invite_id : str 91 | 92 | BODY PARAMS 93 | ----------- 94 | body : dict 95 | JSON object to send to Mist Cloud (see API doc above for more details) 96 | 97 | RETURN 98 | ----------- 99 | mistapi.APIResponse 100 | response from the API call 101 | """ 102 | 103 | uri = f"/api/v1/orgs/{org_id}/invites/{invite_id}" 104 | resp = mist_session.mist_put(uri=uri, body=body) 105 | return resp 106 | --------------------------------------------------------------------------------