Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_project_version(self, project_obj, new_version_name, clone_version=None, parameters={}):
url = self.get_link(project_obj, "versions")
version_phase = parameters.get("phase", "PLANNING")
if version_phase not in HubInstance.VERSION_PHASES:
raise InvalidVersionPhase("The phase given {} is not in the list of valid phases ({})".format(
version_phase, HubInstance.VERSION_PHASES))
post_data = {
"versionUrl": url,
"cloneCategories": [
"VULN_DATA",
"COMPONENT_DATA"
],
"versionName": new_version_name,
"phase": version_phase,
"distribution": parameters.get("distribution", "EXTERNAL")
}
if clone_version:
post_data["cloneFromReleaseUrl"] = clone_version['_meta']['href']
response = self.execute_post(url, data=post_data)
return response
def create_project_version(self, project_obj, new_version_name, parameters={}):
url = self.get_link(project_obj, "versions")
version_phase = parameters.get("phase", "PLANNING")
if version_phase not in HubInstance.VERSION_PHASES:
raise InvalidVersionPhase("The phase given {} is not in the list of valid phases ({})".format(
version_phase, HubInstance.VERSION_PHASES))
post_data = {
"versionUrl": url,
"cloneCategories": [
"VULN_DATA",
"COMPONENT_DATA"
],
"versionName": new_version_name,
"phase": parameters.get("phase", "PLANNING"),
"distribution": parameters.get("distribution", "EXTERNAL")
}
response = self.execute_post(url, data=post_data)
return response
def create_project_version(self, project_obj, new_version_name, clone_version=None, parameters={}):
url = self.get_link(project_obj, "versions")
version_phase = parameters.get("phase", "PLANNING")
if version_phase not in HubInstance.VERSION_PHASES:
raise InvalidVersionPhase("The phase given {} is not in the list of valid phases ({})".format(
version_phase, HubInstance.VERSION_PHASES))
post_data = {
"versionUrl": url,
"cloneCategories": [
"VULN_DATA",
"COMPONENT_DATA"
],
"versionName": new_version_name,
"phase": version_phase,
"distribution": parameters.get("distribution", "EXTERNAL")
}
if clone_version:
post_data["cloneFromReleaseUrl"] = clone_version['_meta']['href']
response = self.execute_post(url, data=post_data)
def create_project_version(self, project_obj, new_version_name, parameters={}):
url = self.get_link(project_obj, "versions")
version_phase = parameters.get("phase", "PLANNING")
if version_phase not in HubInstance.VERSION_PHASES:
raise InvalidVersionPhase("The phase given {} is not in the list of valid phases ({})".format(
version_phase, HubInstance.VERSION_PHASES))
post_data = {
"versionUrl": url,
"cloneCategories": [
"VULN_DATA",
"COMPONENT_DATA"
],
"versionName": new_version_name,
"phase": parameters.get("phase", "PLANNING"),
"distribution": parameters.get("distribution", "EXTERNAL")
}
response = self.execute_post(url, data=post_data)
return response