splunk-soar-sdk 1.6.3__py3-none-any.whl → 2.0.0__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.
@@ -150,19 +150,6 @@ class ActionOutput(BaseModel):
150
150
  Nested ActionOutput classes are supported for complex data structures.
151
151
  """
152
152
 
153
- def generate_action_summary_message(self) -> str:
154
- """Generate a summary message for the action output.
155
-
156
- This method provides a human-readable summary of the action results,
157
- which appears when running the action in a SOAR playbook or container.
158
-
159
- Returns:
160
- A string summarizing the action output.
161
-
162
- .. deprecated:: 1.3.0
163
- """
164
- return "Action completed successfully."
165
-
166
153
  @classmethod
167
154
  def _to_json_schema(
168
155
  cls, parent_datapath: str = "action_result.data.*"
@@ -237,13 +224,13 @@ class ActionOutput(BaseModel):
237
224
  yield schema_field
238
225
 
239
226
 
240
- class GenericActionOutput(ActionOutput):
241
- """Output class for generic actions.
227
+ class MakeRequestOutput(ActionOutput):
228
+ """Output class for ``make request`` action.
242
229
 
243
230
  This class extends the `ActionOutput` class and adds a status_code and response_body field. You can use this class as is or extend it to add more fields.
244
231
 
245
232
  Example:
246
- >>> class CustomGenericActionOutput(GenericActionOutput):
233
+ >>> class CustomMakeRequestOutput(MakeRequestOutput):
247
234
  ... error: str = OutputField(example_values=["Invalid credentials"])
248
235
 
249
236
  Note:
soar_sdk/app.py CHANGED
@@ -12,7 +12,6 @@ from soar_sdk.input_spec import InputSpecification
12
12
  from soar_sdk.compat import (
13
13
  MIN_PHANTOM_VERSION,
14
14
  PythonVersion,
15
- remove_when_soar_newer_than,
16
15
  )
17
16
  from soar_sdk.shims.phantom_common.app_interface.app_interface import SoarRestClient
18
17
  from soar_sdk.shims.phantom_common.encryption.encryption_manager_factory import (
@@ -39,7 +38,7 @@ from soar_sdk.decorators import (
39
38
  ViewHandlerDecorator,
40
39
  OnPollDecorator,
41
40
  WebhookDecorator,
42
- GenericActionDecorator,
41
+ MakeRequestDecorator,
43
42
  )
44
43
 
45
44
 
@@ -516,33 +515,33 @@ class App:
516
515
  """
517
516
  return ViewHandlerDecorator(self, template=template)
518
517
 
519
- def generic_action(
518
+ def make_request(
520
519
  self, output_class: Optional[type[ActionOutput]] = None
521
- ) -> GenericActionDecorator:
522
- """Decorator for registering a generic action function.
520
+ ) -> MakeRequestDecorator:
521
+ """Decorator for registering a ``make request`` action function.
523
522
 
524
- This decorator marks a function as the generic action for the app. Generic action is used to call any endpoint of the underlying API service this app implements.
525
- Only one generic action is allowed per app. The function you define needs to accept at least one parameter of type `GenericActionParams` and can accept any other parameters you need.
523
+ This decorator marks a function as the ``make request`` action for the app. ``make request`` is used to call any endpoint of the underlying API service this app implements.
524
+ Only one ``make request`` action is allowed per app. The function you define needs to accept at least one parameter of type :class:`~soar_sdk.params.MakeRequestParams` and can accept any other parameters you need.
526
525
  Other useful parameters to accept are the SOARClient and the asset.
527
526
 
528
527
  Returns:
529
- GenericActionDecorator: A decorator instance that handles generic action registration.
528
+ MakeRequestActionDecorator: A decorator instance that handles ``make request`` action registration.
530
529
 
531
530
  Example:
532
- >>> @app.generic_action()
531
+ >>> @app.make_request()
533
532
  ... def http_action(
534
- ... self, params: GenericActionParams, asset: Asset
535
- ... ) -> GenericActionOutput:
533
+ ... self, params: MakeRequestParams, asset: Asset
534
+ ... ) -> MakeRequestOutput:
536
535
  ... logger.info(f"testing connectivity against {asset.base_url}")
