Skip to content

Commit e42580a

Browse files
committed
added deprecation warnings
1 parent 57d00e2 commit e42580a

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

ThreadFixProApi/threadfixpro.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import requests.exceptions
1414
import requests.packages.urllib3
1515

16+
import warnings
17+
1618
from _utils import *
1719

1820
class ThreadFixProAPI(object):
@@ -30,6 +32,8 @@ def __init__(self, host, api_key, verify_ssl=True, timeout=30, user_agent=None,
3032
the private key and the certificate) or as a tuple of both file’s path
3133
:param debug: Prints requests and responses, useful for debugging.
3234
"""
35+
# Deprecation warning
36+
warnings.warn('ThreadFixProAPI object is being changed to contain only links to ApplicationSec and NetworkSec APIs. This object as it is currently presented is being changed to ThreadFixProAPIApplications or ThreadFixProAPI.Applications', DeprecationWarning)
3337
self.TeamsAPI = TeamsAPI(host, api_key, verify_ssl, timeout, user_agent, cert, debug)
3438
self.ApplicationsAPI = ApplicationsAPI(host, api_key, verify_ssl, timeout, user_agent, cert, debug)
3539
self.DefectTrackersAPI = DefectTrackersAPI(host, api_key, verify_ssl, timeout, user_agent, cert, debug)

_utils/_cicd.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
__status__ = "Production"
88
__license__ = "MIT"
99

10+
import warnings
1011
import requests
1112
import urllib3
1213
import requests.exceptions
@@ -52,6 +53,7 @@ def create_cicd_pass_criteria(self, severity, max_allowed=None, max_introduced=N
5253
:param max_allowed: The maximum number of vulnerabilities allowed for the Pass Criteria. If no value is specified there is no limit.
5354
:param max_introduced: The maximum number of new vulnerabilities in a scan for the Pass Criteria. If no value is specified there is no limit.
5455
"""
56+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
5557
params = {'severity' : severity}
5658
if max_allowed:
5759
params['maxAllowed'] = max_allowed
@@ -67,6 +69,7 @@ def update_ci_cd_pass_criteria(self, cicd_id, severity, max_allowed=None, max_in
6769
:param max_allowed: The maximum number of vulnerabilities allowed for the Pass Criteria. If no value is specified there is no limit.
6870
:param max_introduced: The maximum number of new vulnerabilities in a scan for the Pass Criteria. If no value is specified there is no limit.
6971
"""
72+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
7073
params = {'severity' : severity}
7174
if max_allowed:
7275
params['maxAllowed'] = max_allowed
@@ -78,20 +81,23 @@ def list_cicd_pass_criteria(self):
7881
"""
7982
Lists CI/CD pass criteria
8083
"""
84+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
8185
return self._request('GET', 'rest/cicd/passCriteria')
8286

8387
def get_cicd_pass_criteria_details(self, cicd_id):
8488
"""
8589
Returns detailed information about the specified CI/CD pass criteria
8690
:param cicd_id: CI/CD identifier
8791
"""
92+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
8893
return self._request('GET', 'rest/cicd/passCriteria/' + str(cicd_id) + '/detail')
8994

9095
def delete_cicd_pass_criteria(self, cicd_id):
9196
"""
9297
Deletes the specified CI/CD pass criteria
9398
:param cicd_id: CI/CD identifier
9499
"""
100+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
95101
return self._request('DELETE', 'rest/cicd/passCriteria/' + str(cicd_id) + '/delete')
96102

97103
def add_application_to_cicd_pass_criteria(self, pass_criteria_id, application_id):
@@ -100,6 +106,7 @@ def add_application_to_cicd_pass_criteria(self, pass_criteria_id, application_id
100106
:param pass_criteria_id: Pass Criteria identifier
101107
:param application_id: Application identifier
102108
"""
109+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
103110
return self._request('PUT', 'rest/cicd/passCriteria/' + str(pass_criteria_id) + '/addApplication/' + str(application_id))
104111

105112
def remove_application_from_cicd_pass_criteria(self, pass_criteria_id, application_id):
@@ -108,6 +115,7 @@ def remove_application_from_cicd_pass_criteria(self, pass_criteria_id, applicati
108115
:param pass_criteria_id: Pass Criteria identifier
109116
:param application_id: Application identifier
110117
"""
118+
warnings.warn('This function has been deprecated in ThreadFix 2.8', DeprecationWarning)
111119
return self._request('DELETE', 'rest/cicd/passCriteria/' + str(pass_criteria_id) + '/removeApplication/' + str(application_id))
112120

113121
def evaluate_cicd_pass_criteria(self, application_id, from_date=None, to_date=None):

_utils/_vulnerabilities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ def mark_vulnerability_as_exploitable(self, vulnerability_id):
312312
Change the specified vulnerability to exploitable
313313
:param vulnerability_id: Vulnerability identifer
314314
"""
315+
warnings.warn('This function has been deprecated in ThreadFix 2.8.2', DeprecationWarning)
315316
return self._request('POST', 'rest/vulnerabilities/' + str(vulnerability_id) + '/setExploitable')
316317

317318
def mark_vulnerability_as_contested(self, vulnerability_id):

0 commit comments

Comments
 (0)