Class ClientAdapter<C extends ClientAdapter<C>>
- java.lang.Object
-
- io.fabric8.kubernetes.client.extension.ClientAdapter<C>
-
- All Implemented Interfaces:
Client
,Closeable
,AutoCloseable
- Direct Known Subclasses:
ExtensionRootClientAdapter
,NamespacedKubernetesClientAdapter
public abstract class ClientAdapter<C extends ClientAdapter<C>> extends Object implements Client
To be used as the base class for creating extension clients
-
-
Constructor Summary
Constructors Constructor Description ClientAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <A extends Client>
Aadapt(Class<A> type)
Adapt the client to another type.void
close()
io.fabric8.kubernetes.api.model.APIGroup
getApiGroup(String name)
Return a single api groupio.fabric8.kubernetes.api.model.APIGroupList
getApiGroups()
Returns the api groups.io.fabric8.kubernetes.api.model.APIResourceList
getApiResources(String groupVersion)
Return the api resource metadata for the given groupVersionString
getApiVersion()
io.fabric8.kubernetes.api.model.APIVersions
getAPIVersions()
Get the available APIversions.Client
getClient()
Config
getConfiguration()
HttpClient
getHttpClient()
URL
getMasterUrl()
String
getNamespace()
boolean
hasApiGroup(String apiGroup, boolean exact)
Checks for the api group. exact = false will scan all groups for a suffix match. exact = true will look only for that apiGroup.C
inAnyNamespace()
void
init(Client client)
C
inNamespace(String namespace)
Client
newClient(RequestConfig requestConfig)
Creates a new client based upon the current except with a differentRequestConfig
.abstract C
newInstance()
String
raw(String uri, String method, Object payload)
The response from the given uri as a String<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
MixedOperation<T,L,R>resources(Class<T> resourceType, Class<L> listClass, Class<R> resourceClass)
Typed API for managing resources.io.fabric8.kubernetes.api.model.RootPaths
rootPaths()
<T extends io.fabric8.kubernetes.api.model.KubernetesResource>
booleansupports(Class<T> type)
Checks the Kubernetes server for support for the given KubernetesResource type.boolean
supports(String apiVersion, String kind)
Checks the Kubernetes server for support for the given type.boolean
supportsApiPath(String path)
Returns true if this cluster supports the given API path or API Group ID
-
-
-
Method Detail
-
getClient
public Client getClient()
-
init
public void init(Client client)
-
getHttpClient
public HttpClient getHttpClient()
- Specified by:
getHttpClient
in interfaceClient
-
getConfiguration
public Config getConfiguration()
- Specified by:
getConfiguration
in interfaceClient
-
supports
public <T extends io.fabric8.kubernetes.api.model.KubernetesResource> boolean supports(Class<T> type)
Description copied from interface:Client
Checks the Kubernetes server for support for the given KubernetesResource type.The response is not cached, a new check will be performed for each method invocation. In case custom resource definition is installed in between invocations, this method might return different values.
-
supports
public boolean supports(String apiVersion, String kind)
Description copied from interface:Client
Checks the Kubernetes server for support for the given type.The response is not cached, a new check will be performed for each method invocation. In case custom resource definition is installed in between invocations, this method might return different values.
-
hasApiGroup
public boolean hasApiGroup(String apiGroup, boolean exact)
Description copied from interface:Client
Checks for the api group. exact = false will scan all groups for a suffix match. exact = true will look only for that apiGroup.- Specified by:
hasApiGroup
in interfaceClient
- Parameters:
apiGroup
- to check forexact
- true for an exact match- Returns:
- true if there is a match
-
adapt
public <A extends Client> A adapt(Class<A> type)
Description copied from interface:Client
Adapt the client to another type. This will not perform any check of whether the new client type is supported. It may even return the same object if it already supports the given client type.
-
getMasterUrl
public URL getMasterUrl()
- Specified by:
getMasterUrl
in interfaceClient
-
getApiVersion
public String getApiVersion()
- Specified by:
getApiVersion
in interfaceClient
-
getNamespace
public String getNamespace()
- Specified by:
getNamespace
in interfaceClient
-
rootPaths
public io.fabric8.kubernetes.api.model.RootPaths rootPaths()
-
supportsApiPath
public boolean supportsApiPath(String path)
Description copied from interface:Client
Returns true if this cluster supports the given API path or API Group ID- Specified by:
supportsApiPath
in interfaceClient
- Parameters:
path
- Path as string- Returns:
- returns boolean value indicating whether it supports.
-
close
public void close()
-
getApiGroups
public io.fabric8.kubernetes.api.model.APIGroupList getApiGroups()
Description copied from interface:Client
Returns the api groups. This does not include the core/legacy v1 apiVersion.- Specified by:
getApiGroups
in interfaceClient
- Returns:
- the
APIGroupList
metadata
-
getAPIVersions
public io.fabric8.kubernetes.api.model.APIVersions getAPIVersions()
Description copied from interface:Client
Get the available APIversions. APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.- Specified by:
getAPIVersions
in interfaceClient
- Returns:
- the
APIVersions
object
-
getApiGroup
public io.fabric8.kubernetes.api.model.APIGroup getApiGroup(String name)
Description copied from interface:Client
Return a single api group- Specified by:
getApiGroup
in interfaceClient
- Parameters:
name
- of the group- Returns:
- the
APIGroup
metadata
-
getApiResources
public io.fabric8.kubernetes.api.model.APIResourceList getApiResources(String groupVersion)
Description copied from interface:Client
Return the api resource metadata for the given groupVersionUse v1 to indicate the core/legacy resources
- Specified by:
getApiResources
in interfaceClient
- Parameters:
groupVersion
- the groupVersion - group/version- Returns:
- the
APIResourceList
for the groupVersion
-
resources
public <T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>> MixedOperation<T,L,R> resources(Class<T> resourceType, Class<L> listClass, Class<R> resourceClass)
Description copied from interface:Client
Typed API for managing resources. Any properly annotated POJO can be utilized as a resource.
Note: this call is generally for use internally within the DSL, not by end usersNote: your resource POJO (T in this context) must implement
Namespaced
if it is a namespace-scoped resource.- Specified by:
resources
in interfaceClient
- Type Parameters:
T
- represents resource type. If it's a namespaced resource, it must implementNamespaced
L
- represents resource list typeR
- represents the Resource operation type- Parameters:
resourceType
- Class for resource- Returns:
- returns a MixedOperation object with which you can do basic resource operations. If the class is a known type the dsl operation logic will be used.
-
inAnyNamespace
public C inAnyNamespace()
-
newClient
public Client newClient(RequestConfig requestConfig)
Description copied from interface:Client
Creates a new client based upon the current except with a differentRequestConfig
. It uses the same resources as the current client, thus closing it will close the original client.
-
newInstance
public abstract C newInstance()
-
-