firemon-api 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {firemon-api-0.3.3/firemon_api.egg-info → firemon-api-0.3.4}/PKG-INFO +16 -12
- {firemon-api-0.3.3 → firemon-api-0.3.4}/README.rst +15 -11
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/index.rst +1 -1
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/__init__.py +4 -2
- firemon-api-0.3.4/firemon_api/apps/orchestration/__init__.py +15 -0
- firemon-api-0.3.4/firemon_api/apps/orchestration/changes.py +181 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/packets.py +3 -34
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/tasks.py +2 -11
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/workflows.py +1 -1
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/__init__.py +3 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/access_path.py +3 -21
- firemon-api-0.3.4/firemon_api/apps/securitymanager/devicegroups.py +261 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/devicepacks.py +3 -20
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/devices.py +80 -36
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/maps.py +5 -20
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/revisions.py +4 -28
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/routes.py +2 -9
- firemon-api-0.3.4/firemon_api/apps/securitymanager/rulerec.py +33 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/siql.py +2 -11
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/users.py +2 -11
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/zones.py +3 -9
- firemon-api-0.3.4/firemon_api/apps/structure/__init__.py +12 -0
- firemon-api-0.3.4/firemon_api/apps/structure/apa.py +10 -0
- firemon-api-0.3.4/firemon_api/apps/structure/policyplan.py +26 -0
- firemon-api-0.3.4/firemon_api/apps/structure/rulerec.py +43 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/api.py +1 -1
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/endpoint.py +36 -29
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/query.py +3 -2
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/response.py +55 -34
- {firemon-api-0.3.3 → firemon-api-0.3.4/firemon_api.egg-info}/PKG-INFO +16 -12
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api.egg-info/SOURCES.txt +8 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/.gitignore +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/.pre-commit-config.yaml +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/Makefile +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/README.md +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/Makefile +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/_static/logo_firemon.png +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/_templates/sidebarintro.html +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/_templates/sidebarlogo.html +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/conf.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/make.bat +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/policyplanner/tickets.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/policyplanner/workflows.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/securitymanager/devicepacks.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/securitymanager/devices.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/securitymanager/siql.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/securitymanager/users.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/user/advanced.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/user/install.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/docs/user/quickstart.rst +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/__init__.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/__init__.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/certauth.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/cleanup.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/config.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/database.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/diagpkg.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/controlpanel/errors.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyoptimizer/__init__.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/__init__.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/policyplan.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/policyplanner/siql.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/centralsyslogconfigs.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/centralsyslogs.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/collectionconfigs.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/collectors.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/deviceclusters.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/elasticsearch.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/license.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/apps/securitymanager/logging.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/__init__.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/app.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api/core/utils.py +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api.egg-info/dependency_links.txt +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api.egg-info/not-zip-safe +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api.egg-info/requires.txt +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/firemon_api.egg-info/top_level.txt +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/pyproject.toml +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/requirements.txt +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/setup.cfg +0 -0
- {firemon-api-0.3.3 → firemon-api-0.3.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: firemon-api
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Python Wrapper for Firemon APIs
|
|
5
5
|
Author: Luke Johannsen
|
|
6
6
|
Author-email: luke.johannsen@firemon.com
|
|
@@ -29,21 +29,24 @@ This project is for wrapper for the Firemon APIs (Security Manager, etc).
|
|
|
29
29
|
|
|
30
30
|
The User Guide available on `Read the Docs <https://firemon-api.readthedocs.io/>`
|
|
31
31
|
|
|
32
|
-
Current
|
|
33
|
-
|
|
32
|
+
Current Philosophy
|
|
33
|
+
------------------
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
Endpoints are made and return objects which may have their own functions. For example search
|
|
37
|
-
and manipulation of devices and their data. This is attempt to make the API a bit more user
|
|
38
|
-
friendly without requiring more interaction by the user.
|
|
35
|
+
The ``firemon-api`` is an attempt to make a Pythonic wrapper to the FireMon SIP APIs (Security Manager, etc...).
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
that
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
The intent is to hopefully speed up development of projects. There is no intent to do a 1-to-1 reference of all
|
|
38
|
+
the potential API calls. If that is desired you may try to use the dynamically built functions created using
|
|
39
|
+
the ``get_api()``. Or read the ``/api-doc`` of your FireMon product and make use of the ``request()`` function for
|
|
40
|
+
the individually created application objects.
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
**Request Example**::
|
|
46
43
|
|
|
44
|
+
>>> fm.sm.request(key="device", use_domain=True).get()
|
|
45
|
+
[{'id': 27, 'domainId': 1, 'name': 'PA-VM 11.0.1', 'managementIp': <snip...>]
|
|
46
|
+
|
|
47
|
+
There is currently no intention to follow any version of the FireMon products and so there may
|
|
48
|
+
be instances where a function worked in one version but no longer in another though this generally is not a
|
|
49
|
+
problem.
|
|
47
50
|
|
|
48
51
|
Installation of FireMon API
|
|
49
52
|
---------------------------
|
|
@@ -56,6 +59,7 @@ Install ``firemon-api`` into a Python ``venv``.
|
|
|
56
59
|
~$ source ~/virtualenvs/fmapi/bin/activate
|
|
57
60
|
(fmapi) ~$ pip install firemon-api
|
|
58
61
|
Collecting firemon-api
|
|
62
|
+
...
|
|
59
63
|
|
|
60
64
|
|
|
61
65
|
Usage
|
|
@@ -5,21 +5,24 @@ This project is for wrapper for the Firemon APIs (Security Manager, etc).
|
|
|
5
5
|
|
|
6
6
|
The User Guide available on `Read the Docs <https://firemon-api.readthedocs.io/>`
|
|
7
7
|
|
|
8
|
-
Current
|
|
9
|
-
|
|
8
|
+
Current Philosophy
|
|
9
|
+
------------------
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
Endpoints are made and return objects which may have their own functions. For example search
|
|
13
|
-
and manipulation of devices and their data. This is attempt to make the API a bit more user
|
|
14
|
-
friendly without requiring more interaction by the user.
|
|
11
|
+
The ``firemon-api`` is an attempt to make a Pythonic wrapper to the FireMon SIP APIs (Security Manager, etc...).
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
that
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
The intent is to hopefully speed up development of projects. There is no intent to do a 1-to-1 reference of all
|
|
14
|
+
the potential API calls. If that is desired you may try to use the dynamically built functions created using
|
|
15
|
+
the ``get_api()``. Or read the ``/api-doc`` of your FireMon product and make use of the ``request()`` function for
|
|
16
|
+
the individually created application objects.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
**Request Example**::
|
|
22
19
|
|
|
20
|
+
>>> fm.sm.request(key="device", use_domain=True).get()
|
|
21
|
+
[{'id': 27, 'domainId': 1, 'name': 'PA-VM 11.0.1', 'managementIp': <snip...>]
|
|
22
|
+
|
|
23
|
+
There is currently no intention to follow any version of the FireMon products and so there may
|
|
24
|
+
be instances where a function worked in one version but no longer in another though this generally is not a
|
|
25
|
+
problem.
|
|
23
26
|
|
|
24
27
|
Installation of FireMon API
|
|
25
28
|
---------------------------
|
|
@@ -32,6 +35,7 @@ Install ``firemon-api`` into a Python ``venv``.
|
|
|
32
35
|
~$ source ~/virtualenvs/fmapi/bin/activate
|
|
33
36
|
(fmapi) ~$ pip install firemon-api
|
|
34
37
|
Collecting firemon-api
|
|
38
|
+
...
|
|
35
39
|
|
|
36
40
|
|
|
37
41
|
Usage
|
|
@@ -18,7 +18,7 @@ the individually created application objects.
|
|
|
18
18
|
>>> fm.sm.request(key="device", use_domain=True).get()
|
|
19
19
|
[{'id': 27, 'domainId': 1, 'name': 'PA-VM 11.0.1', 'managementIp': <snip...>]
|
|
20
20
|
|
|
21
|
-
There is
|
|
21
|
+
There is currently no intention to follow any version of the FireMon products and so there may
|
|
22
22
|
be instances where a function worked in one version but no longer in another though this generally is not a
|
|
23
23
|
problem.
|
|
24
24
|
|
|
@@ -18,6 +18,7 @@ from firemon_api.core.query import Request, RequestResponse
|
|
|
18
18
|
log = logging.getLogger(__name__)
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
from .orchestration import *
|
|
21
22
|
from .policyoptimizer import *
|
|
22
23
|
from .policyplanner import *
|
|
23
24
|
from .securitymanager import *
|
|
@@ -55,6 +56,7 @@ class SecurityManager(App):
|
|
|
55
56
|
self.collectors = Collectors(self.api, self)
|
|
56
57
|
self.collectorgroups = CollectorGroups(self.api, self)
|
|
57
58
|
self.deviceclusters = DeviceClusters(self.api, self)
|
|
59
|
+
self.devicegroups = DeviceGroups(self.api, self)
|
|
58
60
|
self.devices = Devices(self.api, self)
|
|
59
61
|
self.dp = DevicePacks(self.api, self) # Todo: create the other /plugin
|
|
60
62
|
self.es = ElasticSearch(self.api, self)
|
|
@@ -87,7 +89,7 @@ class Orchestration(App):
|
|
|
87
89
|
super().__init__(api)
|
|
88
90
|
|
|
89
91
|
# Endpoints
|
|
90
|
-
|
|
92
|
+
self.changes = Changes(self.api, self)
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
class PolicyOptimizer(App):
|
|
@@ -107,7 +109,7 @@ class PolicyOptimizer(App):
|
|
|
107
109
|
super().__init__(api)
|
|
108
110
|
|
|
109
111
|
# Endpoints
|
|
110
|
-
# self.xx = EndPoint(self)
|
|
112
|
+
# self.xx = EndPoint(self.api, self)
|
|
111
113
|
|
|
112
114
|
|
|
113
115
|
class PolicyPlanner(App):
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
(c) 2023 Firemon
|
|
3
|
+
|
|
4
|
+
Unless required by applicable law or agreed to in writing, software
|
|
5
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
6
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7
|
+
See the License for the specific language governing permissions and
|
|
8
|
+
limitations under the License.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .changes import Changes
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"Changes",
|
|
15
|
+
]
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""
|
|
2
|
+
(c) 2023 Firemon
|
|
3
|
+
|
|
4
|
+
Unless required by applicable law or agreed to in writing, software
|
|
5
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
6
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7
|
+
See the License for the specific language governing permissions and
|
|
8
|
+
limitations under the License.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# Standard packages
|
|
12
|
+
import logging
|
|
13
|
+
from typing import Literal, Optional, Union
|
|
14
|
+
|
|
15
|
+
# Local packages
|
|
16
|
+
from firemon_api.core.app import App
|
|
17
|
+
from firemon_api.core.api import FiremonAPI
|
|
18
|
+
from firemon_api.core.endpoint import Endpoint
|
|
19
|
+
from firemon_api.core.query import Request
|
|
20
|
+
from firemon_api.core.response import BaseRecord
|
|
21
|
+
from firemon_api.apps.structure import RuleRecRequirement, ChangeRequestRequirement
|
|
22
|
+
|
|
23
|
+
log = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class OrchRuleRecommendation(BaseRecord):
|
|
27
|
+
_ep_name = "rulerec"
|
|
28
|
+
_is_domain_url = True
|
|
29
|
+
|
|
30
|
+
def __str__(self):
|
|
31
|
+
return str({self.__class__.__name__})
|
|
32
|
+
|
|
33
|
+
def __repr__(self):
|
|
34
|
+
return f"<{self.__class__.__name__}()>"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ChangeRequest(BaseRecord):
|
|
38
|
+
_ep_name = "change/request"
|
|
39
|
+
_is_domain_url = True
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Changes(Endpoint):
|
|
43
|
+
ep_name = "change/request"
|
|
44
|
+
_is_domain_url = True
|
|
45
|
+
|
|
46
|
+
def __init__(self, api: FiremonAPI, app: App, record=ChangeRequest):
|
|
47
|
+
super().__init__(api, app, record=record)
|
|
48
|
+
|
|
49
|
+
def filter(
|
|
50
|
+
self,
|
|
51
|
+
*args,
|
|
52
|
+
status: Literal["PENDING", "QUEUED", "COMPLETE", "ERROR"] = None,
|
|
53
|
+
**kwargs,
|
|
54
|
+
) -> list[ChangeRequest]:
|
|
55
|
+
if args:
|
|
56
|
+
_ = args
|
|
57
|
+
if kwargs:
|
|
58
|
+
_ = kwargs
|
|
59
|
+
|
|
60
|
+
if not status:
|
|
61
|
+
raise ValueError(
|
|
62
|
+
"filter must be passed `status`. Perhaps use all() instead."
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
filters = {"status": status}
|
|
66
|
+
|
|
67
|
+
req = Request(
|
|
68
|
+
base=self.url,
|
|
69
|
+
filters=filters,
|
|
70
|
+
key=self._ep["filter"],
|
|
71
|
+
session=self.api.session,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
ret = [self._response_loader(i) for i in req.get()]
|
|
75
|
+
return ret
|
|
76
|
+
|
|
77
|
+
def device_rule_rec(
|
|
78
|
+
self,
|
|
79
|
+
device_id: int,
|
|
80
|
+
requirement: RuleRecRequirement,
|
|
81
|
+
license_category: Optional[
|
|
82
|
+
Literal[
|
|
83
|
+
"LOG_SERVERS",
|
|
84
|
+
"ROUTERS",
|
|
85
|
+
"OPERATING_SYSTEMS",
|
|
86
|
+
"FIREWALLS",
|
|
87
|
+
"FIREWALL_MANAGER_MODULES",
|
|
88
|
+
"EDGE_DEVICES",
|
|
89
|
+
"GENERIC_DEVICES",
|
|
90
|
+
"TRAFFIC_MANAGER_MODULES",
|
|
91
|
+
"UNKNOWN",
|
|
92
|
+
"SALES_ONLY_SMLO_HA",
|
|
93
|
+
"SALES_ONLY_SMSO_HA",
|
|
94
|
+
"SALES_ONLY_SMM_HA",
|
|
95
|
+
"POLICY_PLANNER",
|
|
96
|
+
"RISK",
|
|
97
|
+
"POLICY_OPTIMIZER",
|
|
98
|
+
"INSIGHT",
|
|
99
|
+
"GLOBAL_POLICY_CONTROLLER",
|
|
100
|
+
"AUTOMATION",
|
|
101
|
+
"LICENSE_NOT_REQUIRED",
|
|
102
|
+
]
|
|
103
|
+
] = None,
|
|
104
|
+
strategy: Literal["NAME_PATTERN", "HITCOUNT", "REFERENCES", "NONE"] = None,
|
|
105
|
+
force_tiebreak: Optional[bool] = None,
|
|
106
|
+
pattern: Optional[str] = None,
|
|
107
|
+
# Leaving these commented out. They seem redundant and don't make sense.
|
|
108
|
+
# device_ids: list[int] = [],
|
|
109
|
+
# device_group_id: int = None,
|
|
110
|
+
) -> OrchRuleRecommendation:
|
|
111
|
+
key = f"change/device/{device_id}/rulerec"
|
|
112
|
+
filters = {}
|
|
113
|
+
if license_category:
|
|
114
|
+
filters["licenseCategory"] = license_category
|
|
115
|
+
if strategy:
|
|
116
|
+
filters["strategy"] = strategy
|
|
117
|
+
if force_tiebreak:
|
|
118
|
+
filters["forceTiebreak"] = force_tiebreak
|
|
119
|
+
if pattern:
|
|
120
|
+
filters["pattern"] = pattern
|
|
121
|
+
req = Request(
|
|
122
|
+
base=self.domain_url,
|
|
123
|
+
key=key,
|
|
124
|
+
filters=filters,
|
|
125
|
+
session=self.session,
|
|
126
|
+
)
|
|
127
|
+
return OrchRuleRecommendation(req.put(json=requirement), self)
|
|
128
|
+
|
|
129
|
+
def rule_rec(
|
|
130
|
+
self,
|
|
131
|
+
requirement: ChangeRequestRequirement,
|
|
132
|
+
license_category: Optional[
|
|
133
|
+
Literal[
|
|
134
|
+
"LOG_SERVERS",
|
|
135
|
+
"ROUTERS",
|
|
136
|
+
"OPERATING_SYSTEMS",
|
|
137
|
+
"FIREWALLS",
|
|
138
|
+
"FIREWALL_MANAGER_MODULES",
|
|
139
|
+
"EDGE_DEVICES",
|
|
140
|
+
"GENERIC_DEVICES",
|
|
141
|
+
"TRAFFIC_MANAGER_MODULES",
|
|
142
|
+
"UNKNOWN",
|
|
143
|
+
"SALES_ONLY_SMLO_HA",
|
|
144
|
+
"SALES_ONLY_SMSO_HA",
|
|
145
|
+
"SALES_ONLY_SMM_HA",
|
|
146
|
+
"POLICY_PLANNER",
|
|
147
|
+
"RISK",
|
|
148
|
+
"POLICY_OPTIMIZER",
|
|
149
|
+
"INSIGHT",
|
|
150
|
+
"GLOBAL_POLICY_CONTROLLER",
|
|
151
|
+
"AUTOMATION",
|
|
152
|
+
"LICENSE_NOT_REQUIRED",
|
|
153
|
+
]
|
|
154
|
+
] = None,
|
|
155
|
+
strategy: Literal["NAME_PATTERN", "HITCOUNT", "REFERENCES", "NONE"] = None,
|
|
156
|
+
force_tiebreak: Optional[bool] = None,
|
|
157
|
+
pattern: Optional[str] = None,
|
|
158
|
+
device_ids: Union[int, list[int]] = [],
|
|
159
|
+
device_group_id: int = None,
|
|
160
|
+
) -> OrchRuleRecommendation:
|
|
161
|
+
key = f"change/rulerec"
|
|
162
|
+
filters = {}
|
|
163
|
+
if license_category:
|
|
164
|
+
filters["licenseCategory"] = license_category
|
|
165
|
+
if strategy:
|
|
166
|
+
filters["strategy"] = strategy
|
|
167
|
+
if force_tiebreak:
|
|
168
|
+
filters["forceTiebreak"] = force_tiebreak
|
|
169
|
+
if pattern:
|
|
170
|
+
filters["pattern"] = pattern
|
|
171
|
+
if device_ids:
|
|
172
|
+
filters["deviceId"] = device_ids
|
|
173
|
+
if device_group_id:
|
|
174
|
+
filters["deviceGroupId"] = device_group_id
|
|
175
|
+
req = Request(
|
|
176
|
+
base=self.domain_url,
|
|
177
|
+
key=key,
|
|
178
|
+
filters=filters,
|
|
179
|
+
session=self.session,
|
|
180
|
+
)
|
|
181
|
+
return OrchRuleRecommendation(req.post(json=requirement), self)
|
|
@@ -17,35 +17,15 @@ from typing import Optional, TypedDict
|
|
|
17
17
|
from firemon_api.core.app import App
|
|
18
18
|
from firemon_api.core.api import FiremonAPI
|
|
19
19
|
from firemon_api.core.endpoint import Endpoint
|
|
20
|
-
from firemon_api.core.response import Record
|
|
20
|
+
from firemon_api.core.response import BaseRecord, Record
|
|
21
21
|
from firemon_api.core.query import Request, RequestResponse
|
|
22
|
+
from firemon_api.apps.structure import PolicyPlanRequirement
|
|
22
23
|
from .siql import SiqlPP
|
|
23
24
|
from .policyplan import Changes, Requirements
|
|
24
25
|
|
|
25
26
|
log = logging.getLogger(__name__)
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
class PolicyPlanRequirementVars(TypedDict, total=False):
|
|
29
|
-
deviceGroupId: int
|
|
30
|
-
expiration: str # format "YYYY-MM-DDTHH:mm:ss+0000"
|
|
31
|
-
review: str # format "YYYY-MM-DDTHH:mm:ss+0000"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class PolicyPlanRequirement(TypedDict, total=False):
|
|
35
|
-
requirementType: str # "RULE" / "CLONE" / "??"
|
|
36
|
-
app: list[str]
|
|
37
|
-
destinations: list[str]
|
|
38
|
-
services: list[str]
|
|
39
|
-
sources: list[str]
|
|
40
|
-
users: list[str]
|
|
41
|
-
childKey: str # "add_access" / "??"
|
|
42
|
-
action: str # "ACCEPT" / "DROP"
|
|
43
|
-
urlMatchers: list[str]
|
|
44
|
-
profiles: list[str]
|
|
45
|
-
addressesToClone: list[str] # used for "CLONE" type and the list is a single IP
|
|
46
|
-
variables: PolicyPlanRequirementVars
|
|
47
|
-
|
|
48
|
-
|
|
49
29
|
class PacketTaskError(Exception):
|
|
50
30
|
pass
|
|
51
31
|
|
|
@@ -296,7 +276,7 @@ class PacketTasks(Endpoint):
|
|
|
296
276
|
return packet_task
|
|
297
277
|
|
|
298
278
|
|
|
299
|
-
class Packet(
|
|
279
|
+
class Packet(BaseRecord):
|
|
300
280
|
"""Represents the Packet/Ticket record"""
|
|
301
281
|
|
|
302
282
|
_ep_name = "packet"
|
|
@@ -314,17 +294,6 @@ class Packet(Record):
|
|
|
314
294
|
|
|
315
295
|
self.pt = PacketTasks(self._app.api, self, self.id)
|
|
316
296
|
|
|
317
|
-
def save(self) -> None:
|
|
318
|
-
"""Someday... maybe"""
|
|
319
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
320
|
-
|
|
321
|
-
def update(self) -> None:
|
|
322
|
-
"""Someday... maybe"""
|
|
323
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
324
|
-
|
|
325
|
-
def delete(self) -> None:
|
|
326
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
327
|
-
|
|
328
297
|
def refresh(self):
|
|
329
298
|
key = f"{self.id}"
|
|
330
299
|
req = Request(
|
|
@@ -16,14 +16,14 @@ from typing import Optional
|
|
|
16
16
|
from firemon_api.core.app import App
|
|
17
17
|
from firemon_api.core.api import FiremonAPI
|
|
18
18
|
from firemon_api.core.endpoint import Endpoint
|
|
19
|
-
from firemon_api.core.response import
|
|
19
|
+
from firemon_api.core.response import BaseRecord
|
|
20
20
|
from firemon_api.core.query import Request, RequestResponse
|
|
21
21
|
from firemon_api.core.utils import _find_dicts_with_key
|
|
22
22
|
|
|
23
23
|
log = logging.getLogger(__name__)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
class Task(
|
|
26
|
+
class Task(BaseRecord):
|
|
27
27
|
_ep_name = None
|
|
28
28
|
_is_domain_url = False
|
|
29
29
|
|
|
@@ -31,15 +31,6 @@ class Task(Record):
|
|
|
31
31
|
self._name = name
|
|
32
32
|
super().__init__(config, app)
|
|
33
33
|
|
|
34
|
-
def save(self) -> None:
|
|
35
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
36
|
-
|
|
37
|
-
def update(self) -> None:
|
|
38
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
39
|
-
|
|
40
|
-
def delete(self) -> None:
|
|
41
|
-
raise NotImplementedError("Writes are not supported for this Record.")
|
|
42
|
-
|
|
43
34
|
def template(self) -> dict:
|
|
44
35
|
"""Get default template format for a task.
|
|
45
36
|
|
|
@@ -17,7 +17,7 @@ from firemon_api.core.api import FiremonAPI
|
|
|
17
17
|
from firemon_api.core.endpoint import Endpoint
|
|
18
18
|
from firemon_api.core.response import Record
|
|
19
19
|
from firemon_api.core.query import Request, RequestResponse, RequestError
|
|
20
|
-
from .packets import Packets
|
|
20
|
+
from .packets import Packets
|
|
21
21
|
|
|
22
22
|
log = logging.getLogger(__name__)
|
|
23
23
|
|
|
@@ -13,6 +13,7 @@ from .centralsyslogs import CentralSyslogs, CentralSyslog
|
|
|
13
13
|
from .collectionconfigs import CollectionConfigs, CollectionConfig
|
|
14
14
|
from .collectors import Collectors, Collector, CollectorGroups, CollectorGroup
|
|
15
15
|
from .deviceclusters import DeviceCluster, DeviceClusters
|
|
16
|
+
from .devicegroups import DeviceGroup, DeviceGroups
|
|
16
17
|
from .devicepacks import DevicePacks, DevicePack
|
|
17
18
|
from .devices import Devices, Device
|
|
18
19
|
from .elasticsearch import ElasticSearch
|
|
@@ -36,6 +37,8 @@ __all__ = [
|
|
|
36
37
|
"Collector",
|
|
37
38
|
"CollectorGroups",
|
|
38
39
|
"CollectorGroup",
|
|
40
|
+
"DeviceGroups",
|
|
41
|
+
"DeviceGroup",
|
|
39
42
|
"DevicePacks",
|
|
40
43
|
"DevicePack",
|
|
41
44
|
"Devices",
|
|
@@ -15,13 +15,13 @@ from typing import Optional
|
|
|
15
15
|
|
|
16
16
|
# Local packages
|
|
17
17
|
from firemon_api.core.app import App
|
|
18
|
-
from firemon_api.core.response import
|
|
18
|
+
from firemon_api.core.response import BaseRecord
|
|
19
19
|
from firemon_api.core.query import Request, RequestResponse
|
|
20
20
|
|
|
21
21
|
log = logging.getLogger(__name__)
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
class AccessPathEvent(
|
|
24
|
+
class AccessPathEvent(BaseRecord):
|
|
25
25
|
"""AccessPathEvent"""
|
|
26
26
|
|
|
27
27
|
_ep_name = "apa"
|
|
@@ -34,17 +34,8 @@ class AccessPathEvent(Record):
|
|
|
34
34
|
def _url_create(self):
|
|
35
35
|
return self._url
|
|
36
36
|
|
|
37
|
-
def save(self) -> None:
|
|
38
|
-
raise NotImplementedError("Writes are not supported.")
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
raise NotImplementedError("Writes are not supported.")
|
|
42
|
-
|
|
43
|
-
def delete(self) -> None:
|
|
44
|
-
raise NotImplementedError("Writes are not supported.")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class AccessPath(Record):
|
|
38
|
+
class AccessPath(BaseRecord):
|
|
48
39
|
"""AccessPath"""
|
|
49
40
|
|
|
50
41
|
_ep_name = "apa"
|
|
@@ -103,15 +94,6 @@ class AccessPath(Record):
|
|
|
103
94
|
path["packet_result"] = event.get("ipPacketResult", {})
|
|
104
95
|
self.paths.append(path)
|
|
105
96
|
|
|
106
|
-
def save(selfr) -> None:
|
|
107
|
-
raise NotImplementedError("Writes are not supported.")
|
|
108
|
-
|
|
109
|
-
def update(self) -> None:
|
|
110
|
-
raise NotImplementedError("Writes are not supported.")
|
|
111
|
-
|
|
112
|
-
def delete(self) -> None:
|
|
113
|
-
raise NotImplementedError("Writes are not supported.")
|
|
114
|
-
|
|
115
97
|
def get_graphml(self) -> RequestResponse:
|
|
116
98
|
req = Request(
|
|
117
99
|
base=self._url,
|