public final class EnterpriseRestClient extends Object implements EnterpriseClient
| Constructor and Description |
|---|
EnterpriseRestClient(HttpClientService clientService,
String restEndPointUrl,
ApiSerializer apiSerializer,
ContentHelper contentHelper,
LoggerFacade logger)
Instantiates a new instance of the EnterpriseClient class
|
| Modifier and Type | Method and Description |
|---|---|
Optional<List<ClientIdNamePair>> |
getClientNameIdPairs(String authToken)
gets an array of all name/id pairs of clients that the authorized user can access
|
Optional<String[]> |
getConfigNames(String authToken)
returns String[] of scan config names
|
Optional<String> |
getEngineGroupIdFromName(String authToken,
String engineGroupName)
fetches the unique id of the engine group given by engineGroupName
|
Optional<String[]> |
getEngineGroupNamesForClient(String authToken)
fetches the names of available engine groups
|
Optional<InputStream> |
getReportZip(String authToken,
String scanId)
provides InputStream for the request report zip
|
Optional<String> |
getScanStatus(String authToken,
String scanId)
gets the current status of the scan identified by scanId
|
String |
getUrl()
returns the full URL for the enterprise rest endpoint
|
Optional<String> |
getVulnerabilitiesSummaryXml(String authToken,
String scanId)
gets the vulnerability summary XML as a String
|
boolean |
hasReport(String authToken,
String scanId)
determines if a scan identified by scanId has a report or not
|
boolean |
isScanFinished(String authToken,
String scanId)
determines if the scan identified by scanId has finished
|
Optional<String> |
login(AuthenticationModel authModel)
calls the /Authentication/Login endpoint with provided details
|
ScanResult |
runScanByConfigName(String authToken,
String configName)
starts a new scan using configuration matching configName
|
boolean |
saveConfig(String authToken,
String name,
URL url,
String engineGroupId)
calls the /Configs/SaveConfig endpoint using the provided data to create or update a configuration
|
boolean |
testAuthentication(AuthenticationModel authModel)
calls the /Authentication/Login endpoint with provided details returning true if credentials are valid
|
public EnterpriseRestClient(HttpClientService clientService, String restEndPointUrl, ApiSerializer apiSerializer, ContentHelper contentHelper, LoggerFacade logger)
clientService - helper that works directly with lower level HttpClient methodsrestEndPointUrl - base endpoint including /rest/v1 or equilvalent pathapiSerializer - Helper class providing handling of HttpResponse to JSONObject methodscontentHelper - Helper class providing parsing and encoding methods to support api callslogger - logger used for diagnostic outputIllegalArgumentException - thrown if any of the arguments are null or if restEntPointUrl is emptypublic String getUrl()
getUrl in interface EnterpriseClientpublic Optional<String> login(AuthenticationModel authModel)
login in interface EnterpriseClientauthModel - authentication details such as username, password and optionally clientIdpublic boolean testAuthentication(AuthenticationModel authModel)
testAuthentication in interface EnterpriseClientauthModel - authentication details such as username, password and optionally clientIdpublic Optional<String[]> getEngineGroupNamesForClient(String authToken)
getEngineGroupNamesForClient in interface EnterpriseClientauthToken - authorization token required to execute requestpublic Optional<String> getEngineGroupIdFromName(String authToken, String engineGroupName)
getEngineGroupIdFromName in interface EnterpriseClientauthToken - authorization token required to execute requestengineGroupName - name of the engine to get the id ofpublic ScanResult runScanByConfigName(String authToken, String configName)
runScanByConfigName in interface EnterpriseClientauthToken - authorization token required to execute requestconfigName - name of the config to runpublic Optional<String> getScanStatus(String authToken, String scanId)
getScanStatus in interface EnterpriseClientauthToken - authorization token required to execute requestscanId - unique scan identifier of the scanpublic boolean isScanFinished(String authToken, String scanId)
isScanFinished in interface EnterpriseClientauthToken - authorization token required to execute requestscanId - unique scan identifier of the scanpublic boolean hasReport(String authToken, String scanId)
hasReport in interface EnterpriseClientauthToken - authorization token required to execute requestscanId - unique scan identifier of the scanpublic Optional<String[]> getConfigNames(String authToken)
getConfigNames in interface EnterpriseClientauthToken - authorization token required to execute requestpublic boolean saveConfig(String authToken, String name, URL url, String engineGroupId)
saveConfig in interface EnterpriseClientauthToken - authorization token required to execute requestname - name of the scanconfig to saveurl - target URL for the scanengineGroupId - unique engine group id for the engine(s) to be used to execute the scanpublic Optional<String> getVulnerabilitiesSummaryXml(String authToken, String scanId)
getVulnerabilitiesSummaryXml in interface EnterpriseClientauthToken - authorization token required to execute requestscanId - unique scan identifier of the scan to provide report forpublic Optional<InputStream> getReportZip(String authToken, String scanId)
getReportZip in interface EnterpriseClientauthToken - authorization token required to execute requestscanId - unique scan identifier of the scan to provide report forpublic Optional<List<ClientIdNamePair>> getClientNameIdPairs(String authToken)
getClientNameIdPairs in interface EnterpriseClientauthToken - authorization token required to execute requestCopyright © 2016–2021. All rights reserved.