Skip to content

Commit 56af875

Browse files
authored
det-4172: expanded software sync (#1302)
1 parent debb89c commit 56af875

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

python/cli/prelude_cli/views/scm.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ def users(
136136
)
137137

138138

139+
@scm.command("software")
140+
@click.option(
141+
"--limit", default=100, help="maximum number of results to return", type=int
142+
)
143+
@click.option("--offset", default=0, help="number of results to skip", type=int)
144+
@click.option("--odata_filter", help="OData filter string")
145+
@click.option("--odata_orderby", help="OData orderby string")
146+
@click.option(
147+
"--odata_select", help="OData select string to specify which fields to return"
148+
)
149+
@click.pass_obj
150+
@pretty_print
151+
def software(controller, limit, offset, odata_filter, odata_orderby, odata_select):
152+
"""List software with SCM data"""
153+
with Spinner(description="Fetching software from partner"):
154+
return controller.software(
155+
filter=odata_filter,
156+
orderby=odata_orderby,
157+
select=odata_select,
158+
skip=offset,
159+
top=limit,
160+
)
161+
162+
139163
@scm.command("technique-summary")
140164
@click.option(
141165
"-q",

python/sdk/prelude_sdk/controllers/scm_controller.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@ def users(
155155
)
156156
return data
157157

158+
@verify_credentials
159+
def software(
160+
self,
161+
select: str = None,
162+
filter: str = None,
163+
orderby: str = None,
164+
top: str = None,
165+
skip: str = None,
166+
):
167+
"""List software with SCM analysis"""
168+
params = {
169+
"$select": select,
170+
"$filter": filter,
171+
"$orderby": orderby,
172+
"$top": top,
173+
"$skip": skip,
174+
}
175+
176+
res = self.get(f"{self.account.hq}/scm/software", params=params, timeout=30)
177+
return res.json()
178+
158179
@verify_credentials
159180
def technique_summary(self, techniques: str):
160181
"""Get policy evaluation summary by technique"""
@@ -596,7 +617,9 @@ def update_notification(
596617
if teams_urls:
597618
body["teams"] = dict(hook_urls=teams_urls, message=message)
598619

599-
res = self.post(f"{self.account.hq}/scm/notifications/{notification_id}", json=body)
620+
res = self.post(
621+
f"{self.account.hq}/scm/notifications/{notification_id}", json=body
622+
)
600623
return res.json()
601624

602625
@verify_credentials

0 commit comments

Comments
 (0)