algosec-appviz 0.0.4__tar.gz → 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: algosec_appviz
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: AlgoSec AppViz Library
5
5
  Home-page: https://github.com/bogdan-iot/algosec-appviz
6
6
  License: LICENSE
@@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
6
6
  name = "algosec_appviz"
7
7
  repository = "https://github.com/bogdan-iot/algosec-appviz"
8
8
  documentation = "https://github.com/bogdan-iot/algosec-appviz/blob/master/README.md"
9
- version = "0.0.4"
9
+ version = "0.0.5"
10
10
  license = "LICENSE"
11
11
  readme = "README.md"
12
12
  description = "AlgoSec AppViz Library"
@@ -38,6 +38,21 @@ class AppViz:
38
38
  self._token_type = response.json()['token_type']
39
39
  self._token = response.json()['access_token']
40
40
 
41
+ def create_application(self, name=None, **kwargs):
42
+ if not name:
43
+ raise ValueError("Name is required")
44
+
45
+ body = {
46
+ 'name': name,
47
+ **kwargs
48
+ }
49
+
50
+ result = self._make_api_call('POST',
51
+ '/BusinessFlow/rest/v1/applications/new',
52
+ body=body)
53
+
54
+ return result
55
+
41
56
  def create_network_object(self, name=None, obj_type=None, content=None, **kwargs):
42
57
  valid_object_types = ['Range', 'Host', 'Group', 'Abstract']
43
58
 
@@ -59,7 +74,7 @@ class AppViz:
59
74
  '/BusinessFlow/rest/v1/network_objects/new',
60
75
  body=body)
61
76
 
62
- print(result)
77
+ return result
63
78
 
64
79
  def get_applications(self):
65
80
  response = self._make_api_call('GET',
@@ -92,6 +107,6 @@ class AppViz:
92
107
  elif method.lower() == 'post':
93
108
  response = requests.post(self.url + url_path, headers=headers, json=body, params=params)
94
109
  else:
95
- raise AssertionError("Invalid method, must be: 'GET' or 'POST'")
110
+ raise ValueError("Invalid method, must be: 'GET' or 'POST'")
96
111
 
97
112
  return response.json()
File without changes
File without changes