splunk-soar-sdk 2.3.1__py3-none-any.whl → 2.3.3__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 CHANGED
@@ -101,7 +101,7 @@ class App:
101
101
  product_name: str,
102
102
  publisher: str,
103
103
  appid: str,
104
- python_version: Optional[list[PythonVersion]] = None,
104
+ python_version: Optional[Union[list[PythonVersion], str]] = None,
105
105
  min_phantom_version: str = MIN_PHANTOM_VERSION,
106
106
  fips_compliant: bool = False,
107
107
  asset_cls: type[BaseAsset] = BaseAsset,
@@ -113,7 +113,7 @@ class App:
113
113
  raise ValueError(f"Appid is not a valid uuid: {appid}")
114
114
 
115
115
  if python_version is None:
116
- python_version = PythonVersion.all()
116
+ python_version = PythonVersion.all_csv()
117
117
 
118
118
  self.app_meta_info = {
119
119
  "name": name,
soar_sdk/cli/init/cli.py CHANGED
@@ -269,11 +269,11 @@ def convert_connector_to_sdk(
269
269
  # Convert the main module path to the SDK format, but save a reference to the original
270
270
  app_meta.main_module = "src.app:app"
271
271
 
272
- app_python_versions = app_meta.python_version
272
+ app_python_versions = PythonVersion.from_csv(app_meta.python_version)
273
273
  enforced_python_versions = PythonVersion.all()
274
274
  if set(app_python_versions) != set(enforced_python_versions):
275
275
  rprint(
276
- f"[yellow]The provided app declares support for Python versions {[str(v) for v in app_python_versions]}.[/]"
276
+ f"[yellow]The provided app declares support for Python versions '{app_meta.python_version}'.[/]"
277
277
  )
278
278
  rprint(
279
279
  f"[yellow]The converted app will support the default versions {[str(v) for v in enforced_python_versions]}.[/]"
@@ -6,7 +6,7 @@ import pydantic
6
6
 
7
7
  from soar_sdk.action_results import ActionOutput, OutputFieldSpecification, OutputField
8
8
  from soar_sdk.cli.utils import normalize_field_name, NormalizationResult
9
- from soar_sdk.compat import PythonVersion, remove_when_soar_newer_than
9
+ from soar_sdk.compat import remove_when_soar_newer_than
10
10
  from soar_sdk.meta.actions import ActionMeta
11
11
  from soar_sdk.meta.app import AppMeta
12
12
  from soar_sdk.params import Params, Param
@@ -41,15 +41,6 @@ class AppMetaDeserializer:
41
41
  """
42
42
  manifest: dict[str, Any] = json.loads(json_path.read_text())
43
43
 
44
- # Massage the python_version field, which may be a comma-separated string
45
- python_version = manifest.pop("python_version", None)
46
- if isinstance(python_version, str):
47
- manifest["python_version"] = PythonVersion.from_csv(python_version)
48
- elif isinstance(python_version, list):
49
- manifest["python_version"] = [
50
- PythonVersion.from_str(py) for py in python_version
51
- ]
52
-
53
44
  deserialized_actions = [
54
45
  ActionDeserializer.from_action_json(action)
55
46
  for action in manifest.get("actions", [])
soar_sdk/compat.py CHANGED
@@ -59,11 +59,21 @@ class PythonVersion(str, Enum):
59
59
  cls.from_str(version.strip()) for version in versions if version.strip()
60
60
  ]
61
61
 
62
+ @classmethod
63
+ def to_csv(cls, versions: list["PythonVersion"]) -> str:
64
+ """Converts a list of PythonVersion enums to a comma-separated string."""
65
+ return ",".join(str(v) for v in versions)
66
+
62
67
  @classmethod
63
68
  def all(cls) -> list["PythonVersion"]:
64
69
  """Returns a list of all supported Python versions."""
65
70
  return [cls.PY_3_9, cls.PY_3_13]
66
71
 
72
+ @classmethod
73
+ def all_csv(cls) -> str:
74
+ """Returns a comma-separated string of all supported Python versions."""
75
+ return ",".join(str(v) for v in cls.all())
76
+
67
77
  @classmethod
68
78
  def to_requires_python(cls, versions: list["PythonVersion"]) -> str:
69
79
  """Converts a list of PythonVersions to a PEP-508 compatible requires-python string."""
soar_sdk/meta/app.py CHANGED
@@ -1,5 +1,5 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Optional
1
+ from pydantic import BaseModel, Field, validator
2
+ from typing import Optional, Union
3
3
 
4
4
  from soar_sdk.asset import AssetFieldSpecification
5
5
  from soar_sdk.compat import PythonVersion
@@ -32,7 +32,7 @@ class AppMeta(BaseModel):
32
32
  logo: str = ""
33
33
  logo_dark: str = ""
34
34
  product_name: str = ""
35
- python_version: list[PythonVersion] = Field(default_factory=PythonVersion.all)
35
+ python_version: str = Field(default_factory=PythonVersion.all_csv)
36
36
  product_version_regex: str = ".*"
37
37
  publisher: str = ""
38
38
  utctime_updated: str = ""
@@ -47,6 +47,21 @@ class AppMeta(BaseModel):
47
47
 
48
48
  webhook: Optional[WebhookMeta]
49
49
 
50
+ @validator("python_version", pre=True)
51
+ def convert_python_version_to_csv(cls, v: Union[list, str]) -> str:
52
+ """Converts python_version to a comma-separated string if it's a list and validates versions."""
53
+ if isinstance(v, list):
54
+ # Validate each version in the list and convert to CSV
55
+ validated_versions = [PythonVersion.from_str(str(version)) for version in v]
56
+ return PythonVersion.to_csv(validated_versions)
57
+ elif isinstance(v, str):
58
+ # Validate the CSV string by parsing it and convert back to CSV
59
+ validated_versions = PythonVersion.from_csv(v)
60
+ return PythonVersion.to_csv(validated_versions)
61
+ raise ValueError(
62
+ f"Invalid python_version type must be a list or a comma-separated string: {v}"
63
+ )
64
+
50
65
  def to_json_manifest(self) -> dict:
51
66
  """Converts the AppMeta instance to a JSON-compatible dictionary."""
52
67
  return self.dict(exclude_none=True)
soar_sdk/params.py CHANGED
@@ -218,26 +218,27 @@ class MakeRequestParams(Params):
218
218
  )
219
219
 
220
220
  headers: str = Param(
221
- description="The headers to send with the request (JSON object).",
221
+ description="The headers to send with the request (JSON object). An example is {'Content-Type': 'application/json'}",
222
222
  required=False,
223
223
  )
224
224
 
225
225
  query_parameters: str = Param(
226
- description="The query string to send with the request.",
226
+ description="Parameters to append to the URL (JSON object or query string). An example is ?key=value&key2=value2",
227
227
  required=False,
228
228
  )
229
229
 
230
230
  body: str = Param(
231
- description="The body to send with the request (JSON object).",
231
+ description="The body to send with the request (JSON object). An example is {'key': 'value', 'key2': 'value2'}",
232
232
  required=False,
233
233
  )
234
234
 
235
235
  timeout: int = Param(
236
- description="The timeout for the request.",
236
+ description="The timeout for the request in seconds.",
237
237
  required=False,
238
238
  )
239
239
 
240
240
  verify_ssl: bool = Param(
241
- description="Whether to verify the SSL certificate.",
241
+ description="Whether to verify the SSL certificate. Default is False.",
242
242
  required=False,
243
+ default=False,
243
244
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splunk-soar-sdk
3
- Version: 2.3.1
3
+ Version: 2.3.3
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,18 +2,18 @@ soar_sdk/__init__.py,sha256=RzAng-ARqpK01SY82lNy4uYJFVG0yW6Q3CccEqbToJ4,726
2
2
  soar_sdk/abstract.py,sha256=AU5ssJWytMp_RmYOxt_sKBqaFN63UfdMmzmAn0HQE_g,7940
3
3
  soar_sdk/action_results.py,sha256=NQTcQ3NJcYB6h-YNRqO0bCG_hILmTidv2D4FdvCzyDE,11092
4
4
  soar_sdk/actions_manager.py,sha256=wJCyfzkI_6OKZ-Kmll4vRJpGvYdL93Uw-JyEEGnKcw0,5779
5
- soar_sdk/app.py,sha256=EtvIJtL5_WFMmTKn3V0mJex5ZsBxzAf7EzqERU2t0Vg,33184
5
+ soar_sdk/app.py,sha256=WywDS9Eqy52u2lOQyuF6EfLHhLqCVjPTbFzIX06hiAs,33200
6
6
  soar_sdk/app_cli_runner.py,sha256=fJoozhyAt7QUMuc02nE5RL_InpsjQBpr6U4rF9sey3E,11627
7
7
  soar_sdk/app_client.py,sha256=GZmpenBl25-UQVVpELxWRJanmXBWNIQBRphcSAbnZlU,6253
8
8
  soar_sdk/asset.py,sha256=deS8_B5hr7W2fED8_6wUpVriRgiQ5r8TkGVHiasIaro,10666
9
9
  soar_sdk/async_utils.py,sha256=gND8ZiVTqDYLQ88Ua6SN1mInJaEcfa168eOaRoURt3E,1441
10
10
  soar_sdk/colors.py,sha256=--i_iXqfyITUz4O95HMjfZQGbwFZ34bLmBhtfpXXqlQ,1095
11
- soar_sdk/compat.py,sha256=H7At6OSsZQMtlarjyWNcPfsa4_8FC5k0JLdGrmU-O1M,2666
11
+ soar_sdk/compat.py,sha256=m2fRS3ReJD5K7kwKjJfNE_MYBm5uM6MFuXkefPkPl1Y,3056
12
12
  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=OomwUt2bkOwzDs9ypmf-ziZmj2D4uIieO85Jo3haWCg,8731
16
+ soar_sdk/params.py,sha256=UXfyCAO3bqMX7n_2Cmu-ObmilBkGg0kX1Jk9KCjjrtY,8940
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
@@ -33,10 +33,10 @@ soar_sdk/cli/cli.py,sha256=62n6b41bjXILtkqLTpeID8JyDYMbkfXNV1LCo52YUsA,926
33
33
  soar_sdk/cli/path_utils.py,sha256=rFJDAe-sTC_6KgSiidlD3JcpygFmyHAEsn1j_6eWpIc,1263
34
34
  soar_sdk/cli/utils.py,sha256=GNZLFAMH_BKQo2-D5GvweWxeuR7DfR8eMZS4-sJUggU,1441
35
35
  soar_sdk/cli/init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- soar_sdk/cli/init/cli.py,sha256=bVp8t28FYCS_wP2FhLWqmIvCkFbqmO1-7Dw8PpTFNq0,14495
36
+ soar_sdk/cli/init/cli.py,sha256=rRt_Rho-mKHYivQzcSKtakFGM6hie0-bQ4D-5O1gjII,14507
37
37
  soar_sdk/cli/manifests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  soar_sdk/cli/manifests/cli.py,sha256=cly5xVdj4bBIdZVMQPIWTXRgUfd1ON3qKO-76Fwql18,524
39
- soar_sdk/cli/manifests/deserializers.py,sha256=FtXv-OywYGb_O5TptS2Hg6niWcfihRPF_RaS5zDBXRk,17045
39
+ soar_sdk/cli/manifests/deserializers.py,sha256=xFTRzWEszKbkO-yNUvGnQfjdJryXpB2FalkxaDmzm3Y,16589
40
40
  soar_sdk/cli/manifests/processors.py,sha256=6B1fQC2WGVaUP-7E9Y5g7BipaVwEomJCkUQ_7gRfSn8,4155
41
41
  soar_sdk/cli/manifests/serializers.py,sha256=0qps_2jsySXa4ytX3DvFt0tbbZlZ7mowIjMu9FEhQMc,3417
42
42
  soar_sdk/cli/package/cli.py,sha256=oCpP9E3PtXq-zCdzQD8Z-4dowKF1YT-uKjTpbt_YT-A,9516
@@ -58,7 +58,7 @@ soar_sdk/decorators/webhook.py,sha256=Pde0MjxC2kckpxoKb3m4WVfLWtiFAAzAwZe5AF5VIb
58
58
  soar_sdk/meta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  soar_sdk/meta/actions.py,sha256=nrTBwCnCwjOzof-_8Ww9vfoTIfZfauiL6C6DTRg2Mhs,2580
60
60
  soar_sdk/meta/adapters.py,sha256=KjSYIUtkCz2eesA_vhsNCjfi5C-Uz71tbSuDIjhuB8U,1112
61
- soar_sdk/meta/app.py,sha256=rwgoFfIFnLutLB9PF1kR7X1neKs175VA0Xx4KpJ6c7I,1765
61
+ soar_sdk/meta/app.py,sha256=KHvtyxBYf740pTKuMYdrZCh7Kikoaybq5JJeCIQs0CI,2595
62
62
  soar_sdk/meta/datatypes.py,sha256=piR-oBVAATiRciXSdVE7XaqjUZTgSaOvTEqcOcNvCS0,795
63
63
  soar_sdk/meta/dependencies.py,sha256=AQlkdm6A7JEfLI0IAXKU6WzPkUX7oPfxgDkGZ3AofHk,17927
64
64
  soar_sdk/meta/webhooks.py,sha256=1sh4-3I3_UiXFNzVEyoz2Tp6NhgTEZWpERYIzV8OYNY,1188
@@ -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.3.1.dist-info/METADATA,sha256=-Ec3iyRoRcJLJqcQPrUAq9_LEC_UjyM6VLPKijRSR6g,7361
100
- splunk_soar_sdk-2.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- splunk_soar_sdk-2.3.1.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
102
- splunk_soar_sdk-2.3.1.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
103
- splunk_soar_sdk-2.3.1.dist-info/RECORD,,
99
+ splunk_soar_sdk-2.3.3.dist-info/METADATA,sha256=aYezmJR97t9-zDRHpvnvv2OJAXT5DM4wCNtxe3eMu38,7361
100
+ splunk_soar_sdk-2.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ splunk_soar_sdk-2.3.3.dist-info/entry_points.txt,sha256=CgBjo2ZWpYNkt9TgvToL26h2Tg1yt8FbvYTb5NVgNuc,51
102
+ splunk_soar_sdk-2.3.3.dist-info/licenses/LICENSE,sha256=gNCGrGhrSQb1PUzBOByVUN1tvaliwLZfna-QU2r2hQ8,11345
103
+ splunk_soar_sdk-2.3.3.dist-info/RECORD,,