Skip to content

Commit 47b71a6

Browse files
Get apps by git repo url (closes #105)
1 parent 78dffdd commit 47b71a6

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

docs/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ As an alternative to importing individual objects into your library, you can acc
8787
- `get_apps(policy_check_after(opt))` : get a list of Veracode applications (JSON format). If provided, returns only applications that have a policy check date on or after `policy_check_after` (format is `yyyy-mm-dd`).
8888
- `get_app(guid(opt),legacy_id(opt))`: get information for a single Veracode application using either the `guid` or the `legacy_id` (integer).
8989
- `get_app_by_name(name)`: get list of applications whose names contain the search string `name`.
90+
- `get_app_by_repo(git_repo_url)`: get list of applications associated with the `git_repo_url`.
9091
- `create_app(app_name, business_criticality, description(opt), business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt),custom_kms_alias(opt))`: create an application profile.
9192
- `business_criticality`: one of "VERY HIGH", "HIGH", "MEDIUM", "LOW", "VERY LOW"
9293
- `description`: extended description of the application

docs/applications.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The following methods call Veracode REST APIs and return JSON.
77
- `Applications().get_all(policy_check_after(opt))` : get a list of Veracode applications (JSON format). If provided, returns only applications that have a policy check date on or after `policy_check_after` (format is `yyyy-mm-dd`).
88
- `Applications().get(guid(opt),legacy_id(opt))`: get information for a single Veracode application using either the `guid` or the `legacy_id` (integer).
99
- `Applications().get_by_name(name)`: get list of applications whose names contain the search string `name`.
10+
- `Applications().get_by_repo(git_repo_url)`: get list of applications associated with the `git_repo_url`.
1011
- `Applications().create(app_name, business_criticality, description(opt), business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt),custom_kms_alias(opt))`: create an application profile.
1112
- `business_criticality`: one of "VERY HIGH", "HIGH", "MEDIUM", "LOW", "VERY LOW"
1213
- `description`: extended description of the application.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'veracode_api_py'
3-
version = '0.9.59'
3+
version = '0.9.60'
44
authors = [ {name = "Tim Jarrett", email="[email protected]"} ]
55
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.'
66
readme = 'README.md'
@@ -22,4 +22,4 @@ dependencies = {file = ["requirements.txt"]}
2222
[project.urls]
2323
"Homepage" = "https://github.com/veracode/veracode-api-py"
2424
"Bug Tracker" = "https://github.com/veracode/veracode-api-py/issues"
25-
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0959.tar.gz"
25+
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0960.tar.gz"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
setup(
88
name = 'veracode_api_py',
99
packages = ['veracode_api_py'],
10-
version = '0.9.59',
10+
version = '0.9.60',
1111
license='MIT',
1212
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.',
1313
long_description = long_description,
1414
long_description_content_type="text/markdown",
1515
author = 'Tim Jarrett',
1616
author_email = '[email protected]',
1717
url = 'https://github.com/tjarrettveracode',
18-
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0959tar.gz',
18+
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0960.tar.gz',
1919
keywords = ['veracode', 'veracode-api'],
2020
install_requires=[
2121
'veracode-api-signing'

veracode_api_py/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,14 @@ def get_apps(self):
106106
return Applications().get_all()
107107

108108
def get_app(self, guid: UUID = None, legacy_id=None):
109-
return Applications().get(guid, legacy_id)
109+
return Applications().get(guid=guid, legacy_id=legacy_id)
110110

111111
def get_app_by_name(self, appname):
112-
return Applications().get_by_name(appname)
112+
return Applications().get_by_name(appname=appname)
113113

114+
def get_app_by_repo(self, git_repo_url):
115+
return Applications().get_by_repo(git_repo_url=git_repo_url)
116+
114117
def create_app(self, app_name, business_criticality, description: str=None, business_unit: UUID = None, teams=[],
115118
policy_guid = None, custom_fields=[],bus_owner_name = None, bus_owner_email = None,
116119
git_repo_url = None, custom_kms_alias = None):

veracode_api_py/applications.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ def get_by_name (self,appname: str):
3333
params = {"name": parse.quote(appname)}
3434
return APIHelper()._rest_paged_request(uri="appsec/v1/applications",method="GET",element="applications",params=params)
3535

36+
def get_by_repo (self,git_repo_url: str):
37+
"""Gets a list of applications having a name that matches appname, using the Veracode Applications API."""
38+
params = {"git_repo_url": parse.quote(git_repo_url)}
39+
return APIHelper()._rest_paged_request(uri="appsec/v1/applications",method="GET",element="applications",params=params)
40+
3641
def create(self,app_name:str ,business_criticality, description: str=None, business_unit: UUID=None, teams=[], policy_guid:UUID=None,
3742
custom_fields=[], bus_owner_name=None, bus_owner_email=None, git_repo_url=None, custom_kms_alias: str=None):
3843
return self._create_or_update("CREATE",app_name=app_name,business_criticality=business_criticality,

0 commit comments

Comments
 (0)