public class SkytapUtils extends Object
| Constructor and Description |
|---|
SkytapUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.http.client.methods.HttpDelete |
buildHttpDeleteRequest(String requestUrl,
String AuthToken)
This method returns an http delete request object, given a url and the
encoded Skytap authorization token.
|
static org.apache.http.client.methods.HttpGet |
buildHttpGetRequest(String requestUrl,
String AuthToken)
This method packages an http get request object, given a url and the
encoded Skytap authorization token.
|
static org.apache.http.client.methods.HttpPost |
buildHttpPostRequest(String requestUrl,
String AuthToken)
This method packages an http post request object, given a url and the
encoded Skytap authorization token.
|
static org.apache.http.client.methods.HttpPut |
buildHttpPutRequest(String requestUrl,
String AuthToken)
This method returns an http put request object, given a url and the
encoded Skytap authorization token.
|
static void |
checkResponseForErrors(String response)
Utility method to extract errors, if any, from the Skytap json response,
and throw an exception which can be handled by the caller.
|
static String |
convertFileNameToFullPath(hudson.model.AbstractBuild build,
String savefile)
Prepends the workspace path to a save file name as a default if user has
not provided a full path.
|
static String |
executeHttpDeleteRequest(org.apache.http.client.methods.HttpDelete hd)
Utility method used to execute an http delete.
|
static String |
executeHttpRequest(org.apache.http.client.methods.HttpRequestBase hr)
Utility method to execute any type of http request (except delete), to
catch any exceptions thrown and return the response string.
|
static String |
expandEnvVars(hudson.model.AbstractBuild build,
String targetString)
This method is used to enable Jenkins variable expansion.
|
static String |
getAuthCredentials(hudson.model.AbstractBuild build)
Retrieves user id and auth key from the project build environment,
encodes and returns encoded credential string to the user.
|
static com.google.gson.JsonObject |
getJsonObjectFromFile(String filepath)
This is a utility method used to get the json object in json file used
for configs, templates, etc.
|
static String |
getNetworkIdFromName(String confId,
String netName,
String authCredential)
Executes a Skytap API call in order to get the network id of the network
whose name was provided by the user.
|
static String |
getProjectID(String projName,
String authCredentials)
Makes call to skytap to retrieve the id of a named project.
|
static String |
getRuntimeId(String usersId,
String usersFile)
This method is used to obtain an id.
|
static String |
getValueFromJsonResponseBody(String jsonRespBody,
String key)
This is a utility method to help retrieve a json element from the
response body.
|
static String |
getVMIDFromName(String confId,
String vname,
String authCredentials) |
public static String expandEnvVars(hudson.model.AbstractBuild build, String targetString)
build - targetString - public static String getVMIDFromName(String confId, String vname, String authCredentials) throws SkytapException
SkytapExceptionpublic static com.google.gson.JsonObject getJsonObjectFromFile(String filepath)
filepath - public static String getValueFromJsonResponseBody(String jsonRespBody, String key)
jsonRespBody - public static String getAuthCredentials(hudson.model.AbstractBuild build)
AbstractBuild - public static org.apache.http.client.methods.HttpGet buildHttpGetRequest(String requestUrl, String AuthToken)
requestUrl - AuthToken - public static org.apache.http.client.methods.HttpPost buildHttpPostRequest(String requestUrl, String AuthToken)
requestUrl - AuthToken - public static org.apache.http.client.methods.HttpPut buildHttpPutRequest(String requestUrl, String AuthToken)
requestUrl - AuthToken - public static org.apache.http.client.methods.HttpDelete buildHttpDeleteRequest(String requestUrl, String AuthToken)
requestUrl - AuthToken - public static String executeHttpRequest(org.apache.http.client.methods.HttpRequestBase hr) throws SkytapException
hr - SkytapExceptionIOExceptionorg.apache.http.ParseExceptionpublic static String executeHttpDeleteRequest(org.apache.http.client.methods.HttpDelete hd)
hd - SkytapExceptionpublic static void checkResponseForErrors(String response) throws SkytapException
response - SkytapExceptionpublic static String getRuntimeId(String usersId, String usersFile) throws FileNotFoundException
confId - FileNotFoundExceptionpublic static String getProjectID(String projName, String authCredentials)
projName - authCredentials - public static String convertFileNameToFullPath(hudson.model.AbstractBuild build, String savefile)
build - savefile - public static String getNetworkIdFromName(String confId, String netName, String authCredential) throws SkytapException
confId - netName - SkytapExceptionCopyright © 2004-2016. All Rights Reserved.