public class ContrastSDK
extends java.lang.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(java.lang.String user,
java.lang.String serviceKey,
java.lang.String apiKey)
Create a ContrastSDK object to use the Contrast V3 API
|
ContrastSDK(java.lang.String user,
java.lang.String serviceKey,
java.lang.String apiKey,
java.lang.String restApiURL)
Create a ContrastSDK object to use the Contrast V3 API
|
ContrastSDK(java.lang.String user,
java.lang.String serviceKey,
java.lang.String apiKey,
java.lang.String restApiURL,
java.net.Proxy proxy)
Create a ContrastSDK object to use the Contrast V3 API through a Proxy.
|
| Modifier and Type | Method and Description |
|---|---|
Application |
createApplication(java.lang.String organizationId,
ApplicationCreateRequest request)
Creates an application without a server that is meant to be instrumented later.
|
void |
generateAttestationReport(java.lang.String organizationId,
java.lang.String appId,
AttestationCreateRequest request)
Generate an attestation report for the application whose ID is passed in.
|
byte[] |
getAgent(AgentType type,
java.lang.String organizationId)
Download a contrast.jar agent associated with this account.
|
byte[] |
getAgent(AgentType type,
java.lang.String organizationId,
java.lang.String profileName)
Download a contrast.jar agent associated with this account.
|
Applications |
getApplication(java.lang.String organizationId,
java.lang.String appId)
Get summary information about a single app without expandValues.
|
Applications |
getApplication(java.lang.String organizationId,
java.lang.String appId,
java.util.EnumSet<FilterForm.ApplicationExpandValues> expandValues)
Get summary information about a single app.
|
Application |
getApplicationByNameAndLanguage(java.lang.String orgId,
java.lang.String appName,
AgentType language)
Gets a single application based on the org, name, and language
|
Applications |
getApplications(java.lang.String organizationId)
Get the list of applications being monitored by Contrast.
|
Applications |
getApplicationsNames(java.lang.String organizationId) |
AssessLicenseOverview |
getAssessLicensing(java.lang.String organizationId)
Get all Assess Licensing for an Organizations.
|
Coverage |
getCoverage(java.lang.String organizationId,
java.lang.String appId)
Return coverage data about the monitored Contrast application.
|
Libraries |
getLibraries(java.lang.String organizationId,
java.lang.String appId) |
Libraries |
getLibraries(java.lang.String organizationId,
java.lang.String appId,
java.util.EnumSet<FilterForm.LibrariesExpandValues> expandValues)
Return the libraries of the monitored Contrast application.
|
LibraryScores |
getLibraryScores(java.lang.String organizationId)
Return the library Scores for an Organization.
|
LibraryStats |
getLibraryStats(java.lang.String organizationId)
Return the library Stats for an Organization.
|
Applications |
getLicensedApplications(java.lang.String organizationId)
Get the list of licensed applications being monitored by Contrast.
|
TraceNotesResponse |
getNotes(java.lang.String organizationId,
java.lang.String appId,
java.lang.String traceId,
TraceFilterForm form)
Get the notes (discussion) for the vulnerability ID in the application whose ID is passed in.
|
Users |
getOrganizationUsers(java.lang.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(java.lang.String organizationId)
Get the rules for an organization
|
Servers |
getServers(java.lang.String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
Servers |
getServersWithFilter(java.lang.String organizationId,
ServerFilterForm filterForm)
Return the servers of the monitored Contrast application.
|
MetadataFilterResponse |
getSessionMetadataForApplication(java.lang.String organizationId,
java.lang.String appId,
TraceFilterForm form)
Get the available session metadata values in the application whose ID is passed in.
|
Traces |
getTraceFilterByRule(java.lang.String organizationId,
java.lang.String appId,
java.util.List<java.lang.String> ruleNames)
Deprecated.
|
TraceListing |
getTraceFilters(java.lang.String organizationId,
java.lang.String appId)
Get the filters for the traces in the application.
|
Traces |
getTraces(java.lang.String organizationId,
java.lang.String appId,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in.
|
Traces |
getTracesInOrg(java.lang.String organizationId,
TraceFilterForm form)
Get the vulnerabilities in the organization whose ID is passed in.
|
Traces |
getTracesWithFilter(java.lang.String organizationId,
java.lang.String appId,
TraceFilterType traceFilterType,
TraceFilterKeycode keycode,
TraceFilterForm form)
Get the vulnerabilities in the application whose ID is passed in with a filter.
|
TagsResponse |
getVulnTagsByApplication(java.lang.String organizationId,
java.lang.String appId)
Get the available vulnerability tags in the application whose ID is passed in.
|
VulnerabilityTrend |
getYearlyNewVulnTrend(java.lang.String organizationId)
Get all Vulnerability Trend for an Organizations.
|
VulnerabilityTrend |
getYearlyVulnTrend(java.lang.String organizationId)
Get all Vulnerability Trend for an Organizations.
|
java.net.HttpURLConnection |
makeConnection(java.lang.String url,
java.lang.String method) |
java.io.InputStream |
makeRequest(HttpMethod method,
java.lang.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(java.lang.String user,
java.lang.String serviceKey,
java.lang.String apiKey,
java.lang.String restApiURL)
throws java.lang.IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLjava.lang.IllegalArgumentException - if the API URL is malformedpublic ContrastSDK(java.lang.String user,
java.lang.String serviceKey,
java.lang.String apiKey,
java.lang.String restApiURL,
java.net.Proxy proxy)
throws java.lang.IllegalArgumentException
user - Username (e.g., joe@acme.com)serviceKey - User service keyapiKey - API KeyrestApiURL - the base Contrast API URLproxy - Proxy to usejava.lang.IllegalArgumentException - if the API URL is malformedpublic ContrastSDK(java.lang.String user,
java.lang.String serviceKey,
java.lang.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(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic VulnerabilityTrend getYearlyVulnTrend(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic VulnerabilityTrend getYearlyNewVulnTrend(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Organizations getProfileOrganizations() throws java.io.IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Users getOrganizationUsers(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Organizations getProfileDefaultOrganizations() throws java.io.IOException, UnauthorizedException
UnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Application createApplication(java.lang.String organizationId, ApplicationCreateRequest request) throws java.io.IOException, UnauthorizedException, ApplicationCreateException
organizationId - request - java.io.IOExceptionUnauthorizedExceptionApplicationCreateExceptionpublic Application getApplicationByNameAndLanguage(java.lang.String orgId, java.lang.String appName, AgentType language) throws java.io.IOException, UnauthorizedException
orgId - ID of the organizationappName - Application name when the application was first createdlanguage - Language of the applicationjava.io.IOExceptionUnauthorizedExceptionpublic Applications getApplication(java.lang.String organizationId, java.lang.String appId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Applications getApplication(java.lang.String organizationId, java.lang.String appId, java.util.EnumSet<FilterForm.ApplicationExpandValues> expandValues) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationexpandValues - Expand values to filter onUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Applications getApplications(java.lang.String organizationId) throws UnauthorizedException, java.io.IOException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Applications getLicensedApplications(java.lang.String organizationId) throws UnauthorizedException, java.io.IOException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Applications getApplicationsNames(java.lang.String organizationId) throws UnauthorizedException, java.io.IOException
UnauthorizedExceptionjava.io.IOExceptionpublic Coverage getCoverage(java.lang.String organizationId, java.lang.String appId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Libraries getLibraries(java.lang.String organizationId, java.lang.String appId) throws java.io.IOException, UnauthorizedException
java.io.IOExceptionUnauthorizedExceptionpublic Libraries getLibraries(java.lang.String organizationId, java.lang.String appId, java.util.EnumSet<FilterForm.LibrariesExpandValues> expandValues) throws java.io.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 authorizejava.io.IOException - if there was a communication problempublic LibraryScores getLibraryScores(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic LibraryStats getLibraryStats(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Servers getServers(java.lang.String organizationId, ServerFilterForm filterForm) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Servers getServersWithFilter(java.lang.String organizationId, ServerFilterForm filterForm) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationfilterForm - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Traces getTraces(java.lang.String organizationId, java.lang.String appId, TraceFilterForm form) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic TraceNotesResponse getNotes(java.lang.String organizationId, java.lang.String appId, java.lang.String traceId, TraceFilterForm form) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationtraceId - the ID of the vulnerabilityform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic TagsResponse getVulnTagsByApplication(java.lang.String organizationId, java.lang.String appId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic MetadataFilterResponse getSessionMetadataForApplication(java.lang.String organizationId, java.lang.String appId, TraceFilterForm form) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic void generateAttestationReport(java.lang.String organizationId,
java.lang.String appId,
AttestationCreateRequest request)
throws java.io.IOException,
UnauthorizedException,
ApplicationCreateException
organizationId - the ID of the organizationappId - the ID of the applicationrequest - java.io.IOExceptionUnauthorizedExceptionApplicationCreateExceptionpublic Traces getTracesInOrg(java.lang.String organizationId, TraceFilterForm form) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationform - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic TraceListing getTraceFilters(java.lang.String organizationId, java.lang.String appId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Traces getTracesWithFilter(java.lang.String organizationId, java.lang.String appId, TraceFilterType traceFilterType, TraceFilterKeycode keycode, TraceFilterForm form) throws java.io.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 authorizejava.io.IOException - if there was a communication problem@Deprecated public Traces getTraceFilterByRule(java.lang.String organizationId, java.lang.String appId, java.util.List<java.lang.String> ruleNames) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationappId - the ID of the applicationruleNames - FilterForm query parametersUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic Rules getRules(java.lang.String organizationId) throws java.io.IOException, UnauthorizedException
organizationId - the ID of the organizationUnauthorizedException - if the Contrast account failed to authorizejava.io.IOException - if there was a communication problempublic byte[] getAgent(AgentType type, java.lang.String organizationId, java.lang.String profileName) throws java.io.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,java.io.IOException - if there was a communication problemUnauthorizedException - if authentication failspublic byte[] getAgent(AgentType type, java.lang.String organizationId) throws java.io.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,java.io.IOException - if there was a communication problemUnauthorizedException - if authentication failspublic java.io.InputStream makeRequest(HttpMethod method, java.lang.String path) throws java.io.IOException, UnauthorizedException
java.io.IOExceptionUnauthorizedExceptionpublic java.net.HttpURLConnection makeConnection(java.lang.String url,
java.lang.String method)
throws java.io.IOException
java.io.IOExceptionpublic void setConnectionTimeout(int timeout)
timeout - Timeout value in milliseconds.public void setReadTimeout(int timeout)
timeout - TImeout value in millisecondsCopyright © 2020 Contrast Security. All Rights Reserved.