537
- ... return GenericActionOutput(
536
+ ... return MakeRequestOutput(
538
537
  ... status_code=200,
539
538
  ... response_body=f"Base url is {asset.base_url}",
540
539
  ... )
541
540
 
542
541
  Note:
543
- The generic action function should return either a GenericActionOutput object or an output class derived from ActionOutput/GenericActionOutput.
542
+ The ``make request`` action function should return either a :class:`~soar_sdk.action_results.MakeRequestOutput` object or of an output class derived from it.
544
543
  """
545
- return GenericActionDecorator(self, output_class=output_class)
544
+ return MakeRequestDecorator(self, output_class=output_class)
546
545
 
547
546
  @staticmethod
548
547
  def _validate_params_class(
@@ -652,11 +651,7 @@ class App:
652
651
  param_dict = action_params.dict() if action_params else None
653
652
 
654
653
  if not message:
655
- remove_when_soar_newer_than(
656
- "7.0.0",
657
- 'Setting action_result.message in this way was deprecated in SDK 1.3.0. Developers must use SOARClient.set_message instead. We should replace the following method call with a static "Action succeeded" message.',
658
- )
659
- message = result.generate_action_summary_message()
654
+ message = "Action completed successfully"
660
655
 
661
656
  result = ActionResult(
662
657
  status=True,
@@ -47,15 +47,7 @@ class OutputsSerializer:
47
47
  outputs_class: type[ActionOutput],
48
48
  summary_class: Optional[type[ActionOutput]] = None,
49
49
  ) -> list[OutputFieldSpecification]:
50
- """Serializes the data paths of an ActionOutput class to JSON schema."""
51
- if (
52
- outputs_class.generate_action_summary_message
53
- != ActionOutput.generate_action_summary_message
54
- ):
55
- logger.warning(
56
- f"Overriding ActionOutput.generate_action_summary_message is deprecated. Please call SOARClient.set_message from your action handler instead. [in {outputs_class.__name__}]"
57
- )
58
-
50
+ """Serializes the data paths of an action to JSON schema."""
59
51
  status = OutputFieldSpecification(
60
52
  data_path="action_result.status",
61
53
  data_type="string",
@@ -5,12 +5,12 @@ from .test_connectivity import ConnectivityTestDecorator
5
5
  from .view_handler import ViewHandlerDecorator
6
6
  from .on_poll import OnPollDecorator
7
7
  from .webhook import WebhookDecorator
8
- from .generic_action import GenericActionDecorator
8
+ from .make_request import MakeRequestDecorator
9
9
 
10
10
  __all__ = [
11
11
  "ActionDecorator",
12
12
  "ConnectivityTestDecorator",
13
- "GenericActionDecorator",
13
+ "MakeRequestDecorator",
14
14
  "OnPollDecorator",
15
15
  "ViewHandlerDecorator",
16
16
  "WebhookDecorator",
@@ -2,9 +2,9 @@ import inspect
2
2
 
3
3
  from soar_sdk.abstract import SOARClient
4
4
  from soar_sdk.action_results import ActionResult
5
- from soar_sdk.params import GenericActionParams
5
+ from soar_sdk.params import MakeRequestParams
6
6
  from soar_sdk.meta.actions import ActionMeta
7
- from soar_sdk.action_results import ActionOutput, GenericActionOutput
7
+ from soar_sdk.action_results import ActionOutput, MakeRequestOutput
8
8
  from soar_sdk.types import Action, action_protocol
9
9
  from soar_sdk.exceptions import ActionFailure
10
10
  from soar_sdk.async_utils import run_async_if_needed
@@ -18,8 +18,8 @@ if TYPE_CHECKING:
18
18
  from soar_sdk.app import App
19
19
 
20
20
 
21
- class GenericActionDecorator:
22
- """Class-based decorator for generic action functionality."""
21
+ class MakeRequestDecorator:
22
+ """Class-based decorator for ``make request`` action functionality."""
23
23
 
24
24
  def __init__(
25
25
  self,
@@ -30,32 +30,32 @@ class GenericActionDecorator:
30
30
  self.output_class = output_class
31
31
 
32
32
  def __call__(self, function: Callable) -> Action:
33
- """Decorator for the generic HTTP API action.
33
+ """Decorator for the ``make request`` HTTP API action.
34
34
 
35
- The decorated function implements a generic action that can be used to call any endpoint of the underlying API service this app implements.
35
+ The decorated function implements a ``make request`` action that can be used to call any endpoint of the underlying API service this app implements.
36
36
 
37
37
  Usage:
38
- This decorated function automatically gets all the parameters from the GenericActionParams class and passes them to the function. GenericActionParams represents the parameters required for most http requests.
38
+ This decorated function automatically gets all the parameters from the :class:`~soar_sdk.params.MakeRequestParams` class and passes them to the function. ``MakeRequestParams`` represents the parameters required for most http requests.
39
39
  You should use your existing asset interface to make this request.
40
40
  """
41
- if self.app.actions_manager.get_action("generic_action"):
41
+ if self.app.actions_manager.get_action("make_request"):
42
42
  raise TypeError(
43
- "The 'generic_action' decorator can only be used once per App instance."
43
+ "The 'make_request' decorator can only be used once per App instance."
44
44
  )
45
45
 
46
- # Validate function signature - must have at least one parameter of type GenericActionParams
46
+ # Validate function signature - must have at least one parameter of type MakeRequestParams
47
47
  signature = inspect.signature(function)
48
48
  params = list(signature.parameters.values())
49
49
 
50
- if not any(param.annotation == GenericActionParams for param in params):
50
+ if not any(param.annotation == MakeRequestParams for param in params):
51
51
  raise TypeError(
52
- f"Generic action function must have at least one parameter of type GenericActionParams, got {params[0].annotation}"
52
+ f"Make request action function must have at least one parameter of type MakeRequestParams, got {params[0].annotation}"
53
53
  )
54
54
 
55
- action_identifier = "generic_action"
56
- action_name = "generic action"
57
- # for generic action use GenericActionParams
58
- validated_params_class = GenericActionParams
55
+ action_identifier = "make_request"
56
+ action_name = "make request"
57
+ # for make request action use MakeRequestParams
58
+ validated_params_class = MakeRequestParams
59
59
 
60
60
  return_type = inspect.signature(function).return_annotation
61
61
  if return_type is not inspect.Signature.empty:
@@ -68,10 +68,10 @@ class GenericActionDecorator:
68
68
  )
