Class HttpK8SJavaProxy
java.lang.Object
de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.AbstractK8SJavaProxy
de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.HttpK8SJavaProxy
- All Implemented Interfaces:
K8SJavaProxy
The Implementation of http apache for the Abstract class
AbstractK8SJavaProxy. K8S (Kubernetes)
- Author:
- Ahmad Alamoush, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.http.impl.client.CloseableHttpClientprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionHttpK8SJavaProxy(ProxyType proxyType, String serverIP, String serverPort, boolean tlsCheck) Creates a K8S java proxy instance, it will be either MasterProxy or WorkerProxy. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]executeK8SDelete(K8SRequest request) Execute DELETE request and send it to the MasterProxy.byte[]executeK8SGet(BufferedOutputStream writer, K8SRequest request) Execute GET request and send it to the MasterProxy.byte[]executeK8SPatch(K8SRequest request) Execute PATCH request and send it to the MasterProxy.byte[]executeK8SPost(K8SRequest request) Execute POST request and send it to the MasterProxy.byte[]executeK8SPut(K8SRequest request) Execute PUT request and send it to the MasterProxy.private org.apache.http.impl.client.CloseableHttpClientGet new connection with SSL security.Methods inherited from class de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.AbstractK8SJavaProxy
createK8SRequest, executeK8SJavaClientRequest, executeWatchK8SJavaClientRequest, extractK8SRequestByte, formatK8SResponse, formatK8SResponse, formatWatchK8SResponse, formatWatchK8SResponse, getProxyType, getServerAddress, getServerAddress, getServerSocket, sendK8SRequest, setProxyType, setServerAddress
-
Field Details
-
httpClient
private org.apache.http.impl.client.CloseableHttpClient httpClient -
tlsCheck
private boolean tlsCheck
-
-
Constructor Details
-
HttpK8SJavaProxy
public HttpK8SJavaProxy(ProxyType proxyType, String serverIP, String serverPort, boolean tlsCheck) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException Creates a K8S java proxy instance, it will be either MasterProxy or WorkerProxy. If it is MasterProxy then IP address and port will be to the K8S apiserver address and port If it is WorkerProxy then IP address and port will be to the MasterProxy address and port- Parameters:
proxyType- the type of the proxy (MasterProxy or WorkerProxy)serverIP- the IP Address of the server (either the MasterProxy or K8S apiserver)serverPort- the port of the server (either the MasterProxy or K8S apiserver)tlsCheck- check to use tls security- Throws:
IOExceptionCertificateExceptionKeyStoreExceptionNoSuchAlgorithmExceptionKeyManagementException
-
-
Method Details
-
executeK8SGet
public byte[] executeK8SGet(BufferedOutputStream writer, K8SRequest request) throws org.apache.http.client.ClientProtocolException, IOException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException Execute GET request and send it to the MasterProxy.- Parameters:
writer- is the output buffer to send watch request streamrequest- the K8S request object (K8SRequest)- Returns:
- the response from the MasterProxy for sent GET request
- Throws:
IOExceptionorg.apache.http.client.ClientProtocolExceptionCertificateExceptionKeyStoreExceptionNoSuchAlgorithmExceptionKeyManagementException
-
executeK8SPost
public byte[] executeK8SPost(K8SRequest request) throws org.apache.http.client.ClientProtocolException, IOException Execute POST request and send it to the MasterProxy.- Parameters:
request- the K8S request object (K8SRequest)- Returns:
- the response from the MasterProxy for sent POST request
- Throws:
IOExceptionorg.apache.http.client.ClientProtocolException
-
executeK8SPut
public byte[] executeK8SPut(K8SRequest request) throws org.apache.http.client.ClientProtocolException, IOException Execute PUT request and send it to the MasterProxy.- Parameters:
request- the K8S request object (K8SRequest)- Returns:
- the response from the MasterProxy for sent PUT request
- Throws:
IOExceptionorg.apache.http.client.ClientProtocolException
-
executeK8SPatch
public byte[] executeK8SPatch(K8SRequest request) throws org.apache.http.client.ClientProtocolException, IOException Execute PATCH request and send it to the MasterProxy.- Parameters:
request- the K8S request object (K8SRequest)- Returns:
- the response from the MasterProxy for sent PATCH request
- Throws:
IOExceptionorg.apache.http.client.ClientProtocolException
-
executeK8SDelete
public byte[] executeK8SDelete(K8SRequest request) throws org.apache.http.client.ClientProtocolException, IOException Execute DELETE request and send it to the MasterProxy.- Parameters:
request- the K8S request object (K8SRequest)- Returns:
- the response from the MasterProxy for sent DELETE request
- Throws:
IOExceptionorg.apache.http.client.ClientProtocolException
-
getSSLHttpClients
private org.apache.http.impl.client.CloseableHttpClient getSSLHttpClients() throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, KeyManagementExceptionGet new connection with SSL security.- Returns:
- httpClient the secured connection
- Throws:
NoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionIOExceptionKeyManagementException
-