Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify APIs to support passing submission profile names #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions assemblyline_client/v4_client/module/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, connection):
self._connection = connection

def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None,
alert=False, nq=None, nt=None, ingest_type='AL_CLIENT'):
alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', submission_profile=None):
"""\
Submit a file to the ingestion queue.

Expand All @@ -30,6 +30,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam
nt : Notification threshold. (int)
params : Additional submission parameters. (dict)
ingest_type: Ingestion type, one word to describe how the data is ingested. Default: AL_CLIENT (string)
submission_profile : Submission profile name

If content is provided, the path is used as metadata only.
"""
Expand Down Expand Up @@ -87,7 +88,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam
request['notification_threshold'] = int(nt)
if params:
request['params'] = params

if submission_profile:
request['submission_profile'] = submission_profile
if files:
data = {'json': dumps(request)}
headers = {'content-type': None}
Expand Down
12 changes: 8 additions & 4 deletions assemblyline_client/v4_client/module/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Submit(object):
def __init__(self, connection):
self._connection = connection

def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None):
def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, submission_profile=None):
"""\
Submit a file to be dispatched.

Expand All @@ -22,9 +22,10 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam
url : Url to scan (string)

Optional
fname : Name of the file to scan
metadata : Metadata to include with submission. (dict)
params : Additional submission parameters. (dict)
fname : Name of the file to scan
metadata : Metadata to include with submission. (dict)
params : Additional submission parameters. (dict)
submission_profile : Submission profile name

If content is provided, the path is used as metadata only.
"""
Expand Down Expand Up @@ -73,6 +74,9 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam
if metadata:
request['metadata'] = metadata

if submission_profile:
request['submission_profile'] = submission_profile

if files:
data = {'json': dumps(request)}
headers = {'content-type': None}
Expand Down