public class ContrastSDK extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT
Default connection timeout.
|
static int |
DEFAULT_READ_TIMEOUT
Default read timeout.
|
| Constructor and Description |
|---|
ContrastSDK() |
ContrastSDK(String user,
String serviceKey,
String apiKey)
Create a ContrastSDK object to use the Contrast V3 API
|
ContrastSDK(String user,
String serviceKey,
String apiKey,
String restApiURL)
Create a ContrastSDK object to use the Contrast V3 API
|
ContrastSDK(String user,
String serviceKey,
String apiKey,
String restApiURL,
Proxy proxy)
Create a ContrastSDK object to use the Contrast V3 API through a Proxy.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getAgent(AgentType type,
String organizationId)
Download a contrast.jar agent associated with this account.
|
byte[] |
getAgent(AgentType type,
String organizationId,
String profileName)
Download a contrast.jar agent associated with this account.
|
Applications |
getApplication(String organizationId,
String appId)
Get summary information about a single app without expandValues.
|
Applications |
getApplication(String organizationId,
String appId,
EnumSet<FilterForm.ApplicationExpandValues> expandValues)
Get summary information about a single app.
|
Applications |
getApplications(String organizationId)
Get the list of applications being monitored by Contrast.
|
Applications |
getApplicationsNames(String organizationId) |
AssessLicenseOverview |
getAssessLicensing(String organizationId)
Get all Assess Licensing for an Organizations.
|
Coverage |
getCoverage(String organizationId,
String appId)
Return coverage data about the monitored Contrast application.
|
Libraries |
getLibraries(String organizationId,
String appId) |
Libraries |
getLibraries(String organizationId,
String appId,
EnumSet<FilterForm.LibrariesExpandValues> expandValues)
Return the libraries of the monitored Contrast application.
|
LibraryScores |
getLibraryScores(String organizationId)
Return the library Scores for an Organization.
|
LibraryStats |
getLibraryStats(String organizationId)
Return the library Stats for an Organization.
|
Users |
getOrganizationUsers(String organizationId)
Get all users for an organization.
|
Organizations |
getProfileDefaultOrganizations()
Get the default organization for the user profile.
|
Organizations |
getProfileOrganizations()
Get all organizations for the user profile.
|
Rules |
getRules(String organizationId)
Get the rules for an organization
|
Servers |
getServers(String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
Servers |
getServersWithFilter(String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
Traces |
getTraceFilterByRule(String organizationId,
String appId,
List<String> ruleNames)
Deprecated.
|
TraceListing |
getTraceFilters(String organizationId,
String appId)
Get the filters for the traces in the application.
|
Traces |
getTraces(String organizationId,
String appId,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in.
|
Traces |
getTracesInOrg(String organizationId,
TraceFilterForm form)
Get the vulnerabilities in the organization whose ID is passed in.
|
Traces |
getTracesWithFilter(String organizationId,
String appId,
TraceFilterType traceFilterType,
TraceFilterKeycode keycode,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in with a filter.
|
VulnerabilityTrend |
getYearlyVulnTrend(String organizationId)
Get all Vulnerability Trend for an Organizations.
|
HttpURLConnection |
makeConnection(String url,
String method) |
InputStream |
makeRequest(HttpMethod method,
String path) |
void |
setConnectionTimeout(int timeout)
Sets a custom connection timeout for all SDK requests.
|
void |
setReadTimeout(int timeout)
Set a custom read timeout for all SDK requests.
|
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
public ContrastSDK()
public ContrastSDK(String user, String serviceKey, String apiKey, String restApiURL) throws IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLIllegalArgumentException - if the API URL is malformedpublic ContrastSDK(String user, String serviceKey, String apiKey, String restApiURL, Proxy proxy) throws IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLproxy - Proxy to useIllegalArgumentException - if the API URL is malformedpublic ContrastSDK(String user, String serviceKey, String apiKey)
This will use the default api url which is https://app.contrastsecurity.com/Contrast/api
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API Keypublic AssessLicenseOverview getAssessLicensing(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic VulnerabilityTrend getYearlyVulnTrend(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Organizations getProfileOrganizations() throws IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Users getOrganizationUsers(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Organizations getProfileDefaultOrganizations() throws IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplication(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplication(String organizationId, String appId, EnumSet<FilterForm.ApplicationExpandValues> expandValues) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationexpandValues - Expand values to filter onUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplications(String organizationId) throws UnauthorizedException, IOException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Applications getApplicationsNames(String organizationId) throws UnauthorizedException, IOException
UnauthorizedExceptionIOExceptionpublic Coverage getCoverage(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Libraries getLibraries(String organizationId, String appId) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic Libraries getLibraries(String organizationId, String appId, EnumSet<FilterForm.LibrariesExpandValues> expandValues) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationexpandValues - Query params to add more info to responseUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic LibraryScores getLibraryScores(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic LibraryStats getLibraryStats(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Servers getServers(String organizationId, ServerFilterForm filterForm) throws IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Servers getServersWithFilter(String organizationId, ServerFilterForm filterForm) throws IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTraces(String organizationId, String appId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTracesInOrg(String organizationId, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic TraceListing getTraceFilters(String organizationId, String appId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Traces getTracesWithFilter(String organizationId, String appId, TraceFilterType traceFilterType, TraceFilterKeycode keycode, TraceFilterForm form) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationtraceFilterType - filter typekeycode - id or key to filter onform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problem@Deprecated public Traces getTraceFilterByRule(String organizationId, String appId, List<String> ruleNames) throws IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationruleNames - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic Rules getRules(String organizationId) throws IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizeIOException - if there was a communication problempublic byte[] getAgent(AgentType type, String organizationId, String profileName) throws IOException, UnauthorizedException
type - the type of agent you want to download; Java, Java 1.5, .NET, or NodeprofileName - the name of the saved engine profile to download,organizationId - the ID of the organization,IOException - if there was a communication problemUnauthorizedException - if authentication failspublic byte[] getAgent(AgentType type, String organizationId) throws IOException, UnauthorizedException
This uses 'default' as the profile name.
type - the type of agent you want to download; Java, Java 1.5, .NET, or NodeorganizationId - the ID of the organization,IOException - if there was a communication problemUnauthorizedException - if authentication failspublic InputStream makeRequest(HttpMethod method, String path) throws IOException, UnauthorizedException
IOExceptionUnauthorizedExceptionpublic HttpURLConnection makeConnection(String url, String method) throws IOException
IOExceptionpublic void setConnectionTimeout(int timeout)
timeout - Timeout value in milliseconds.public void setReadTimeout(int timeout)
timeout - TImeout value in millisecondsCopyright © 2019 Contrast Security. All rights reserved.