public class OperationSupport extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
apiGroupName |
protected String |
apiGroupVersion |
protected okhttp3.OkHttpClient |
client |
protected Config |
config |
protected OperationContext |
context |
static okhttp3.MediaType |
JSON |
protected static com.fasterxml.jackson.databind.ObjectMapper |
JSON_MAPPER |
static okhttp3.MediaType |
JSON_PATCH |
protected String |
name |
protected String |
namespace |
protected String |
resourceT |
protected static com.fasterxml.jackson.databind.ObjectMapper |
YAML_MAPPER |
Constructor and Description |
---|
OperationSupport() |
OperationSupport(okhttp3.OkHttpClient client,
Config config) |
OperationSupport(okhttp3.OkHttpClient client,
Config config,
String namespace) |
OperationSupport(OperationContext ctx) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertResponseCode(okhttp3.Request request,
okhttp3.Response response)
Checks if the response status code is the expected and throws the appropriate KubernetesClientException if not.
|
protected <T> String |
checkName(T item) |
protected <T> String |
checkNamespace(T item) |
static io.fabric8.kubernetes.api.model.Status |
createStatus(int statusCode,
String message) |
static io.fabric8.kubernetes.api.model.Status |
createStatus(okhttp3.Response response) |
String |
getAPIGroup() |
String |
getAPIVersion() |
Config |
getConfig() |
String |
getName() |
String |
getNamespace() |
URL |
getNamespacedUrl() |
URL |
getNamespacedUrl(String namespace) |
<T> URL |
getNamespacedUrl(T item) |
String |
getResourceT() |
URL |
getResourceUrl() |
URL |
getResourceUrl(String namespace,
String name) |
URL |
getRootUrl() |
protected <T,I> T |
handleCreate(I resource,
Class<T> outputType)
Create a resource.
|
protected <T> void |
handleDelete(T resource,
long gracePeriodSeconds,
String propagationPolicy,
boolean cascading) |
protected void |
handleDelete(URL requestUrl,
long gracePeriodSeconds,
String propagationPolicy,
boolean cascading) |
protected io.fabric8.kubernetes.api.model.Status |
handleDeploymentRollback(String resourceUrl,
io.fabric8.kubernetes.api.model.extensions.DeploymentRollback deploymentRollback)
Create rollback of a Deployment
|
protected <T> T |
handleGet(URL resourceUrl,
Class<T> type)
Send an http get.
|
protected <T> T |
handleGet(URL resourceUrl,
Class<T> type,
Map<String,String> parameters)
Send an http, optionally performing placeholder substitution to the response.
|
protected <T> T |
handleMetric(String resourceUrl,
Class<T> type) |
protected <T> T |
handlePatch(T current,
T updated,
Class<T> type)
Send an http patch and handle the response.
|
protected <T> T |
handleReplace(T updated,
Class<T> type)
Replace a resource.
|
protected <T> T |
handleReplace(T updated,
Class<T> type,
Map<String,String> parameters)
Replace a resource, optionally performing placeholder substitution to the response.
|
protected <T> T |
handleResponse(okhttp3.OkHttpClient client,
okhttp3.Request.Builder requestBuilder,
Class<T> type)
Send an http request and handle the response.
|
protected <T> T |
handleResponse(okhttp3.OkHttpClient client,
okhttp3.Request.Builder requestBuilder,
Class<T> type,
Map<String,String> parameters)
Send an http request and handle the response, optionally performing placeholder substitution to the response.
|
protected <T> T |
handleResponse(okhttp3.Request.Builder requestBuilder,
Class<T> type)
Send an http request and handle the response.
|
protected <T> T |
handleResponse(okhttp3.Request.Builder requestBuilder,
Class<T> type,
Map<String,String> parameters)
Send an http request and handle the response, optionally performing placeholder substitution to the response.
|
protected io.fabric8.kubernetes.api.model.v1.Scale |
handleScale(String resourceUrl,
io.fabric8.kubernetes.api.model.v1.Scale scale)
Replace Scale of specified Kubernetes Resource
|
protected <T> T |
handleStatusUpdate(T updated,
Class<T> type) |
boolean |
isResourceNamespaced() |
static KubernetesClientException |
requestException(okhttp3.Request request,
Exception e) |
static KubernetesClientException |
requestFailure(okhttp3.Request request,
io.fabric8.kubernetes.api.model.Status status) |
protected static <T> T |
unmarshal(InputStream is) |
protected static <T> T |
unmarshal(InputStream is,
Class<T> type) |
protected static <T> T |
unmarshal(InputStream is,
com.fasterxml.jackson.core.type.TypeReference<T> type) |
public static final okhttp3.MediaType JSON
public static final okhttp3.MediaType JSON_PATCH
protected static final com.fasterxml.jackson.databind.ObjectMapper JSON_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper YAML_MAPPER
protected OperationContext context
protected final okhttp3.OkHttpClient client
protected final Config config
protected final String resourceT
protected String namespace
protected String name
protected String apiGroupName
protected String apiGroupVersion
public OperationSupport()
public OperationSupport(okhttp3.OkHttpClient client, Config config)
public OperationSupport(okhttp3.OkHttpClient client, Config config, String namespace)
public OperationSupport(OperationContext ctx)
public String getAPIGroup()
public String getAPIVersion()
public String getResourceT()
public String getNamespace()
public String getName()
public boolean isResourceNamespaced()
public URL getRootUrl()
public URL getNamespacedUrl(String namespace) throws MalformedURLException
MalformedURLException
public URL getNamespacedUrl() throws MalformedURLException
MalformedURLException
public <T> URL getNamespacedUrl(T item) throws MalformedURLException
MalformedURLException
public URL getResourceUrl(String namespace, String name) throws MalformedURLException
MalformedURLException
public URL getResourceUrl() throws MalformedURLException
MalformedURLException
protected <T> String checkNamespace(T item)
protected <T> String checkName(T item)
protected <T> T handleMetric(String resourceUrl, Class<T> type) throws InterruptedException, IOException, ExecutionException
protected <T> void handleDelete(T resource, long gracePeriodSeconds, String propagationPolicy, boolean cascading) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
protected void handleDelete(URL requestUrl, long gracePeriodSeconds, String propagationPolicy, boolean cascading) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
protected <T,I> T handleCreate(I resource, Class<T> outputType) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument for output typeI
- template argument for resourceresource
- resource providedoutputType
- resource type you want as outputExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleReplace(T updated, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedupdated
- updated objecttype
- type of the object providedExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleReplace(T updated, Class<T> type, Map<String,String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedupdated
- updated objecttype
- type of object providedparameters
- a HashMap containing parameters for processing objectExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleStatusUpdate(T updated, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
protected <T> T handlePatch(T current, T updated, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedcurrent
- current objectupdated
- updated objecttype
- type of objectExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected io.fabric8.kubernetes.api.model.v1.Scale handleScale(String resourceUrl, io.fabric8.kubernetes.api.model.v1.Scale scale) throws ExecutionException, InterruptedException, KubernetesClientException, MalformedURLException, com.fasterxml.jackson.core.JsonProcessingException, IOException
resourceUrl
- Kubernetes resource URLscale
- Scale object which we want to injectExecutionException
- in case of any execution exceptionInterruptedException
- in case thread is interruptedKubernetesClientException
- in case error from Kubernetes APIMalformedURLException
- in case URL formed in invalidcom.fasterxml.jackson.core.JsonProcessingException
- in case Json processing failsIOException
- in some other I/O problemprotected io.fabric8.kubernetes.api.model.Status handleDeploymentRollback(String resourceUrl, io.fabric8.kubernetes.api.model.extensions.DeploymentRollback deploymentRollback) throws ExecutionException, InterruptedException, KubernetesClientException, MalformedURLException, com.fasterxml.jackson.core.JsonProcessingException, IOException
resourceUrl
- resource urldeploymentRollback
- DeploymentRollback resourceExecutionException
- in case of any execution exceptionInterruptedException
- in case thread is interruptedKubernetesClientException
- in case error from Kubernetes APIMalformedURLException
- in case URL formed in invalidcom.fasterxml.jackson.core.JsonProcessingException
- in case Json processing failsIOException
- in some other I/O problemprotected <T> T handleGet(URL resourceUrl, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedresourceUrl
- resource URL to be processedtype
- type of resourceExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleGet(URL resourceUrl, Class<T> type, Map<String,String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedresourceUrl
- resource URL to be processedtype
- type of resourceparameters
- A HashMap of strings containing parameters to be passed in requestExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleResponse(okhttp3.Request.Builder requestBuilder, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedrequestBuilder
- Request Builder objecttype
- type of resourceExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleResponse(okhttp3.Request.Builder requestBuilder, Class<T> type, Map<String,String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedrequestBuilder
- request buildertype
- type of objectparameters
- a hashmap containing parametersExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- template argument providedclient
- OkHttp client objectrequestBuilder
- request buildertype
- type of objectExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected <T> T handleResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, Class<T> type, Map<String,String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException
T
- Template argument providedclient
- OkHttp client providedrequestBuilder
- Request buildertype
- Type of object providedparameters
- A hashmap containing parametersExecutionException
- Execution ExceptionInterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionIOException
- IOExceptionprotected void assertResponseCode(okhttp3.Request request, okhttp3.Response response)
request
- The {#link Request} object.response
- The Response
object.KubernetesClientException
- When the response code is not the expected.public static io.fabric8.kubernetes.api.model.Status createStatus(okhttp3.Response response)
public static io.fabric8.kubernetes.api.model.Status createStatus(int statusCode, String message)
public static KubernetesClientException requestFailure(okhttp3.Request request, io.fabric8.kubernetes.api.model.Status status)
public static KubernetesClientException requestException(okhttp3.Request request, Exception e)
protected static <T> T unmarshal(InputStream is) throws KubernetesClientException
KubernetesClientException
protected static <T> T unmarshal(InputStream is, Class<T> type) throws KubernetesClientException
KubernetesClientException
protected static <T> T unmarshal(InputStream is, com.fasterxml.jackson.core.type.TypeReference<T> type) throws KubernetesClientException
KubernetesClientException
public Config getConfig()
Copyright © 2015–2021 Red Hat. All rights reserved.