diff --git a/docs/sca.md b/docs/sca.md index 554db85..e6591bf 100644 --- a/docs/sca.md +++ b/docs/sca.md @@ -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`. diff --git a/veracode_api_py/api.py b/veracode_api_py/api.py index 8ea29bb..d70c4fd 100644 --- a/veracode_api_py/api.py +++ b/veracode_api_py/api.py @@ -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) diff --git a/veracode_api_py/sca.py b/veracode_api_py/sca.py index 9c35685..27e8f9b 100644 --- a/veracode_api_py/sca.py +++ b/veracode_api_py/sca.py @@ -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):