Skip to content

Commit

Permalink
Merge pull request #98 from cadonuno/main
Browse files Browse the repository at this point in the history
Adding support for application description
  • Loading branch information
tjarrettveracode authored Dec 31, 2024
2 parents a59b914 + a9d1fb4 commit 2851b44
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions veracode_api_py/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ def get_by_name (self,appname: str):
params = {"name": parse.quote(appname)}
return APIHelper()._rest_paged_request(uri="appsec/v1/applications",method="GET",element="applications",params=params)

def create(self,app_name:str ,business_criticality, business_unit: UUID=None, teams=[], policy_guid:UUID=None,
def create(self,app_name:str ,business_criticality, description: str=None, business_unit: UUID=None, teams=[], policy_guid:UUID=None,
custom_fields=[], bus_owner_name=None, bus_owner_email=None, git_repo_url=None, custom_kms_alias: str=None):
return self._create_or_update("CREATE",app_name=app_name,business_criticality=business_criticality,
business_unit=business_unit,teams=teams, policy_guid=policy_guid,
description=description,business_unit=business_unit,teams=teams, policy_guid=policy_guid,
custom_fields=custom_fields, bus_owner_name=bus_owner_name,
bus_owner_email=bus_owner_email, git_repo_url=git_repo_url, custom_kms_alias=custom_kms_alias)

def update(self,guid: UUID,app_name:str ,business_criticality, business_unit: UUID=None,
def update(self,guid: UUID,app_name:str, description: str=None, business_criticality, business_unit: UUID=None,
teams=[], policy_guid:UUID=None, custom_fields=[],
bus_owner_name=None,bus_owner_email=None, git_repo_url=None):
return self._create_or_update("UPDATE",app_name=app_name,business_criticality=business_criticality,
business_unit=business_unit,teams=teams,guid=guid,
description=description,business_unit=business_unit,teams=teams,guid=guid,
policy_guid=policy_guid, custom_fields=custom_fields,
bus_owner_name=bus_owner_name,bus_owner_email=bus_owner_email,
git_repo_url=git_repo_url)
Expand All @@ -53,7 +53,7 @@ def delete(self,guid: UUID):
uri = 'appsec/v1/applications/{}'.format(guid)
return APIHelper()._rest_request(uri,'DELETE')

def _create_or_update(self,method,app_name: str,business_criticality, business_unit: UUID=None,
def _create_or_update(self,method,app_name: str,description: str=None,business_criticality, business_unit: UUID=None,
teams=[],guid=None,policy_guid:UUID=None, custom_fields=[],
bus_owner_name=None,bus_owner_email=None,git_repo_url=None,custom_kms_alias:str=None):
if method == 'CREATE':
Expand All @@ -70,6 +70,10 @@ def _create_or_update(self,method,app_name: str,business_criticality, business_u

app_def = {'name':app_name, 'business_criticality':business_criticality}

if (description != None):
desc = { 'description': description}
app_def.update(desc)

if policy_guid:
app_def.update({"policies": [{'guid': policy_guid}]})

Expand Down

0 comments on commit 2851b44

Please sign in to comment.