Skip to content

Commit 59500e8

Browse files
feat: bumping up sdk version
1 parent 1540a52 commit 59500e8

File tree

6 files changed

+39
-17
lines changed

6 files changed

+39
-17
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,11 @@ Provide the path to store the file on the file server. For example, <b>/web_stor
318318

319319
PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
320320
--------- | -------- | ----------- | ---- | --------
321-
**host** | required | Hostname/IP with port number to execute command on | string | `host name` |
321+
**host** | optional | Hostname/IP with port number to execute command on | string | `host name` |
322322
**vault_id** | required | Vault ID of file | string | `vault id` |
323323
**file_destination** | required | File destination path (exclude filename) | string | `file path` |
324-
**file_name** | required | Name of the file to be put on endpoint | string | |
325-
**verify_certificate** | required | Verify certificates (if using HTTPS) | boolean | |
324+
**file_name** | optional | Name of the file to be put on endpoint | string | |
325+
**verify_certificate** | optional | Verify certificates (if using HTTPS) | boolean | |
326326

327327
#### Action Output
328328

@@ -352,9 +352,9 @@ Provide the file path and file name to download into the vault. For example, <b>
352352

353353
PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
354354
--------- | -------- | ----------- | ---- | --------
355-
**hostname** | required | Hostname to execute command on | string | `hostname` |
355+
**hostname** | optional | Hostname to execute command on | string | `hostname` |
356356
**file_path** | required | Path of the file to download (include filename) | string | `file path` |
357-
**verify_certificate** | required | Verify certificates (if using HTTPS) | boolean | |
357+
**verify_certificate** | optional | Verify certificates (if using HTTPS) | boolean | |
358358

359359
#### Action Output
360360

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.9, <3.14"
77
authors = [
88
]
99
dependencies = [
10-
"splunk-soar-sdk==1.6.0",
10+
"splunk-soar-sdk==1.6.2",
1111
"validators",
1212
"xmltodict",
1313
]

src/actions/get_file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GetFileParams(Params):
3131
description="Hostname to execute command on",
3232
primary=True,
3333
cef_types=["hostname"],
34+
required=False,
3435
)
3536
file_path: str = Param(
3637
required=True,
@@ -39,7 +40,9 @@ class GetFileParams(Params):
3940
cef_types=["file path"],
4041
)
4142
verify_certificate: bool = Param(
42-
description="Verify certificates (if using HTTPS)", default=False
43+
description="Verify certificates (if using HTTPS)",
44+
default=False,
45+
required=False,
4346
)
4447

4548

src/actions/put_file.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,27 @@ class PutFileParams(Params):
3131
description="Hostname/IP with port number to execute command on",
3232
primary=True,
3333
cef_types=["host name"],
34+
required=False,
3435
)
3536
vault_id: str = Param(
36-
description="Vault ID of file", primary=True, cef_types=["vault id"]
37+
description="Vault ID of file",
38+
primary=True,
39+
cef_types=["vault id"],
40+
required=True,
3741
)
3842
file_destination: str = Param(
3943
description="File destination path (exclude filename)",
4044
primary=True,
4145
cef_types=["file path"],
46+
required=True,
47+
)
48+
file_name: str = Param(
49+
description="Name of the file to be put on endpoint", required=False
4250
)
43-
file_name: str = Param(description="Name of the file to be put on endpoint")
4451
verify_certificate: bool = Param(
45-
description="Verify certificates (if using HTTPS)", default=False
52+
description="Verify certificates (if using HTTPS)",
53+
default=False,
54+
required=False,
4655
)
4756

4857

@@ -71,11 +80,20 @@ def put_file(params: PutFileParams, soar: SOARClient, asset: Asset) -> PutFileOu
7180
)
7281

7382
base_url = params.host or asset.base_url
74-
full_url = f"{base_url.rstrip('/')}/{params.file_destination.lstrip('/')}/{quote(file_name_to_send)}"
83+
84+
# Handle root directory case
85+
destination_path = params.file_destination.lstrip("/")
86+
if destination_path:
87+
full_url = (
88+
f"{base_url.rstrip('/')}/{destination_path}/{quote(file_name_to_send)}"
89+
)
90+
else:
91+
full_url = f"{base_url.rstrip('/')}/{quote(file_name_to_send)}"
92+
7593
if not validators.url(full_url):
7694
raise ActionFailure(f"Invalid URL constructed: {full_url}")
7795

78-
with vault_attachment.open() as f:
96+
with vault_attachment.open("rb") as f:
7997
from ..app import get_auth_method
8098

8199
auth_strategy = get_auth_method(asset, soar)
@@ -85,7 +103,7 @@ def put_file(params: PutFileParams, soar: SOARClient, asset: Asset) -> PutFileOu
85103
logger.info(f"Uploading file '{file_name_to_send}' to: {full_url}")
86104
response = requests.request(
87105
method="POST",
88-
uri=full_url,
106+
url=full_url,
89107
auth=auth_object,
90108
headers=final_headers,
91109
params=query_params,

src/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class BaseHttpParams(Params):
5555
description="Location (e.g. path/to/endpoint)",
5656
primary=True,
5757
cef_types=["endpoint"],
58+
required=True,
5859
)
5960
verify_certificate: bool = Param(
6061
description="Verify certificates (if using HTTPS)",

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)