See: Description
| Interface | Description |
|---|---|
| CodeArtifact |
Describes the Contrast Scan code artifact resource.
|
| CodeArtifacts |
Code artifact resource collection.
|
| CodeArtifacts.Factory |
Factory for
CodeArtifacts |
| Project |
Describes the Contrast Scan project resource.
|
| Project.Definition |
Builder for defining a new project resource.
|
| Projects |
Project resource collection.
|
| Projects.Factory |
Factory for
Projects |
| Scan |
Describes a scan resource.
|
| Scan.Definition |
Builder for defining a new scan.
|
| ScanManager |
Manager for Contrast Scan resource collections.
|
| Scans |
Scan resource collection API.
|
| Scans.Factory |
Factory for
Scans |
| ScanSummary |
Summary of a Scan and its results.
|
| Class | Description |
|---|---|
| ScanManagerImpl |
Implementation of
ScanManager. |
| Enum | Description |
|---|---|
| ScanStatus |
Describes the possible states that a scan can have
|
| Exception | Description |
|---|---|
| ScanException |
Indicates a condition that prevents Contrast Scan from completing an analysis
|
ContrastSDK.scan(java.lang.String).
Sample:
ContrastSDKcontrast = newContrastSDK.Builder("username", "my-service-key", "my-api-key").build();ScanManagerscanManager = contrast.scan("organization-id");Projectsprojects = scanManager.projects();Projectproject = projects .findByName("spring-test-application") .orElseGet( () -> { try { return projects .define() .withName("spring-test-application") .withLanguage("JAVA") .create(); } catch (IOExceptione) { throw newUncheckedIOException(e); } });Pathfile =Paths.get("./target/spring-test-application.jar");CodeArtifactcodeArtifact = project.codeArtifacts().upload(file);Scanscan = project.scans().define().withExistingCodeArtifact(codeArtifact).create();ScheduledExecutorServicescheduler =Executors.newSingleThreadScheduledExecutor(); try { scan.await(scheduler) .thenAccept( s -> { try { s.saveSarif(Paths.get("./contrast-scan-results.sarif.json"));ScanSummarysummary = s.summary();System.out.printf("Found %d total results%n", summary.totalResults()); } catch (IOExceptione) { throw newUncheckedIOException(e); } }) .toCompletableFuture() .join(); } finally { scheduler.shutdown(); }
Copyright © 2022 Contrast Security, Inc.. All rights reserved.