algosec-appviz 0.0.10__py3-none-any.whl → 0.0.13__py3-none-any.whl

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.
algosec_appviz/main.py CHANGED
@@ -50,6 +50,12 @@ class AppViz:
50
50
  self._token_expires = datetime.now() + timedelta(seconds=response.json()['expires_in'])
51
51
 
52
52
  def create_application(self, name=None, **kwargs):
53
+ """
54
+ Create an application in AppViz
55
+ :param name: Application Name
56
+ :param kwargs: Extra information
57
+ :return:
58
+ """
53
59
  if not name:
54
60
  raise ValueError("Name is required")
55
61
 
@@ -64,7 +70,45 @@ class AppViz:
64
70
 
65
71
  return result
66
72
 
73
+ def update_application_tags(self, operation, app_id, tag_list):
74
+ """
75
+ Update the tags of an application
76
+ :param operation: add/remove
77
+ :param app_id: Application revision ID
78
+ :param tag_list: List of tags to be added/removed
79
+ :return:
80
+ """
81
+ valid_operations = ['add', 'remove']
82
+ if operation.lower() not in valid_operations:
83
+ raise ValueError(f"Invalid operation, must be one of: {', '.join(valid_operations)}")
84
+
85
+ if not app_id:
86
+ raise ValueError("Application revision ID is mandatory")
87
+
88
+ if not tag_list:
89
+ print("Nothing to udpate")
90
+
91
+ if operation.lower() == 'add':
92
+ body = {'addLabels': tag_list}
93
+ else:
94
+ body = {'removeLabels': tag_list}
95
+
96
+ result = self._make_api_call('POST',
97
+ f'/BusinessFlow/rest/v1/applications/{app_id}/labels',
98
+ body=body)
99
+
100
+ return result
101
+
67
102
  def create_network_object(self, name=None, obj_type=None, content=None, **kwargs):
103
+ """
104
+ :param name: Name of the new object
105
+ :param obj_type: Type of the new object (valid options: Host/Range/Group/Abstract
106
+ :param content: Contents of the new object
107
+ Example for group creation: [{'name': <existing object 1>}, {'name': <existing object 2>}]
108
+ Example for host creation:
109
+ :param kwargs:
110
+ :return:
111
+ """""
68
112
  valid_object_types = ['Range', 'Host', 'Group', 'Abstract']
69
113
 
70
114
  if not name:
@@ -105,6 +149,12 @@ class AppViz:
105
149
 
106
150
  return result
107
151
 
152
+ def get_object_by_id(self, obj_id):
153
+ response = self._make_api_call('GET',
154
+ f'/BusinessFlow/rest/v1/network_objects/{obj_id}')
155
+
156
+ return MyDict(response)
157
+
108
158
  def update_network_object(self, obj_id=None, **kwargs):
109
159
  """
110
160
  Updates a network object in AppViz
@@ -1,19 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: algosec_appviz
3
- Version: 0.0.10
3
+ Version: 0.0.13
4
4
  Summary: AlgoSec AppViz Library
5
- Home-page: https://github.com/bogdan-iot/algosec-appviz
6
5
  License: LICENSE
6
+ License-File: LICENSE
7
7
  Author: Bogdan Radu
8
- Requires-Python: >=3.8.0
8
+ Requires-Python: >=3.9.0
9
9
  Classifier: License :: Other/Proprietary License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
16
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
17
  Requires-Dist: mydict (==2.1.0)
18
18
  Requires-Dist: python-dotenv (>1.0.0)
19
19
  Project-URL: Documentation, https://github.com/bogdan-iot/algosec-appviz/blob/master/README.md
@@ -0,0 +1,7 @@
1
+ algosec_appviz/__init__.py,sha256=epwLWpezNwfYP0Zuqk32rWEvNeloAKzbrRFi9tzlsXo,46
2
+ algosec_appviz/environment.py,sha256=ycrVSpR6oLpj9p54SvDdy0nqwS9IwHAh-1x-zOaTQ5I,1775
3
+ algosec_appviz/main.py,sha256=ON-6oXux1ZpDjanNCTwb3Z2gatMNpxfm27pG8Shq7pw,8892
4
+ algosec_appviz-0.0.13.dist-info/METADATA,sha256=Iwl54-omswJGvXd6vYsc0PCww_vgfWXrT9Lx3Cl_1SM,1766
5
+ algosec_appviz-0.0.13.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
6
+ algosec_appviz-0.0.13.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
7
+ algosec_appviz-0.0.13.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- algosec_appviz/__init__.py,sha256=epwLWpezNwfYP0Zuqk32rWEvNeloAKzbrRFi9tzlsXo,46
2
- algosec_appviz/environment.py,sha256=ycrVSpR6oLpj9p54SvDdy0nqwS9IwHAh-1x-zOaTQ5I,1775
3
- algosec_appviz/main.py,sha256=4rUcspAZtjWgzKKN-PznQUmxsp-jGMQY5Fz_TBBerMw,7132
4
- algosec_appviz-0.0.10.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
5
- algosec_appviz-0.0.10.dist-info/METADATA,sha256=fjdGcU5_4MRTMLw2Cru5dh7IRKpzPKruMek8iWAvfgs,1799
6
- algosec_appviz-0.0.10.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- algosec_appviz-0.0.10.dist-info/RECORD,,