ApiType
- the api type parameterApiListType
- the api list type parameterpublic class GenericKubernetesApi<ApiType extends io.kubernetes.client.common.KubernetesObject,ApiListType extends io.kubernetes.client.common.KubernetesListObject> extends Object
1. there's a `V1ObjectMeta` field in the model along with its getter/setter. 2. there's a `V1ListMeta` field in the list model along with its getter/setter. - supports Gson serialization/deserialization. 3. the generic kubernetes api covers all the basic operations over the custom resources including {get, list, watch, create, update, patch, delete}.
The Generic kubernetes api is expected to have the following behaviors upon failures where
KubernetesApiResponse.isSuccess()
returns false:
- For kubernetes-defined failures, the server will return a V1Status
with 4xx/5xx
code. The status object will be nested in KubernetesApiResponse.getStatus()
- For the
other unknown reason (including network, JVM..), throws an unchecked exception.
Modifier and Type | Class and Description |
---|---|
static class |
GenericKubernetesApi.StatusPatch |
Constructor and Description |
---|
GenericKubernetesApi(Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass,
String apiGroup,
String apiVersion,
String resourcePlural)
Instantiates a new Generic kubernetes api.
|
GenericKubernetesApi(Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass,
String apiGroup,
String apiVersion,
String resourcePlural,
io.kubernetes.client.openapi.ApiClient apiClient)
Instantiates a new Generic kubernetes api.
|
GenericKubernetesApi(Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass,
String apiGroup,
String apiVersion,
String resourcePlural,
io.kubernetes.client.openapi.apis.CustomObjectsApi customObjectsApi)
Instantiates a new Generic kubernetes api with the ApiClient specified.
|
Modifier and Type | Method and Description |
---|---|
KubernetesApiResponse<ApiType> |
create(ApiType object)
Create kubernetes api response, if the namespace in the object is present, it will send a
namespace-scoped requests, vice versa.
|
KubernetesApiResponse<ApiType> |
create(ApiType object,
CreateOptions createOptions)
Create kubernetes api response.
|
KubernetesApiResponse<ApiType> |
create(String namespace,
ApiType object,
CreateOptions createOptions) |
KubernetesApiResponse<ApiType> |
delete(String name)
Delete kubernetes api response.
|
KubernetesApiResponse<ApiType> |
delete(String name,
DeleteOptions deleteOptions)
Delete kubernetes api response.
|
KubernetesApiResponse<ApiType> |
delete(String namespace,
String name)
Delete kubernetes api response under the namespace.
|
KubernetesApiResponse<ApiType> |
delete(String namespace,
String name,
DeleteOptions deleteOptions)
Delete kubernetes api response.
|
KubernetesApiResponse<ApiType> |
get(String name)
Get kubernetes api response.
|
KubernetesApiResponse<ApiType> |
get(String name,
GetOptions getOptions)
Get kubernetes api response.
|
KubernetesApiResponse<ApiType> |
get(String namespace,
String name)
Get kubernetes api response under the namespace.
|
KubernetesApiResponse<ApiType> |
get(String namespace,
String name,
GetOptions getOptions)
Get kubernetes api response.
|
KubernetesApiResponse<ApiListType> |
list()
List kubernetes api response cluster-scoped.
|
KubernetesApiResponse<ApiListType> |
list(ListOptions listOptions)
List kubernetes api response.
|
KubernetesApiResponse<ApiListType> |
list(String namespace)
List kubernetes api response under the namespace.
|
KubernetesApiResponse<ApiListType> |
list(String namespace,
ListOptions listOptions)
List kubernetes api response.
|
KubernetesApiResponse<ApiType> |
patch(String namespace,
String name,
String patchType,
io.kubernetes.client.custom.V1Patch patch)
Patch kubernetes api response under the namespace.
|
KubernetesApiResponse<ApiType> |
patch(String namespace,
String name,
String patchType,
io.kubernetes.client.custom.V1Patch patch,
PatchOptions patchOptions)
Patch kubernetes api response.
|
KubernetesApiResponse<ApiType> |
patch(String name,
String patchType,
io.kubernetes.client.custom.V1Patch patch)
Patch kubernetes api response.
|
KubernetesApiResponse<ApiType> |
patch(String name,
String patchType,
io.kubernetes.client.custom.V1Patch patch,
PatchOptions patchOptions)
Patch kubernetes api response.
|
KubernetesApiResponse<ApiType> |
update(ApiType object)
Create kubernetes api response, if the namespace in the object is present, it will send a
namespace-scoped requests, vice versa.
|
KubernetesApiResponse<ApiType> |
update(ApiType object,
UpdateOptions updateOptions)
Update kubernetes api response.
|
KubernetesApiResponse<ApiType> |
updateStatus(ApiType object,
Function<ApiType,Object> status)
Create kubernetes api response, if the namespace in the object is present, it will send a
namespace-scoped requests, vice versa.
|
KubernetesApiResponse<ApiType> |
updateStatus(ApiType object,
Function<ApiType,Object> status,
UpdateOptions updateOptions)
Update status of kubernetes api response.
|
Watchable<ApiType> |
watch()
Creates a cluster-scoped Watch on the resource.
|
Watchable<ApiType> |
watch(ListOptions listOptions)
Watch watchable.
|
Watchable<ApiType> |
watch(String namespace)
Creates a namespace-scoped Watch on the resource.
|
Watchable<ApiType> |
watch(String namespace,
ListOptions listOptions)
Watch watchable.
|
public GenericKubernetesApi(Class<ApiType> apiTypeClass, Class<ApiListType> apiListTypeClass, String apiGroup, String apiVersion, String resourcePlural)
apiTypeClass
- the api type classapiListTypeClass
- the api list type classapiGroup
- the api groupapiVersion
- the api versionresourcePlural
- the resource pluralpublic GenericKubernetesApi(Class<ApiType> apiTypeClass, Class<ApiListType> apiListTypeClass, String apiGroup, String apiVersion, String resourcePlural, io.kubernetes.client.openapi.ApiClient apiClient)
apiTypeClass
- the api type class, e.g. V1Job.classapiListTypeClass
- the api list type class e.g V1JobList.classapiGroup
- the api groupapiVersion
- the api versionresourcePlural
- the resource plural, e.g. "jobs"apiClient
- the api clientpublic GenericKubernetesApi(Class<ApiType> apiTypeClass, Class<ApiListType> apiListTypeClass, String apiGroup, String apiVersion, String resourcePlural, io.kubernetes.client.openapi.apis.CustomObjectsApi customObjectsApi)
apiTypeClass
- the api type class, e.g. V1Job.classapiListTypeClass
- the api list type class e.g V1JobList.classapiGroup
- the api groupapiVersion
- the api versionresourcePlural
- the resource plural, e.g. "jobs"customObjectsApi
- the custom objects apipublic KubernetesApiResponse<ApiType> get(String name)
name
- the namepublic KubernetesApiResponse<ApiType> get(String namespace, String name)
namespace
- the namespacename
- the namepublic KubernetesApiResponse<ApiListType> list()
public KubernetesApiResponse<ApiListType> list(String namespace)
namespace
- the namespacepublic KubernetesApiResponse<ApiType> create(ApiType object)
object
- the objectpublic KubernetesApiResponse<ApiType> update(ApiType object)
object
- the objectpublic KubernetesApiResponse<ApiType> patch(String name, String patchType, io.kubernetes.client.custom.V1Patch patch)
name
- the namepatchType
- the patch type, supported values defined in V1Patchpatch
- the string patch contentpublic KubernetesApiResponse<ApiType> patch(String namespace, String name, String patchType, io.kubernetes.client.custom.V1Patch patch)
namespace
- the namespacename
- the namepatchType
- the patch type, supported values defined in V1Patchpatch
- the string patch contentpublic KubernetesApiResponse<ApiType> delete(String name)
name
- the namepublic KubernetesApiResponse<ApiType> delete(String namespace, String name)
namespace
- the namespacename
- the namepublic Watchable<ApiType> watch() throws io.kubernetes.client.openapi.ApiException
io.kubernetes.client.openapi.ApiException
- the api exceptionpublic Watchable<ApiType> watch(String namespace) throws io.kubernetes.client.openapi.ApiException
namespace
- the namespaceio.kubernetes.client.openapi.ApiException
- the api exceptionpublic KubernetesApiResponse<ApiType> get(String name, GetOptions getOptions)
name
- the namegetOptions
- the get optionspublic KubernetesApiResponse<ApiType> get(String namespace, String name, GetOptions getOptions)
namespace
- the namespacename
- the namegetOptions
- the get optionspublic KubernetesApiResponse<ApiListType> list(ListOptions listOptions)
listOptions
- the list optionspublic KubernetesApiResponse<ApiListType> list(String namespace, ListOptions listOptions)
namespace
- the namespacelistOptions
- the list optionspublic KubernetesApiResponse<ApiType> create(ApiType object, CreateOptions createOptions)
object
- the objectcreateOptions
- the create optionspublic KubernetesApiResponse<ApiType> create(String namespace, ApiType object, CreateOptions createOptions)
public KubernetesApiResponse<ApiType> update(ApiType object, UpdateOptions updateOptions)
object
- the objectupdateOptions
- the update optionspublic KubernetesApiResponse<ApiType> updateStatus(ApiType object, Function<ApiType,Object> status)
object
- the objectstatus
- function to extract the status from the objectpublic KubernetesApiResponse<ApiType> updateStatus(ApiType object, Function<ApiType,Object> status, UpdateOptions updateOptions)
object
- the objectstatus
- function to extract the status from the objectupdateOptions
- the update optionspublic KubernetesApiResponse<ApiType> patch(String name, String patchType, io.kubernetes.client.custom.V1Patch patch, PatchOptions patchOptions)
name
- the namepatchType
- the patch typepatch
- the patchpatchOptions
- the patch optionspublic KubernetesApiResponse<ApiType> patch(String namespace, String name, String patchType, io.kubernetes.client.custom.V1Patch patch, PatchOptions patchOptions)
namespace
- the namespacename
- the namepatchType
- the patch typepatch
- the patchpatchOptions
- the patch optionspublic KubernetesApiResponse<ApiType> delete(String name, DeleteOptions deleteOptions)
name
- the namedeleteOptions
- the delete optionspublic KubernetesApiResponse<ApiType> delete(String namespace, String name, DeleteOptions deleteOptions)
namespace
- the namespacename
- the namedeleteOptions
- the delete optionspublic Watchable<ApiType> watch(ListOptions listOptions) throws io.kubernetes.client.openapi.ApiException
listOptions
- the list optionsio.kubernetes.client.openapi.ApiException
- the api exceptionpublic Watchable<ApiType> watch(String namespace, ListOptions listOptions) throws io.kubernetes.client.openapi.ApiException
namespace
- the namespacelistOptions
- the list optionsio.kubernetes.client.openapi.ApiException
- the api exceptionCopyright © 2021. All rights reserved.