public class OperationSupport
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
apiGroupName |
protected java.lang.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 java.lang.String |
name |
protected java.lang.String |
namespace |
protected java.lang.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,
java.lang.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> java.lang.String |
checkName(T item) |
protected <T> java.lang.String |
checkNamespace(T item) |
static Status |
createStatus(int statusCode,
java.lang.String message) |
static Status |
createStatus(okhttp3.Response response) |
java.lang.String |
getAPIGroup() |
java.lang.String |
getAPIVersion() |
Config |
getConfig() |
java.lang.String |
getName() |
java.lang.String |
getNamespace() |
java.net.URL |
getNamespacedUrl() |
java.net.URL |
getNamespacedUrl(java.lang.String namespace) |
<T> java.net.URL |
getNamespacedUrl(T item) |
java.lang.String |
getResourceT() |
java.net.URL |
getResourceUrl() |
java.net.URL |
getResourceUrl(java.lang.String namespace,
java.lang.String name) |
java.net.URL |
getRootUrl() |
protected <T,I> T |
handleCreate(I resource,
java.lang.Class<T> outputType)
Create a resource.
|
protected <T> void |
handleDelete(T resource,
long gracePeriodSeconds,
boolean cascading) |
protected void |
handleDelete(java.net.URL requestUrl,
long gracePeriodSeconds,
boolean cascading) |
protected <T> T |
handleGet(java.net.URL resourceUrl,
java.lang.Class<T> type)
Send an http get.
|
protected <T> T |
handleGet(java.net.URL resourceUrl,
java.lang.Class<T> type,
java.util.Map<java.lang.String,java.lang.String> parameters)
Send an http, optionally performing placeholder substitution to the response.
|
protected <T> T |
handlePatch(T current,
T updated,
java.lang.Class<T> type)
Send an http patch and handle the response.
|
protected <T> T |
handleReplace(T updated,
java.lang.Class<T> type)
Replace a resource.
|
protected <T> T |
handleReplace(T updated,
java.lang.Class<T> type,
java.util.Map<java.lang.String,java.lang.String> parameters)
Replace a resource, optionally performing placeholder substitution to the response.
|
protected <T> T |
handleResponse(okhttp3.OkHttpClient client,
okhttp3.Request.Builder requestBuilder,
java.lang.Class<T> type)
Send an http request and handle the response.
|
protected <T> T |
handleResponse(okhttp3.OkHttpClient client,
okhttp3.Request.Builder requestBuilder,
java.lang.Class<T> type,
java.util.Map<java.lang.String,java.lang.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,
java.lang.Class<T> type)
Send an http request and handle the response.
|
protected <T> T |
handleResponse(okhttp3.Request.Builder requestBuilder,
java.lang.Class<T> type,
java.util.Map<java.lang.String,java.lang.String> parameters)
Send an http request and handle the response, optionally performing placeholder substitution to the response.
|
boolean |
isResourceNamespaced() |
static KubernetesClientException |
requestException(okhttp3.Request request,
java.lang.Exception e) |
static KubernetesClientException |
requestFailure(okhttp3.Request request,
Status status) |
protected static <T> T |
unmarshal(java.io.InputStream is) |
protected static <T> T |
unmarshal(java.io.InputStream is,
java.lang.Class<T> type) |
protected static <T> T |
unmarshal(java.io.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 java.lang.String resourceT
protected java.lang.String namespace
protected java.lang.String name
protected java.lang.String apiGroupName
protected java.lang.String apiGroupVersion
public OperationSupport()
public OperationSupport(okhttp3.OkHttpClient client, Config config)
public OperationSupport(okhttp3.OkHttpClient client, Config config, java.lang.String namespace)
public OperationSupport(OperationContext ctx)
public java.lang.String getAPIGroup()
public java.lang.String getAPIVersion()
public java.lang.String getResourceT()
public java.lang.String getNamespace()
public java.lang.String getName()
public boolean isResourceNamespaced()
public java.net.URL getRootUrl()
public java.net.URL getNamespacedUrl(java.lang.String namespace) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.net.URL getNamespacedUrl() throws java.net.MalformedURLException
java.net.MalformedURLException
public <T> java.net.URL getNamespacedUrl(T item) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.net.URL getResourceUrl(java.lang.String namespace, java.lang.String name) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.net.URL getResourceUrl() throws java.net.MalformedURLException
java.net.MalformedURLException
protected <T> java.lang.String checkNamespace(T item)
protected <T> java.lang.String checkName(T item)
protected <T> void handleDelete(T resource, long gracePeriodSeconds, boolean cascading) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
KubernetesClientException
java.io.IOException
protected void handleDelete(java.net.URL requestUrl, long gracePeriodSeconds, boolean cascading) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
KubernetesClientException
java.io.IOException
protected <T,I> T handleCreate(I resource, java.lang.Class<T> outputType) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument for output typeI
- template argument for resourceresource
- resource providedoutputType
- resource type you want as outputjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleReplace(T updated, java.lang.Class<T> type) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedupdated
- updated objecttype
- type of the object providedjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleReplace(T updated, java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedupdated
- updated objecttype
- type of object providedparameters
- a HashMap containing parameters for processing objectjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handlePatch(T current, T updated, java.lang.Class<T> type) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedcurrent
- current objectupdated
- updated objecttype
- type of objectjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleGet(java.net.URL resourceUrl, java.lang.Class<T> type) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedresourceUrl
- resource URL to be processedtype
- type of resourcejava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleGet(java.net.URL resourceUrl, java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedresourceUrl
- resource URL to be processedtype
- type of resourceparameters
- A HashMap of strings containing parameters to be passed in requestjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleResponse(okhttp3.Request.Builder requestBuilder, java.lang.Class<T> type) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedrequestBuilder
- Request Builder objecttype
- type of resourcejava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleResponse(okhttp3.Request.Builder requestBuilder, java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedrequestBuilder
- request buildertype
- type of objectparameters
- a hashmap containing parametersjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, java.lang.Class<T> type) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- template argument providedclient
- OkHttp client objectrequestBuilder
- request buildertype
- type of objectjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- IOExceptionprotected <T> T handleResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, java.lang.Class<T> type, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, KubernetesClientException, java.io.IOException
T
- Template argument providedclient
- OkHttp client providedrequestBuilder
- Request buildertype
- Type of object providedparameters
- A hashmap containing parametersjava.util.concurrent.ExecutionException
- Execution Exceptionjava.lang.InterruptedException
- Interrupted ExceptionKubernetesClientException
- KubernetesClientExceptionjava.io.IOException
- 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 Status createStatus(okhttp3.Response response)
public static Status createStatus(int statusCode, java.lang.String message)
public static KubernetesClientException requestFailure(okhttp3.Request request, Status status)
public static KubernetesClientException requestException(okhttp3.Request request, java.lang.Exception e)
protected static <T> T unmarshal(java.io.InputStream is) throws KubernetesClientException
KubernetesClientException
protected static <T> T unmarshal(java.io.InputStream is, java.lang.Class<T> type) throws KubernetesClientException
KubernetesClientException
protected static <T> T unmarshal(java.io.InputStream is, com.fasterxml.jackson.core.type.TypeReference<T> type) throws KubernetesClientException
KubernetesClientException
public Config getConfig()
Copyright © 2015-2019 Red Hat. All Rights Reserved.