Package com.veertu.ankaMgmtSdk
Class AnkaMgmtCommunicator
java.lang.Object
com.veertu.ankaMgmtSdk.AnkaMgmtCommunicator
- Direct Known Subclasses:
AnkaMgmtClientCertAuthCommunicator
,AnkaMgmtOpenIdCommunicator
Created by asafgur on 09/05/2017.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected org.apache.http.client.CredentialsProvider
protected org.apache.http.impl.client.CloseableHttpClient
protected int
protected final int
protected URL
protected String
protected RoundRobin
protected boolean
protected final int
-
Constructor Summary
ConstructorDescriptionAnkaMgmtCommunicator
(String mgmtURL, boolean skipTLSVerification) AnkaMgmtCommunicator
(String mgmtUrl, boolean skipTLSVerification, String rootCA) AnkaMgmtCommunicator
(String mgmtUrl, String rootCA) AnkaMgmtCommunicator
(List<String> mgmtURLS, boolean skipTLSVerification, String rootCA) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addHeaders
(org.apache.http.client.methods.HttpRequestBase request) protected org.json.JSONObject
doRequest
(AnkaMgmtCommunicator.RequestMethod method, String path, org.json.JSONObject requestBody) protected org.json.JSONObject
doRequest
(AnkaMgmtCommunicator.RequestMethod method, String path, org.json.JSONObject requestBody, int reqTimeout) int
protected org.apache.http.impl.client.CloseableHttpClient
List
<org.json.JSONObject> protected KeyStore
int
getNodes()
getSaveImageStatus
(String reqId) protected SSLContext
getSSLContext
(KeyStore keystore) getTemplateTags
(String templateId) protected org.apache.http.ssl.TrustStrategy
list()
protected org.apache.http.impl.client.CloseableHttpClient
protected org.apache.http.client.config.RequestConfig
makeRequestConfig
(int reqTimeout, String host) protected StringBuffer
readHttpEntity
(org.apache.http.HttpEntity entity) void
revertRegistryVM
(String templateID) saveImage
(String instanceId, String targetVMId, String newTemplateName, String tag, String description, Boolean suspend, String shutdownScript, Boolean revertBeforePush, String revertTag, Boolean doSuspendTest) protected org.apache.http.client.methods.HttpRequestBase
setBody
(org.apache.http.client.methods.HttpEntityEnclosingRequestBase request, org.json.JSONObject requestBody) void
setConnectionKeepAliveSeconds
(int connectionKeepAliveSeconds) void
setMaxConections
(int maxConections) startVm
(String templateId, String tag, String nameTemplate, String startUpScript, String groupId, int priority, String name, String externalId, int vcpu, int vram) status()
boolean
terminateVm
(String sessionId) void
-
Field Details
-
mgmtUrl
-
timeout
protected final int timeout- See Also:
-
maxRetries
protected final int maxRetries- See Also:
-
skipTLSVerification
protected boolean skipTLSVerification -
rootCA
-
roundRobin
-
maxConnections
protected int maxConnections -
credentialsProvider
protected org.apache.http.client.CredentialsProvider credentialsProvider -
connectionKeepAliveSeconds
protected int connectionKeepAliveSeconds -
httpClient
protected transient org.apache.http.impl.client.CloseableHttpClient httpClient
-
-
Constructor Details
-
AnkaMgmtCommunicator
-
AnkaMgmtCommunicator
-
AnkaMgmtCommunicator
-
AnkaMgmtCommunicator
-
AnkaMgmtCommunicator
-
-
Method Details
-
getMaxConections
public int getMaxConections() -
setMaxConections
public void setMaxConections(int maxConections) -
getConnectionKeepAliveSeconds
public int getConnectionKeepAliveSeconds() -
setConnectionKeepAliveSeconds
public void setConnectionKeepAliveSeconds(int connectionKeepAliveSeconds) -
listTemplates
- Throws:
AnkaMgmtException
-
getTemplateTags
- Throws:
AnkaMgmtException
-
getNodeGroups
- Throws:
AnkaMgmtException
-
startVm
public String startVm(String templateId, String tag, String nameTemplate, String startUpScript, String groupId, int priority, String name, String externalId, int vcpu, int vram) throws AnkaMgmtException - Throws:
AnkaMgmtException
-
showVm
- Throws:
AnkaMgmtException
-
terminateVm
- Throws:
AnkaMgmtException
-
list
- Throws:
AnkaMgmtException
-
status
- Throws:
AnkaMgmtException
-
saveImage
-
getSaveImageStatus
- Throws:
AnkaMgmtException
-
revertRegistryVM
- Throws:
AnkaMgmtException
-
getImageRequests
- Throws:
AnkaMgmtException
-
updateVM
public void updateVM(String id, String name, String jenkinsNodeLink, String jobIdentifier) throws AnkaMgmtException - Throws:
AnkaMgmtException
-
getNodes
- Throws:
AnkaMgmtException
-
addHeaders
protected void addHeaders(org.apache.http.client.methods.HttpRequestBase request) throws AnkaMgmtException, ClientException - Throws:
AnkaMgmtException
ClientException
-
doRequest
protected org.json.JSONObject doRequest(AnkaMgmtCommunicator.RequestMethod method, String path, org.json.JSONObject requestBody) throws IOException, AnkaMgmtException - Throws:
IOException
AnkaMgmtException
-
doRequest
protected org.json.JSONObject doRequest(AnkaMgmtCommunicator.RequestMethod method, String path, org.json.JSONObject requestBody, int reqTimeout) throws IOException, AnkaMgmtException - Throws:
IOException
AnkaMgmtException
-
readHttpEntity
- Throws:
IOException
-
getHttpClient
protected org.apache.http.impl.client.CloseableHttpClient getHttpClient() throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException -
makeRequestConfig
protected org.apache.http.client.config.RequestConfig makeRequestConfig(int reqTimeout, String host) -
makeHttpClient
protected org.apache.http.impl.client.CloseableHttpClient makeHttpClient() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException, CertificateException, IOException, UnrecoverableKeyException -
getSSLContext
protected SSLContext getSSLContext(KeyStore keystore) throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException -
getKeyStore
protected KeyStore getKeyStore() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException -
getTrustStrategy
protected org.apache.http.ssl.TrustStrategy getTrustStrategy() -
setBody
protected org.apache.http.client.methods.HttpRequestBase setBody(org.apache.http.client.methods.HttpEntityEnclosingRequestBase request, org.json.JSONObject requestBody) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-