69
69
 
70
70
  if not issubclass(validated_output_class, ActionOutput) and not isinstance(
71
- validated_output_class, GenericActionOutput
71
+ validated_output_class, MakeRequestOutput
72
72
  ):
73
73
  raise TypeError(
74
- "Return type for action function must be either GenericActionOutput or derived from ActionOutput or GenericActionOutput class."
74
+ "Return type for action function must be either MakeRequestOutput or derived from ActionOutput or MakeRequestOutput class."
75
75
  )
76
76
 
77
77
  logger = getLogger()
@@ -79,7 +79,7 @@ class GenericActionDecorator:
79
79
  @action_protocol
80
80
  @wraps(function)
81
81
  def inner(
82
- params: GenericActionParams,
82
+ params: MakeRequestParams,
83
83
  soar: SOARClient = self.app.soar_client,
84
84
  *args: Any, # noqa: ANN401
85
85
  **kwargs: Any, # noqa: ANN401
@@ -122,7 +122,7 @@ class GenericActionDecorator:
122
122
  action=action_name,
123
123
  identifier=action_identifier,
124
124
  description=inspect.getdoc(function) or action_name,
125
- verbose="Generic action for the app.",
125
+ verbose="'make request' action for the app. Used to handle arbitrary HTTP requests with the app's asset",
126
126
  type="generic",
127
127
  parameters=validated_params_class,
128
128
  output=validated_output_class,
soar_sdk/params.py CHANGED
@@ -170,8 +170,8 @@ class OnPollParams(Params):
170
170
  )
171
171
 
172
172
 
173
- class GenericActionParams(Params):
174
- """Canonical parameters for the special generic HTTP actions."""
173
+ class MakeRequestParams(Params):
174
+ """Canonical parameters for the special make request action."""
175
175
 
