Skip to content

Commit

Permalink
Add include_metrics param for GetWorkspaces (fixes #77)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjarrettveracode committed Feb 21, 2024
1 parent b9e06ca commit c3c79d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/sca.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Note_: SCA APIs must be called with a human user, since the SCA Agent APIs do n

_Note_: You can also access these methods from the `Workspaces` class.

- `get_workspaces()`: get a list of SCA Agent workspaces for the organization.
- `get_workspaces(include_metrics(opt))`: get a list of SCA Agent workspaces for the organization. The `include_metrics` parameter can add counts of issues and other attributes in the response, at some cost to performance, and defaults to `False`.
- `get_workspace_by_name(name)`: get a list of SCA Agent workspaces whose name partially matches `name`.
- `create_workspace(name)`: create an SCA Agent workspace named `name`. Returns the GUID for the workspace.
- `add_workspace_team(workspace_guid,team_id)`: add the team identified by `team_id` (int) to the workspace identified by `workspace_guid`.
Expand Down
4 changes: 2 additions & 2 deletions veracode_api_py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ def get_roles(self):

## SCA APIs - note must be human user to use these, not API user

def get_workspaces(self):
return Workspaces().get_all()
def get_workspaces(self, include_metrics=False):
return Workspaces().get_all(include_metrics=include_metrics)

def get_workspace_by_name(self, name):
return Workspaces().get_by_name(name)
Expand Down
4 changes: 2 additions & 2 deletions veracode_api_py/sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Workspaces():
sca_base_url = "srcclr/v3/workspaces"
sca_issues_url = "srcclr/v3/issues"

def get_all(self):
def get_all(self, include_metrics=False):
#Gets existing workspaces
request_params = {}
request_params = {'include_metrics': include_metrics}
return APIHelper()._rest_paged_request(self.sca_base_url,"GET",params=request_params,element="workspaces")

def get_by_name(self,name: str):
Expand Down

0 comments on commit c3c79d9

Please sign in to comment.