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 String |
getContainerRegistryIdFromName(String containerRegistryName,
String authCredentials) |
static String |
getEnvContainerIdFromName(String confId,
String containerName,
String authCredentials) |
static com.google.gson.JsonObject |
getJsonObjectFromFile(hudson.model.AbstractBuild build,
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(hudson.model.AbstractBuild build,
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 |
getVMContainerIdFromName(String confId,
String vmId,
String containerName,
String authCredentials) |
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
SkytapException
public static String getContainerRegistryIdFromName(String containerRegistryName, String authCredentials) throws SkytapException
SkytapException
public static String getVMContainerIdFromName(String confId, String vmId, String containerName, String authCredentials) throws SkytapException
SkytapException
public static String getEnvContainerIdFromName(String confId, String containerName, String authCredentials) throws SkytapException
SkytapException
public static com.google.gson.JsonObject getJsonObjectFromFile(hudson.model.AbstractBuild build, 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
- SkytapException
IOException
org.apache.http.ParseException
public static String executeHttpDeleteRequest(org.apache.http.client.methods.HttpDelete hd)
hd
- SkytapException
public static void checkResponseForErrors(String response) throws SkytapException
response
- SkytapException
public static String getRuntimeId(hudson.model.AbstractBuild build, String usersId, String usersFile) throws FileNotFoundException
confId
- FileNotFoundException
public 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
- SkytapException
Copyright © 2004-2019. All Rights Reserved.