176
176
  http_method: str = Param(
177
177
  description="The HTTP method to use for the request.",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splunk-soar-sdk
3
- Version: 1.6.3
3
+ Version: 2.0.0
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
@@ -1,8 +1,8 @@
1
1
  soar_sdk/__init__.py,sha256=RzAng-ARqpK01SY82lNy4uYJFVG0yW6Q3CccEqbToJ4,726
2
2
  soar_sdk/abstract.py,sha256=jGXs2Fv5TRpnh5Duz3mWjY8_DAOpY4RSSzvw_z4XN4I,7950
3
- soar_sdk/action_results.py,sha256=4uKVz-oUVJf9idMdTijUD28PdF6ZKNdrpOTkMCRD0Fs,10202
3
+ soar_sdk/action_results.py,sha256=VJaBzXY0CW1Ncvo0E1ospxYi1buGER6JhL2BoQ4Dbwo,9770
4
4
  soar_sdk/actions_manager.py,sha256=wJCyfzkI_6OKZ-Kmll4vRJpGvYdL93Uw-JyEEGnKcw0,5779
5
- soar_sdk/app.py,sha256=KhRpCUtbvF4g6Ecn9iSNv6Su5KMIB1VhfRdGxIPdP8A,32884
5
+ soar_sdk/app.py,sha256=mFzfGTtsCdlrp5Q0amj53s07oXC5Zhy7ym7U0zFPjQs,32580
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
@@ -13,7 +13,7 @@ soar_sdk/crypto.py,sha256=qiBMHUQqgn5lPI1DbujSj700s89FuLJrkQgCO9_eBn4,392
13
13
  soar_sdk/exceptions.py,sha256=CxJ_Q6N1jlknO_3ItDQNhHEw2pNWZr3sMLqutYmr5HA,1863
14
14
  soar_sdk/input_spec.py,sha256=BAa36l8IKDvM8SVMjgZ1XcnWZ2F7O052n2415tLeKK8,4690
15
15
  soar_sdk/logging.py,sha256=lSz8PA6hOCw2MHGE0ZSKbw-FzSr1WdbfQ7BHnXBUUY0,11440
16
- soar_sdk/params.py,sha256=vUicPw6cdepEbwgg5A2DgIjSSUbhnlOXz_U1jxFH45Q,7491
16
+ soar_sdk/params.py,sha256=8wo6buia91Hh-bxq0jVUU9MPN3XZVRzkMfKZ2BDuMLQ,7488
17
17
  soar_sdk/paths.py,sha256=XhpanQCAiTXaulRx440oKu36mnll7P05TethHXgMpgQ,239
18
18
  soar_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  soar_sdk/types.py,sha256=uMFnNOHpmCLrbAhQOgmXjScXiGE67sM8ySN04MhkC3U,602
@@ -38,7 +38,7 @@ soar_sdk/cli/manifests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
38
38
  soar_sdk/cli/manifests/cli.py,sha256=cly5xVdj4bBIdZVMQPIWTXRgUfd1ON3qKO-76Fwql18,524
39
39
  soar_sdk/cli/manifests/deserializers.py,sha256=FtXv-OywYGb_O5TptS2Hg6niWcfihRPF_RaS5zDBXRk,17045
40
40
  soar_sdk/cli/manifests/processors.py,sha256=6B1fQC2WGVaUP-7E9Y5g7BipaVwEomJCkUQ_7gRfSn8,4155
41
- soar_sdk/cli/manifests/serializers.py,sha256=HA7a3DSzB3P-v2yomAMZW0M1__wY2yCNLU_v0QZv7Vo,3245
41
+ soar_sdk/cli/manifests/serializers.py,sha256=tlW8QPuaVUF8u384lN02xIK2bS2XkDL52kPNwwPmj9c,2859
42
42
  soar_sdk/cli/package/cli.py,sha256=oCpP9E3PtXq-zCdzQD8Z-4dowKF1YT-uKjTpbt_YT-A,9516
43
43
  soar_sdk/cli/package/utils.py,sha256=NQgMxWZSf20hqd4Orov77b7qK23QAO3zIEvRTj9HW-o,1590
44
44
  soar_sdk/code_renderers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -48,9 +48,9 @@ soar_sdk/code_renderers/asset_renderer.py,sha256=f2e2jC43nD0S_bOOfABs-e6Okcyn8zn
48
48
  soar_sdk/code_renderers/renderer.py,sha256=oDlmU-MzDqpc4Yq6zupoT4XN-vRjgL4UV5lOGTLeqkg,1242
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
- soar_sdk/decorators/__init__.py,sha256=s1DOPbNgFN4AHUgMQeYQ4AkbK_BAA3HJaKMjW5RDq84,519
51
+ soar_sdk/decorators/__init__.py,sha256=ttvapTczeQpReZVYgjTw4qnEqKd7b8pR7lNaCpO0npQ,513
52
52
  soar_sdk/decorators/action.py,sha256=7S43XFl0WBa9BYOpyFhlSmxT-08DvV1VQ4P5nEMw8ms,6128
53
- soar_sdk/decorators/generic_action.py,sha256=QxKWdr9SXYNWcgIlHrnenasJE0AI4Y8Q0em10ScPTPI,5429
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
@@ -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-1.6.3.dist-info/METADATA,sha256=0_WxMtlZ3BrXjEpcCJ5Yg8nVkQi4gfv9ProOkQPr1mw,7361
100
- splunk_soar_sdk-1.6.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- splunk_soar_sdk-1.6.3.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
102
- splunk_soar_sdk-1.6.3.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
103
- splunk_soar_sdk-1.6.3.dist-info/RECORD,,
99
+ splunk_soar_sdk-2.0.0.dist-info/METADATA,sha256=GiFXmEsBHTw7YBcnk8OV5U48usWYNpd-djWhMy_eeiI,7361
100
+ splunk_soar_sdk-2.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ splunk_soar_sdk-2.0.0.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
102
+ splunk_soar_sdk-2.0.0.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
103
+ splunk_soar_sdk-2.0.0.dist-info/RECORD,,