public class DefaultClient extends Object implements IClient, IHttpConstants
| Modifier and Type | Field and Description |
|---|---|
static String |
PATH_HEALTH_CHECK |
static String |
PATH_KUBERNETES_VERSION |
static String |
PATH_OPENSHIFT_VERSION |
static String |
SYSTEM_PROP_K8E_API_VERSION |
static String |
SYSTEM_PROP_OPENSHIFT_API_VERSION |
AMPERSAND, AUTHORIZATION_BASIC, AUTHORIZATION_BEARER, COLON, COMMA, DEFAULT_READ_TIMEOUT, EQUALS, MEDIATYPE_ANY, MEDIATYPE_APPLICATION_FORMURLENCODED, MEDIATYPE_APPLICATION_JSON, MEDIATYPE_APPLICATION_OCTET_STREAM, MEDIATYPE_APPLICATION_XML, NO_TIMEOUT, POST, PROPERTY_ACCEPT, PROPERTY_ACCESS_TOKEN, PROPERTY_AUTHIV, PROPERTY_AUTHKEY, PROPERTY_AUTHORIZATION, PROPERTY_CONTENT_TYPE, PROPERTY_LOCATION, PROPERTY_ORIGIN, PROPERTY_USER_AGENT, PROPERTY_WWW_AUTHENTICATE, PUT, QUESTION_MARK, SEMICOLON, SLASH, SPACE, STATUS_BAD_REQUEST, STATUS_FORBIDDEN, STATUS_INTERNAL_SERVER_ERROR, STATUS_MOVED_PERMANENTLY, STATUS_MOVED_TEMPORARILY, STATUS_NORMAL_STOP, STATUS_NOT_FOUND, STATUS_OK, STATUS_UNAUTHORIZED, STATUS_UPGRADE_PROTOCOL, VERSION| Constructor and Description |
|---|
DefaultClient(URL baseUrl,
okhttp3.OkHttpClient client,
IResourceFactory factory,
IApiTypeMapper typeMapper,
AuthorizationContext authContext) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ICapability,R> |
accept(CapabilityVisitor<T,R> visitor,
R unsupportedCapabililityValue)
Uses the given visitor to access the desired capability if it is supported
|
<T> T |
adapt(Class<T> klass)
Adapt this class to the given type
|
IClient |
clone() |
Collection<IResource> |
create(IList list,
String namespace)
Creates a list of resources in the given namespace
|
<T extends IResource> |
create(String kind,
String namespace,
String name,
String subresource,
IResource payload)
Creates the given resource in the given namespace using the subresource
|
<T extends IResource> |
create(String kind,
String version,
String namespace,
String name,
String subresource,
InputStream payload)
Creates the given resource in the given namespace using the subresource
|
<T extends IResource> |
create(String kind,
String version,
String namespace,
String name,
String subresource,
InputStream payload,
Map<String,String> parameters)
Creates the given resource in the given namespace using the subresource
|
<T extends IResource> |
create(T resource)
Creates the given resource in the namespace defined on the resource or the
default namspace if undefined
|
<T extends IResource> |
create(T resource,
String namespace)
Creates the given resource in the given namespace
|
void |
delete(String resourceKind,
String namespaceName,
String name)
Deletes a resource of given name and kind in the given namespace.
|
<T extends IResource> |
delete(T resource)
Deletes the given resource.
|
boolean |
equals(Object obj) |
<T> T |
execute(ITypeFactory factory,
String method,
String kind,
String namespace,
String name,
String subresource,
String subContext,
JSONSerializeable payload,
Map<String,String> params) |
<T> T |
execute(ITypeFactory factory,
String method,
String kind,
String version,
String namespace,
String name,
String subresource,
String subContext,
InputStream payload,
Map<String,String> params) |
<T extends IResource> |
execute(String method,
String kind,
String namespace,
String name,
String subresource,
IResource payload)
Raw execution of a request
|
<T extends IResource> |
execute(String method,
String kind,
String namespace,
String name,
String subresource,
IResource payload,
Map<String,String> params)
Raw execution of a request
|
<T extends IResource> |
execute(String method,
String kind,
String namespace,
String name,
String subresource,
IResource payload,
String subContext)
Raw execution of a request
|
<T extends IResource> |
execute(String method,
String kind,
String version,
String namespace,
String name,
String subresource,
InputStream payload) |
<T extends IResource> |
execute(String method,
String kind,
String version,
String namespace,
String name,
String subresource,
InputStream payload,
Map<String,String> parameters) |
IList |
get(String kind,
String namespace) |
<T extends IResource> |
get(String kind,
String name,
String namespace) |
IAuthorizationContext |
getAuthorizationContext()
The authorization context for this client.
|
URL |
getAuthorizationEndpoint() |
URL |
getBaseURL() |
<T extends ICapability> |
getCapability(Class<T> capability)
Gets the capability of the desired type
|
protected URL |
getDefaultAuthorizationEndpoint() |
protected URL |
getDefaultTokenEndpoint() |
String |
getKubernetesMasterVersion()
Query the server to determine the Kubernetes version
|
String |
getOpenShiftAPIVersion()
Returns the OpenShift API version for this client
|
int |
getOpenShiftMajorVersion()
Returns the major version for OpenShift or
KubernetesVersion.NO_VERSION if it could not be detected. |
String |
getOpenshiftMasterVersion()
Query the server to determine the Openshift version
|
IResourceFactory |
getResourceFactory()
Returns the resource factory used to create resources based on the response
from the server
|
String |
getResourceURI(IResource resource) |
String |
getServerReadyStatus()
Query the server to determine if it is ready
|
String |
getToken() |
URL |
getTokenEndpoint() |
int |
hashCode() |
void |
initializeCapabilities() |
<T extends IResource> |
list(String kind)
Lists all possible resources of the given kind in the default namespace
|
<T extends IResource> |
list(String kind,
Map<String,String> labels)
Lists the given given resource kind in the default namespace
|
<T extends IResource> |
list(String kind,
String namespace)
Lists the given given resource kind scoping it to a specific namespace
|
<T extends IResource> |
list(String kind,
String namespace,
Map<String,String> labels)
Lists the given given resource kind scoping it to a specific namespace
|
<T extends IResource> |
list(String kind,
String namespace,
String labelQuery)
Lists the given given resource kind scoping it to a specific namespace
|
protected OpenShiftRequestBuilder |
newRequestBuilder() |
void |
setToken(String token) |
boolean |
supports(Class<? extends ICapability> capability)
Determines if the client supports the desired capability
|
<T extends IResource> |
update(T resource)
Updates the given resource
|
IWatcher |
watch(IOpenShiftWatchListener listener,
String... kinds) |
IWatcher |
watch(String namespace,
IOpenShiftWatchListener listener,
String... kinds) |
public static final String PATH_KUBERNETES_VERSION
public static final String PATH_OPENSHIFT_VERSION
public static final String PATH_HEALTH_CHECK
public static final String SYSTEM_PROP_K8E_API_VERSION
public static final String SYSTEM_PROP_OPENSHIFT_API_VERSION
public DefaultClient(URL baseUrl, okhttp3.OkHttpClient client, IResourceFactory factory, IApiTypeMapper typeMapper, AuthorizationContext authContext)
public IClient clone()
public IResourceFactory getResourceFactory()
IClientgetResourceFactory in interface IClientpublic IWatcher watch(String namespace, IOpenShiftWatchListener listener, String... kinds)
public IWatcher watch(IOpenShiftWatchListener listener, String... kinds)
public String getResourceURI(IResource resource)
getResourceURI in interface IClientpublic <T extends IResource> List<T> list(String kind)
IClientpublic <T extends IResource> List<T> list(String kind, Map<String,String> labels)
IClientpublic <T extends IResource> List<T> list(String kind, String namespace)
IClientpublic <T extends IResource> List<T> list(String kind, String namespace, Map<String,String> labels)
IClientpublic <T extends IResource> List<T> list(String kind, String namespace, String labelQuery)
IClientpublic Collection<IResource> create(IList list, String namespace)
IClientpublic <T extends IResource> T create(T resource)
IClientpublic <T extends IResource> T create(T resource, String namespace)
IClientpublic <T extends IResource> T create(String kind, String namespace, String name, String subresource, IResource payload)
IClientpublic <T extends IResource> T create(String kind, String version, String namespace, String name, String subresource, InputStream payload)
IClientpublic <T extends IResource> T create(String kind, String version, String namespace, String name, String subresource, InputStream payload, Map<String,String> parameters)
IClientpublic <T extends IResource> T execute(String method, String kind, String namespace, String name, String subresource, IResource payload, String subContext)
IClientpublic <T extends IResource> T execute(String method, String kind, String namespace, String name, String subresource, IResource payload)
IClientpublic <T extends IResource> T execute(String method, String kind, String version, String namespace, String name, String subresource, InputStream payload)
public <T extends IResource> T execute(String method, String kind, String version, String namespace, String name, String subresource, InputStream payload, Map<String,String> parameters)
public <T extends IResource> T execute(String method, String kind, String namespace, String name, String subresource, IResource payload, Map<String,String> params)
IClientpublic <T> T execute(ITypeFactory factory, String method, String kind, String version, String namespace, String name, String subresource, String subContext, InputStream payload, Map<String,String> params)
public <T> T execute(ITypeFactory factory, String method, String kind, String namespace, String name, String subresource, String subContext, JSONSerializeable payload, Map<String,String> params)
execute in interface IClientfactory - The factory to use for interpreting the responsemethod - HttpMethod (e.g. POST)subresource - subresource or capabilitysubContext - additional subContextpayload - the payload to sumit. only valid on non-get operationspublic String getServerReadyStatus()
IClientgetServerReadyStatus in interface IClientprotected OpenShiftRequestBuilder newRequestBuilder()
public <T extends IResource> T update(T resource)
IClientpublic <T extends IResource> void delete(T resource)
IClientpublic void delete(String resourceKind, String namespaceName, String name)
IClientpublic void initializeCapabilities()
public <T extends ICapability> T getCapability(Class<T> capability)
ICapablegetCapability in interface ICapablepublic boolean supports(Class<? extends ICapability> capability)
ICapablepublic <T extends ICapability,R> R accept(CapabilityVisitor<T,R> visitor, R unsupportedCapabililityValue)
ICapablepublic String getOpenShiftAPIVersion()
IClientgetOpenShiftAPIVersion in interface IClientpublic String getOpenshiftMasterVersion()
IClientgetOpenshiftMasterVersion in interface IClientpublic String getKubernetesMasterVersion()
IClientgetKubernetesMasterVersion in interface IClientpublic URL getBaseURL()
getBaseURL in interface IClientpublic URL getAuthorizationEndpoint()
getAuthorizationEndpoint in interface IClientprotected URL getDefaultAuthorizationEndpoint()
public URL getTokenEndpoint()
getTokenEndpoint in interface IClientprotected URL getDefaultTokenEndpoint()
public IAuthorizationContext getAuthorizationContext()
IClientgetAuthorizationContext in interface IClientpublic void setToken(String token)
public String getToken()
public int getOpenShiftMajorVersion()
IClientKubernetesVersion.NO_VERSION if it could not be detected.getOpenShiftMajorVersion in interface IClientCopyright © 2020 Red Hat, Inc. All Rights Reserved.