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.voidclose()io.fabric8.kubernetes.api.model.APIGroupgetApiGroup(String name)Return a single api groupio.fabric8.kubernetes.api.model.APIGroupListgetApiGroups()Returns the api groups.io.fabric8.kubernetes.api.model.APIResourceListgetApiResources(String groupVersion)Return the api resource metadata for the given groupVersionStringgetApiVersion()io.fabric8.kubernetes.api.model.APIVersionsgetAPIVersions()Get the available APIversions.ClientgetClient()ConfiggetConfiguration()HttpClientgetHttpClient()URLgetMasterUrl()StringgetNamespace()booleanhasApiGroup(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.CinAnyNamespace()voidinit(Client client)CinNamespace(String namespace)ClientnewClient(RequestConfig requestConfig)Creates a new client based upon the current except with a differentRequestConfig.abstract CnewInstance()Stringraw(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.RootPathsrootPaths()<T extends io.fabric8.kubernetes.api.model.KubernetesResource>
booleansupports(Class<T> type)Checks the Kubernetes server for support for the given KubernetesResource type.booleansupports(String apiVersion, String kind)Checks the Kubernetes server for support for the given type.booleansupportsApiPath(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:
getHttpClientin interfaceClient
-
getConfiguration
public Config getConfiguration()
- Specified by:
getConfigurationin interfaceClient
-
supports
public <T extends io.fabric8.kubernetes.api.model.KubernetesResource> boolean supports(Class<T> type)
Description copied from interface:ClientChecks 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:ClientChecks 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:ClientChecks for the api group. exact = false will scan all groups for a suffix match. exact = true will look only for that apiGroup.- Specified by:
hasApiGroupin 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:ClientAdapt 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:
getMasterUrlin interfaceClient
-
getApiVersion
public String getApiVersion()
- Specified by:
getApiVersionin interfaceClient
-
getNamespace
public String getNamespace()
- Specified by:
getNamespacein interfaceClient
-
rootPaths
public io.fabric8.kubernetes.api.model.RootPaths rootPaths()
-
supportsApiPath
public boolean supportsApiPath(String path)
Description copied from interface:ClientReturns true if this cluster supports the given API path or API Group ID- Specified by:
supportsApiPathin 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:ClientReturns the api groups. This does not include the core/legacy v1 apiVersion.- Specified by:
getApiGroupsin interfaceClient- Returns:
- the
APIGroupListmetadata
-
getAPIVersions
public io.fabric8.kubernetes.api.model.APIVersions getAPIVersions()
Description copied from interface:ClientGet 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:
getAPIVersionsin interfaceClient- Returns:
- the
APIVersionsobject
-
getApiGroup
public io.fabric8.kubernetes.api.model.APIGroup getApiGroup(String name)
Description copied from interface:ClientReturn a single api group- Specified by:
getApiGroupin interfaceClient- Parameters:
name- of the group- Returns:
- the
APIGroupmetadata
-
getApiResources
public io.fabric8.kubernetes.api.model.APIResourceList getApiResources(String groupVersion)
Description copied from interface:ClientReturn the api resource metadata for the given groupVersionUse v1 to indicate the core/legacy resources
- Specified by:
getApiResourcesin interfaceClient- Parameters:
groupVersion- the groupVersion - group/version- Returns:
- the
APIResourceListfor 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:ClientTyped 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
Namespacedif it is a namespace-scoped resource.- Specified by:
resourcesin interfaceClient- Type Parameters:
T- represents resource type. If it's a namespaced resource, it must implementNamespacedL- 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:ClientCreates 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()
-
-