Class FortifyClient
- java.lang.Object
-
- com.fortify.plugin.jenkins.fortifyclient.FortifyClient
-
public class FortifyClient extends Object
FortifyClient is basically a wrapper around SSC's REST client API
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FortifyClient.Command<T>
static class
FortifyClient.NoReturn
-
Constructor Summary
Constructors Constructor Description FortifyClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
createProject(String projectName, String projectVersionName, String projectTemplateName, Map<String,String> attributeNamesAndValues, PrintWriter log)
Create new or retrieve existing application version on SSCMap<String,Map<String,Long>>
getAllVersionListEx(String query, Integer limit)
Retrieve the application version list from SSCcom.fortify.ssc.restclient.model.Artifact
getArtifactInfo(Long artifactId)
Map<String,String>
getCloudScanPoolList()
Retrieve the CloudScan Pool list from SSCMap<String,String>
getFilterSetListEx(Long verId)
Retrieve the list of FilterSets for the @verId from SSCMap<String,List<String>>
getFolderIdToAttributesList(Long versionId, String filterSetGuid, PrintWriter log)
Returns all enabled folder ids with their attributes.List<GroupingProfile>
getGroupingProfiles(Long versionId, String filterSet, PrintWriter log)
Map<String,List<String>>
getGroupingValues(Long projectVersionId, String folderId, String filterSet, String searchCondition, String groupingName, PrintWriter log)
Returns all issues matched specified search condition with their attributes.Map<String,List<String>>
getGroupingValues(Long projectVersionId, String folderId, String filterSet, String searchCondition, String groupingName, String groupingType, PrintWriter log)
Map<String,IssueBean>
getIssuesByFolderId(Long projectVersionId, String folderId, int startPage, int pageSize, String filterSet, String groupingName, String sortOrder, Boolean ShowOnlyNewIssues, Boolean sortDownNotUp, PrintWriter log)
Returns all issues in the specified folder with their attributes.Map<String,Long>
getProjectList(String query, int limit)
Retrieve the application list from SSCMap<String,String>
getProjectTemplateList()
Retrieve the issue template list from SSCLong
getProjectVersionId(String appName, String appVersionName)
Retrieves application version id from SSC by given application name and application version name.Map<String,Long>
getVersionListEx(Long appId, String query, int limit)
Retrieve the application version list for the @appId from SSCvoid
init(String uri, String token, ProxyConfig proxyConfig, Integer connectTimeoutSeconds, Integer readTimeoutSeconds, Integer writeTimeoutSeconds)
You have to call this init function before performance any operationsLong
uploadFPR(File fpr, Long appVersionId)
Upload an FPR to SSC server
-
-
-
Method Detail
-
init
public void init(String uri, String token, ProxyConfig proxyConfig, Integer connectTimeoutSeconds, Integer readTimeoutSeconds, Integer writeTimeoutSeconds) throws com.fortify.ssc.restclient.ApiException
You have to call this init function before performance any operations- Parameters:
uri
- e.g. https://localhost:8180/ssctoken
- e.g. the AuditToken- Throws:
com.fortify.ssc.restclient.ApiException
-
getAllVersionListEx
public Map<String,Map<String,Long>> getAllVersionListEx(String query, Integer limit) throws com.fortify.ssc.restclient.ApiException
Retrieve the application version list from SSC- Returns:
- Map
- Throws:
com.fortify.ssc.restclient.ApiException
-
getVersionListEx
public Map<String,Long> getVersionListEx(Long appId, String query, int limit) throws com.fortify.ssc.restclient.ApiException
Retrieve the application version list for the @appId from SSC- Parameters:
appId
-- Returns:
- Map
> - Throws:
com.fortify.ssc.restclient.ApiException
-
getProjectList
public Map<String,Long> getProjectList(String query, int limit) throws com.fortify.ssc.restclient.ApiException
Retrieve the application list from SSC- Returns:
- Map
- Throws:
com.fortify.ssc.restclient.ApiException
-
getProjectTemplateList
public Map<String,String> getProjectTemplateList() throws com.fortify.ssc.restclient.ApiException
Retrieve the issue template list from SSC- Returns:
- map container where template name maps to template id
- Throws:
com.fortify.ssc.restclient.ApiException
-
getCloudScanPoolList
public Map<String,String> getCloudScanPoolList() throws com.fortify.ssc.restclient.ApiException
Retrieve the CloudScan Pool list from SSC- Returns:
- map container where pool name maps to pool uuid
- Throws:
com.fortify.ssc.restclient.ApiException
-
uploadFPR
public Long uploadFPR(File fpr, Long appVersionId) throws com.fortify.ssc.restclient.ApiException
Upload an FPR to SSC server- Parameters:
fpr
- the FPR file to be uploadedappVersionId
- the SSC application version ID- Throws:
com.fortify.ssc.restclient.ApiException
-
getArtifactInfo
public com.fortify.ssc.restclient.model.Artifact getArtifactInfo(Long artifactId) throws com.fortify.ssc.restclient.ApiException
- Throws:
com.fortify.ssc.restclient.ApiException
-
createProject
public Long createProject(String projectName, String projectVersionName, String projectTemplateName, Map<String,String> attributeNamesAndValues, PrintWriter log) throws IOException, com.fortify.ssc.restclient.ApiException
Create new or retrieve existing application version on SSC- Parameters:
projectName
- name of the new applicationprojectVersionName
- version of the new application versionprojectTemplateName
- name of the template used for application creation, may benull
attributeNamesAndValues
- attributes for the new applicationlog
- logger- Returns:
- Long Application version Id of the created application version
- Throws:
com.fortify.ssc.restclient.ApiException
IOException
-
getIssuesByFolderId
public Map<String,IssueBean> getIssuesByFolderId(Long projectVersionId, String folderId, int startPage, int pageSize, String filterSet, String groupingName, String sortOrder, Boolean ShowOnlyNewIssues, Boolean sortDownNotUp, PrintWriter log) throws com.fortify.ssc.restclient.ApiException
Returns all issues in the specified folder with their attributes.- Parameters:
projectVersionId
- id of the application version to audit- Returns:
- Map
- Throws:
com.fortify.ssc.restclient.ApiException
-
getGroupingValues
public Map<String,List<String>> getGroupingValues(Long projectVersionId, String folderId, String filterSet, String searchCondition, String groupingName, String groupingType, PrintWriter log) throws com.fortify.ssc.restclient.ApiException
- Throws:
com.fortify.ssc.restclient.ApiException
-
getGroupingValues
public Map<String,List<String>> getGroupingValues(Long projectVersionId, String folderId, String filterSet, String searchCondition, String groupingName, PrintWriter log) throws com.fortify.ssc.restclient.ApiException
Returns all issues matched specified search condition with their attributes.- Parameters:
projectVersionId
- id of the application version to audit- Returns:
- Map
> map of attribute id -> list of attributes: package, className, function, sourceFilePath, filePath, lineNumber, url, groupName, assignedUser, category, type, confidence, severity - Throws:
com.fortify.ssc.restclient.ApiException
-
getFolderIdToAttributesList
public Map<String,List<String>> getFolderIdToAttributesList(Long versionId, String filterSetGuid, PrintWriter log) throws com.fortify.ssc.restclient.ApiException
Returns all enabled folder ids with their attributes.- Parameters:
versionId
- id of the application version to audit- Returns:
- Map
> map of folder id -> list of attributes: name, description, color, totalIssueCount - Throws:
com.fortify.ssc.restclient.ApiException
-
getProjectVersionId
public Long getProjectVersionId(String appName, String appVersionName) throws com.fortify.ssc.restclient.ApiException
Retrieves application version id from SSC by given application name and application version name.- Parameters:
appName
-appVersionName
-- Returns:
- application version id
- Throws:
com.fortify.ssc.restclient.ApiException
-
getGroupingProfiles
public List<GroupingProfile> getGroupingProfiles(Long versionId, String filterSet, PrintWriter log) throws com.fortify.ssc.restclient.ApiException
- Throws:
com.fortify.ssc.restclient.ApiException
-
-