splunk-soar-sdk 2.0.1__py3-none-any.whl → 2.1.1__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.
- soar_sdk/app.py +15 -2
- soar_sdk/decorators/action.py +3 -0
- soar_sdk/meta/actions.py +5 -0
- {splunk_soar_sdk-2.0.1.dist-info → splunk_soar_sdk-2.1.1.dist-info}/METADATA +1 -1
- {splunk_soar_sdk-2.0.1.dist-info → splunk_soar_sdk-2.1.1.dist-info}/RECORD +8 -8
- {splunk_soar_sdk-2.0.1.dist-info → splunk_soar_sdk-2.1.1.dist-info}/WHEEL +0 -0
- {splunk_soar_sdk-2.0.1.dist-info → splunk_soar_sdk-2.1.1.dist-info}/entry_points.txt +0 -0
- {splunk_soar_sdk-2.0.1.dist-info → splunk_soar_sdk-2.1.1.dist-info}/licenses/LICENSE +0 -0
soar_sdk/app.py
CHANGED
|
@@ -241,6 +241,7 @@ class App:
|
|
|
241
241
|
view_template: Optional[str] = None,
|
|
242
242
|
versions: str = "EQ(*)",
|
|
243
243
|
summary_type: Optional[type[ActionOutput]] = None,
|
|
244
|
+
enable_concurrency_lock: bool = False,
|
|
244
245
|
) -> Action:
|
|
245
246
|
"""Dynamically register an action function defined in another module.
|
|
246
247
|
|
|
@@ -301,6 +302,7 @@ class App:
|
|
|
301
302
|
versions: Version constraint string for when this action is available.
|
|
302
303
|
Defaults to "EQ(*)" (all versions).
|
|
303
304
|
summary_type: Pydantic model class for structuring action summary output.
|
|
305
|
+
enable_concurrency_lock: Whether to enable a concurrency lock for this action. Defaults to False.
|
|
304
306
|
|
|
305
307
|
Returns:
|
|
306
308
|
The registered Action instance with all metadata and handlers configured.
|
|
@@ -356,6 +358,7 @@ class App:
|
|
|
356
358
|
view_handler=view_handler,
|
|
357
359
|
versions=versions,
|
|
358
360
|
summary_type=summary_type,
|
|
361
|
+
enable_concurrency_lock=enable_concurrency_lock,
|
|
359
362
|
)(action)
|
|
360
363
|
|
|
361
364
|
def _resolve_function_import(self, action_path: str) -> Callable:
|
|
@@ -421,6 +424,7 @@ class App:
|
|
|
421
424
|
view_handler: Optional[Callable] = None,
|
|
422
425
|
versions: str = "EQ(*)",
|
|
423
426
|
summary_type: Optional[type[ActionOutput]] = None,
|
|
427
|
+
enable_concurrency_lock: bool = False,
|
|
424
428
|
) -> ActionDecorator:
|
|
425
429
|
"""Decorator for registering an action function.
|
|
426
430
|
|
|
@@ -439,6 +443,7 @@ class App:
|
|
|
439
443
|
view_handler=view_handler,
|
|
440
444
|
versions=versions,
|
|
441
445
|
summary_type=summary_type,
|
|
446
|
+
enable_concurrency_lock=enable_concurrency_lock,
|
|
442
447
|
)
|
|
443
448
|
|
|
444
449
|
def test_connectivity(self) -> ConnectivityTestDecorator:
|
|
@@ -642,9 +647,17 @@ class App:
|
|
|
642
647
|
statuses = []
|
|
643
648
|
for item in result:
|
|
644
649
|
statuses.append(
|
|
645
|
-
App._adapt_action_result(
|
|
650
|
+
App._adapt_action_result(
|
|
651
|
+
item, actions_manager, action_params, message, summary
|
|
652
|
+
)
|
|
653
|
+
)
|
|
654
|
+
# Handle empty list/iterator case
|
|
655
|
+
if not statuses:
|
|
656
|
+
result = ActionOutput(
|
|
657
|
+
status=True, message=message or "Action completed successfully"
|
|
646
658
|
)
|
|
647
|
-
|
|
659
|
+
else:
|
|
660
|
+
return all(statuses)
|
|
648
661
|
|
|
649
662
|
if isinstance(result, ActionOutput):
|
|
650
663
|
output_dict = result.dict(by_alias=True)
|
soar_sdk/decorators/action.py
CHANGED
|
@@ -42,6 +42,7 @@ class ActionDecorator:
|
|
|
42
42
|
view_handler: Optional[Callable] = None,
|
|
43
43
|
versions: str = "EQ(*)",
|
|
44
44
|
summary_type: Optional[type[ActionOutput]] = None,
|
|
45
|
+
enable_concurrency_lock: bool = False,
|
|
45
46
|
) -> None:
|
|
46
47
|
self.app = app
|
|
47
48
|
self.name = name
|
|
@@ -55,6 +56,7 @@ class ActionDecorator:
|
|
|
55
56
|
self.view_handler = view_handler
|
|
56
57
|
self.versions = versions
|
|
57
58
|
self.summary_type = summary_type
|
|
59
|
+
self.enable_concurrency_lock = enable_concurrency_lock
|
|
58
60
|
|
|
59
61
|
def __call__(self, function: Callable) -> Action:
|
|
60
62
|
"""Decorator for the action handling function.
|
|
@@ -152,6 +154,7 @@ class ActionDecorator:
|
|
|
152
154
|
versions=self.versions,
|
|
153
155
|
view_handler=self.view_handler,
|
|
154
156
|
summary_type=self.summary_type,
|
|
157
|
+
enable_concurrency_lock=self.enable_concurrency_lock,
|
|
155
158
|
)
|
|
156
159
|
|
|
157
160
|
self.app.actions_manager.set_action(action_identifier, inner)
|
soar_sdk/meta/actions.py
CHANGED
|
@@ -22,6 +22,7 @@ class ActionMeta(BaseModel):
|
|
|
22
22
|
output: Type[ActionOutput] = Field(default=ActionOutput) # noqa: UP006
|
|
23
23
|
view_handler: Optional[Callable] = None
|
|
24
24
|
summary_type: Optional[Type[ActionOutput]] = Field(default=None, exclude=True) # noqa: UP006
|
|
25
|
+
enable_concurrency_lock: bool = False
|
|
25
26
|
|
|
26
27
|
def dict(self, *args: Any, **kwargs: Any) -> dict[str, Any]: # noqa: ANN401
|
|
27
28
|
"""Serializes the action metadata to a dictionary."""
|
|
@@ -52,4 +53,8 @@ class ActionMeta(BaseModel):
|
|
|
52
53
|
# Remove view_handler from the output since in render
|
|
53
54
|
data.pop("view_handler", None)
|
|
54
55
|
|
|
56
|
+
if self.enable_concurrency_lock:
|
|
57
|
+
data["lock"] = {"enabled": True}
|
|
58
|
+
data.pop("enable_concurrency_lock", None)
|
|
59
|
+
|
|
55
60
|
return data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: splunk-soar-sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: The official framework for developing and testing Splunk SOAR Apps
|
|
5
5
|
Project-URL: Homepage, https://github.com/phantomcyber/splunk-soar-sdk
|
|
6
6
|
Project-URL: Documentation, https://github.com/phantomcyber/splunk-soar-sdk
|
|
@@ -2,7 +2,7 @@ soar_sdk/__init__.py,sha256=RzAng-ARqpK01SY82lNy4uYJFVG0yW6Q3CccEqbToJ4,726
|
|
|
2
2
|
soar_sdk/abstract.py,sha256=jGXs2Fv5TRpnh5Duz3mWjY8_DAOpY4RSSzvw_z4XN4I,7950
|
|
3
3
|
soar_sdk/action_results.py,sha256=7uEl1KidC2gkNOuBzOq2_3EiAGfRQYrDYD3CR-G6DKg,10116
|
|
4
4
|
soar_sdk/actions_manager.py,sha256=wJCyfzkI_6OKZ-Kmll4vRJpGvYdL93Uw-JyEEGnKcw0,5779
|
|
5
|
-
soar_sdk/app.py,sha256
|
|
5
|
+
soar_sdk/app.py,sha256=-Iq_0btBwZwRksSfrv7gzlBFJBblNM8VKZK6_rgMGog,33208
|
|
6
6
|
soar_sdk/app_cli_runner.py,sha256=fJoozhyAt7QUMuc02nE5RL_InpsjQBpr6U4rF9sey3E,11627
|
|
7
7
|
soar_sdk/app_client.py,sha256=0r3jIvMM8szCEHXOgRu07VaovKH96pZut5rn2GfYcsc,6275
|
|
8
8
|
soar_sdk/asset.py,sha256=deS8_B5hr7W2fED8_6wUpVriRgiQ5r8TkGVHiasIaro,10666
|
|
@@ -49,14 +49,14 @@ soar_sdk/code_renderers/renderer.py,sha256=oDlmU-MzDqpc4Yq6zupoT4XN-vRjgL4UV5lOG
|
|
|
49
49
|
soar_sdk/code_renderers/toml_renderer.py,sha256=-zP8UzlYMCVVA5ex9slaNLeFTu4xLjkv88YLmRNLrTM,1505
|
|
50
50
|
soar_sdk/code_renderers/templates/pyproject.toml.jinja,sha256=Ti6A5kWMb902Lbd1kmw8qPgVDPNNzlV6rd0pcVEbVUo,3917
|
|
51
51
|
soar_sdk/decorators/__init__.py,sha256=ttvapTczeQpReZVYgjTw4qnEqKd7b8pR7lNaCpO0npQ,513
|
|
52
|
-
soar_sdk/decorators/action.py,sha256=
|
|
52
|
+
soar_sdk/decorators/action.py,sha256=WgkOtlfUpRGkFv1Be1ycRm3s_1UYabCJqoI5MMFWsi8,6304
|
|
53
53
|
soar_sdk/decorators/make_request.py,sha256=W_ltGvryTvdKomiJ8gL7rE_KVc1VVodhFYstGxB8d4Q,5527
|
|
54
54
|
soar_sdk/decorators/on_poll.py,sha256=xdT0QSa_dnh37XdJNGW-DAZsb9oQO5tjxPbIQmWpaZs,8232
|
|
55
55
|
soar_sdk/decorators/test_connectivity.py,sha256=8uXMD4NW5bokpsAfBctUrfOR4K_geYLEZUY0Y6uI6aU,3568
|
|
56
56
|
soar_sdk/decorators/view_handler.py,sha256=jhBzbJcokWOeUWR4_orDRWTXiiVwE9RZdRSvNUYF3S0,7362
|
|
57
57
|
soar_sdk/decorators/webhook.py,sha256=Pde0MjxC2kckpxoKb3m4WVfLWtiFAAzAwZe5AF5VIbE,2400
|
|
58
58
|
soar_sdk/meta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
soar_sdk/meta/actions.py,sha256
|
|
59
|
+
soar_sdk/meta/actions.py,sha256=L64T9DaWGiqjS2EpB72kO-63gPuVyCJ-lYlaKAvT2uM,2394
|
|
60
60
|
soar_sdk/meta/adapters.py,sha256=KjSYIUtkCz2eesA_vhsNCjfi5C-Uz71tbSuDIjhuB8U,1112
|
|
61
61
|
soar_sdk/meta/app.py,sha256=rwgoFfIFnLutLB9PF1kR7X1neKs175VA0Xx4KpJ6c7I,1765
|
|
62
62
|
soar_sdk/meta/datatypes.py,sha256=piR-oBVAATiRciXSdVE7XaqjUZTgSaOvTEqcOcNvCS0,795
|
|
@@ -96,8 +96,8 @@ soar_sdk/views/components/pie_chart.py,sha256=LVTeHVJN6nf2vjUs9y7PDBhS0U1fKW750l
|
|
|
96
96
|
soar_sdk/webhooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
97
|
soar_sdk/webhooks/models.py,sha256=-rjuFA9cRX5zTLp7cHSHVTkt5eVJD6BdESGbj_qkyHI,4540
|
|
98
98
|
soar_sdk/webhooks/routing.py,sha256=BKbURSrBPdOTS5UFL-mHzFEr-Fj04mJMx9KeiPrZ2VQ,6872
|
|
99
|
-
splunk_soar_sdk-2.
|
|
100
|
-
splunk_soar_sdk-2.
|
|
101
|
-
splunk_soar_sdk-2.
|
|
102
|
-
splunk_soar_sdk-2.
|
|
103
|
-
splunk_soar_sdk-2.
|
|
99
|
+
splunk_soar_sdk-2.1.1.dist-info/METADATA,sha256=DX2tSp9QhI815naidp9yRobLgAyhnu5LvbHljrRm_Zc,7361
|
|
100
|
+
splunk_soar_sdk-2.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
101
|
+
splunk_soar_sdk-2.1.1.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
|
|
102
|
+
splunk_soar_sdk-2.1.1.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
|
|
103
|
+
splunk_soar_sdk-2.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|