-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JAVA-8886 refactor ContrastSDK initiliazation
- Loading branch information
1 parent
5ae7fc3
commit 0cf6610
Showing
7 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
14 changes: 12 additions & 2 deletions
14
gradle-plugin/src/main/java/com/contrastsecurity/gradle/plugin/ContrastGradlePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
gradle-plugin/src/main/java/com/contrastsecurity/gradle/plugin/ContrastSDKService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.contrastsecurity.gradle.plugin; | ||
|
||
import com.contrastsecurity.sdk.ContrastSDK; | ||
import com.contrastsecurity.sdk.UserAgentProduct; | ||
|
||
public class ContrastSDKService { | ||
|
||
private static ContrastSDK INSTANCE = null; | ||
|
||
public static void initializeSdk( | ||
final String username, final String serviceKey, final String apiKey, final String apiUrl) { | ||
final UserAgentProduct gradle = UserAgentProduct.of("contrast-gradle-plugin"); | ||
INSTANCE = | ||
new ContrastSDK.Builder(username, serviceKey, apiKey) | ||
.withApiUrl(apiUrl + "/api") | ||
// TODO JAVA-8883 figure out how to define this proxy | ||
// .withProxy(proxy) //with proxy? | ||
.withUserAgentProduct(gradle) | ||
.build(); | ||
} | ||
|
||
public static ContrastSDK getSdk() { | ||
return INSTANCE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
gradle-plugin/src/main/java/com/contrastsecurity/gradle/plugin/ResolveAgentTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.contrastsecurity.gradle.plugin; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.tasks.TaskAction; | ||
|
||
public class ResolveAgentTask extends DefaultTask { | ||
|
||
@TaskAction | ||
void resolveAgent() { | ||
System.out.println("Resolved Agent"); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...lugin/ContrastConfigurationExtension.java → ...sions/ContrastConfigurationExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters