Package io.fabric8.kubernetes.client
Interface Client
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
AdmissionRegistrationAPIGroupDSL
,ApiextensionsAPIGroupDSL
,AppsAPIGroupDSL
,AuthenticationAPIGroupDSL
,AuthorizationAPIGroupDSL
,AutoscalingAPIGroupDSL
,BatchAPIGroupDSL
,CertificatesAPIGroupDSL
,DiscoveryAPIGroupDSL
,DynamicResourceAllocationAPIGroupDSL
,EventingAPIGroupDSL
,ExtensionsAPIGroupDSL
,FlowControlAPIGroupDSL
,KubernetesClient
,MetricAPIGroupDSL
,NamespacedKubernetesClient
,NetworkAPIGroupDSL
,PolicyAPIGroupDSL
,RbacAPIGroupDSL
,SchedulingAPIGroupDSL
,StorageAPIGroupDSL
,V1AdmissionRegistrationAPIGroupDSL
,V1Alpha1AdmissionRegistrationAPIGroupDSL
,V1Alpha1AuthenticationAPIGroupDSL
,V1Alpha1CertificatesAPIGroupDSL
,V1Alpha1NetworkAPIGroupDSL
,V1Alpha2DynamicResourceAllocationAPIGroupDSL
,V1ApiextensionAPIGroupDSL
,V1APIGroupDSL
,V1AuthenticationAPIGroupDSL
,V1AuthorizationAPIGroupDSL
,V1AutoscalingAPIGroupDSL
,V1BatchAPIGroupDSL
,V1beta1AdmissionRegistrationAPIGroupDSL
,V1beta1ApiextensionAPIGroupDSL
,V1Beta1AuthenticationAPIGroupDSL
,V1beta1AuthorizationAPIGroupDSL
,V1beta1BatchAPIGroupDSL
,V1beta1CertificatesAPIGroupDSL
,V1beta1DiscoveryAPIGroupDSL
,V1beta1EventingAPIGroupDSL
,V1beta1FlowControlAPIGroupDSL
,V1beta1NetworkAPIGroupDSL
,V1beta1PolicyAPIGroupDSL
,V1beta1SchedulingAPIGroupDSL
,V1beta1StorageAPIGroupDSL
,V1beta2FlowControlAPIGroupDSL
,V1beta3FlowControlAPIGroupDSL
,V1CertificatesAPIGroupDSL
,V1DiscoveryAPIGroupDSL
,V1EventingAPIGroupDSL
,V1FlowControlAPIGroupDSL
,V1NetworkAPIGroupDSL
,V1PolicyAPIGroupDSL
,V1SchedulingAPIGroupDSL
,V1StorageAPIGroupDSL
,V2AutoscalingAPIGroupDSL
,V2beta1AutoscalingAPIGroupDSL
,V2beta2AutoscalingAPIGroupDSL
- All Known Implementing Classes:
ClientAdapter
,DefaultKubernetesClient
,ExtensionRootClientAdapter
,NamespacedKubernetesClientAdapter
public interface Client extends Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description <C extends Client>
Cadapt(Class<C> 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.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.Client
newClient(RequestConfig requestConfig)
Creates a new client based upon the current except with a differentRequestConfig
.default String
raw(String uri)
GET the response from the given uri as a StringString
raw(String uri, String method, Object payload)
The response from the given uri as a Stringdefault <T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>
MixedOperation<T,L,Resource<T>>resources(Class<T> resourceType, Class<L> listClass)
Typed API for managing resources.<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()
<R extends io.fabric8.kubernetes.api.model.KubernetesResource>
booleansupports(Class<R> 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)
Deprecated.usesupports(Class)
instead
-
-
-
Method Detail
-
supports
<R extends io.fabric8.kubernetes.api.model.KubernetesResource> boolean supports(Class<R> type)
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.
- Parameters:
type
- to check for support- Returns:
- boolean value indicating whether this type is supported
-
supports
boolean supports(String apiVersion, String kind)
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.
- Parameters:
apiVersion
- the api/version. This should be fully qualified - that is for openshift, please include the api.kind
- the resource kind- Returns:
- boolean value indicating whether this type is supported
-
hasApiGroup
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.- Parameters:
apiGroup
- to check forexact
- true for an exact match- Returns:
- true if there is a match
-
adapt
<C extends Client> C adapt(Class<C> type)
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
URL getMasterUrl()
-
getApiVersion
String getApiVersion()
-
getNamespace
String getNamespace()
-
rootPaths
io.fabric8.kubernetes.api.model.RootPaths rootPaths()
-
supportsApiPath
@Deprecated boolean supportsApiPath(String path)
Deprecated.usesupports(Class)
insteadReturns true if this cluster supports the given API path or API Group ID- Parameters:
path
- Path as string- Returns:
- returns boolean value indicating whether it supports.
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getAPIVersions
io.fabric8.kubernetes.api.model.APIVersions getAPIVersions()
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.- Returns:
- the
APIVersions
object
-
getApiGroups
io.fabric8.kubernetes.api.model.APIGroupList getApiGroups()
Returns the api groups. This does not include the core/legacy v1 apiVersion.- Returns:
- the
APIGroupList
metadata
-
getApiGroup
io.fabric8.kubernetes.api.model.APIGroup getApiGroup(String name)
Return a single api group- Parameters:
name
- of the group- Returns:
- the
APIGroup
metadata
-
getApiResources
io.fabric8.kubernetes.api.model.APIResourceList getApiResources(String groupVersion)
Return the api resource metadata for the given groupVersionUse v1 to indicate the core/legacy resources
- Parameters:
groupVersion
- the groupVersion - group/version- Returns:
- the
APIResourceList
for the groupVersion
-
resources
<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. 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.- 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.
-
resources
default <T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> MixedOperation<T,L,Resource<T>> resources(Class<T> resourceType, Class<L> listClass)
Typed API for managing resources. Any properly annotated POJO can be utilized as a resource.Note: your resource POJO (T in this context) must implement
Namespaced
if it is a namespace-scoped resource.- Type Parameters:
T
- represents resource type. If it's a namespaced resource, it must implementNamespaced
L
- represents resource list 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.
-
newClient
Client newClient(RequestConfig requestConfig)
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.- Parameters:
requestConfig
-- Returns:
- a new client
-
getHttpClient
HttpClient getHttpClient()
-
getConfiguration
Config getConfiguration()
-
raw
default String raw(String uri)
GET the response from the given uri as a String- Parameters:
uri
- must start with / if relative- Returns:
- the response, or null if a 404 code
-
-