Package io.jenkins.plugins.oak9.utils
Class Oak9ApiClient
- java.lang.Object
-
- io.jenkins.plugins.oak9.utils.Oak9ApiClient
-
public class Oak9ApiClient extends Object
-
-
Constructor Summary
Constructors Constructor Description Oak9ApiClient(String baseUrl, String key, String orgId, String projectId, String projectEnvironmentId, int pollingTimeoutSeconds, TaskListener jenkinsTaskListener, okhttp3.OkHttpClient httpClient)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiResponse
pollStatus(ValidationResult result)
Poll oak9 for validation statusApiResponse
pollStatus(ValidationResult result, int attempts)
Poll oak9 for validation statusValidationResult
postFileValidation(String fileName, ByteArrayOutputStream file)
post file for validation endpoint without providing a starting count of attemptsValidationResult
postFileValidation(String fileName, ByteArrayOutputStream file, int attempts)
post file for validation endpoint with a starting count of attempts
-
-
-
Constructor Detail
-
Oak9ApiClient
public Oak9ApiClient(String baseUrl, String key, String orgId, String projectId, String projectEnvironmentId, int pollingTimeoutSeconds, TaskListener jenkinsTaskListener, okhttp3.OkHttpClient httpClient)
Constructor- Parameters:
baseUrl
-key
-orgId
-projectId
-projectEnvironmentId
-jenkinsTaskListener
-
-
-
Method Detail
-
postFileValidation
public ValidationResult postFileValidation(String fileName, ByteArrayOutputStream file) throws IOException, InterruptedException
post file for validation endpoint without providing a starting count of attempts- Parameters:
file
-- Returns:
- Throws:
IOException
InterruptedException
-
postFileValidation
public ValidationResult postFileValidation(String fileName, ByteArrayOutputStream file, int attempts) throws IOException, InterruptedException
post file for validation endpoint with a starting count of attempts- Parameters:
file
- the zip file to be postedattempts
- current number of attempts- Returns:
- the oak9 validation result
- Throws:
IOException
- thrown if the file is invalid or the oak9 API request failsInterruptedException
-
pollStatus
public ApiResponse pollStatus(ValidationResult result) throws IOException
Poll oak9 for validation status- Parameters:
result
- the scan for which we need to check the status- Returns:
- the validation result portion of the API response
- Throws:
IOException
- thrown if the oak9 api request fails
-
pollStatus
public ApiResponse pollStatus(ValidationResult result, int attempts) throws IOException
Poll oak9 for validation status- Parameters:
result
- the scan for which we need to check the statusattempts
- the number of attempts thus far- Returns:
- the ValidationResult portion of the API response
- Throws:
IOException
- thrown in the event of a communication failure with the oak9 API
-
-