-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
------------------ **Fixed:** FortigateAPI `get`, `update` methods for objects without UID
- Loading branch information
1 parent
49ef728
commit 401b2c7
Showing
16 changed files
with
421 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""api/v2/cmdb/system/global | ||
- Update data in the Fortigate | ||
- Get data from the Fortigate | ||
""" | ||
|
||
from pprint import pprint | ||
|
||
from fortigate_api import FortiGateAPI | ||
|
||
HOST = "host" | ||
USERNAME = "username" | ||
PASSWORD = "password" | ||
|
||
api = FortiGateAPI(host=HOST, username=USERNAME, password=PASSWORD) | ||
|
||
# Update data in the Fortigate | ||
data = {"timezone": 80} | ||
response = api.cmdb.system.global_.update(data) | ||
print(f"update {response}") # update <Response [200]> | ||
|
||
# Get data from the Fortigate | ||
result = api.cmdb.system.global_.get() | ||
pprint(result) | ||
# [{"admin-concurrent": "enable", | ||
# "admin-console-timeout": 300, | ||
# "admin-hsts-max-age": 15552000, | ||
# "timezone": "80", | ||
# ... | ||
|
||
api.logout() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ class GlobalSC(Connector): | |
|
||
uid = "" | ||
_path = "api/v2/cmdb/system/global" | ||
_path_ui = "/ng/system/settings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "fortigate_api" | ||
version = "2.0.0" | ||
version = "2.0.1" | ||
description = "Python package to configure Fortigate (Fortios) devices using REST API and SSH" | ||
authors = ["Vladimirs Prusakovs <[email protected]>"] | ||
readme = "README.rst" | ||
|
@@ -55,7 +55,7 @@ test = ["pytest"] | |
|
||
[tool.poetry.urls] | ||
"Bug Tracker" = "https://github.com/vladimirs-git/fortigate-api/issues" | ||
"Download URL" = "https://github.com/vladimirs-git/fortigate-api/archive/refs/tags/2.0.0.tar.gz" | ||
"Download URL" = "https://github.com/vladimirs-git/fortigate-api/archive/refs/tags/2.0.1.tar.gz" | ||
|
||
[tool.pylint] | ||
max-line-length = 100 | ||
|
Oops, something went wrong.