Class RawCustomResourceOperationsImpl
java.lang.Object
io.fabric8.kubernetes.client.dsl.base.OperationSupport
io.fabric8.kubernetes.client.dsl.internal.RawCustomResourceOperationsImpl
public class RawCustomResourceOperationsImpl extends OperationSupport
This class simple does basic operations for custom defined resources without
demanding the POJOs for custom resources. It is serializing/deserializing
objects to plain hash map(String, Object).
Right now it supports basic operations like GET, POST, PUT, DELETE.
-
Field Summary
Fields inherited from class io.fabric8.kubernetes.client.dsl.base.OperationSupport
apiGroupName, apiGroupVersion, context, JSON, JSON_MAPPER, JSON_PATCH, name, namespace, resourceT, STRATEGIC_MERGE_JSON_PATCH, YAML_MAPPER -
Constructor Summary
Constructors Constructor Description RawCustomResourceOperationsImpl(okhttp3.OkHttpClient client, Config config, CustomResourceDefinitionContext customResourceDefinition) -
Method Summary
Modifier and Type Method Description Map<String,Object>create(InputStream objectAsStream)Create a custom resource which is non-namespaced object.Map<String,Object>create(String objectAsString)Create a custom resource which is a non-namespaced object.Map<String,Object>create(String namespace, InputStream objectAsStream)Create a custom resource which is a namespaced object.Map<String,Object>create(String namespace, String objectAsString)Create a custom resource which is a namespaced object.Map<String,Object>create(String namespace, Map<String,Object> object)Create a custom resource which is a namespaced object.Map<String,Object>create(Map<String,Object> object)Create a custom resource which is non-namespaced.Map<String,Object>createOrReplace(InputStream inputStream)Create or replace a custom resource which is non-namespaced object.Map<String,Object>createOrReplace(String objectAsString)Create or replace a custom resource which is a non-namespaced object.Map<String,Object>createOrReplace(String namespace, InputStream objectAsStream)Create or replace a custom resource which is namespaced object.Map<String,Object>createOrReplace(String namespace, String objectAsString)Create or replace a custom resource which is namespaced object.Map<String,Object>createOrReplace(String namespace, Map<String,Object> customResourceObject)Create or replace a custom resource which is namespaced object.Map<String,Object>createOrReplace(Map<String,Object> customResourceObject)Create or replace a custom resource which is a non-namespced object.Map<String,Object>delete(String namespace)Delete all custom resources in a specific namespaceMap<String,Object>delete(String namespace, boolean cascading)Delete all custom resources in a specific namespaceMap<String,Object>delete(String namespace, io.fabric8.kubernetes.api.model.DeleteOptions deleteOptions)Delete all custom resources in a specific namespaceMap<String,Object>delete(String namespace, String name)Delete a custom resource in a specific namespaceMap<String,Object>delete(String namespace, String name, boolean cascading)Delete a custom resource in a specific namespaceMap<String,Object>delete(String namespace, String name, io.fabric8.kubernetes.api.model.DeleteOptions deleteOptions)Delete a custom resource in a specific namespaceMap<String,Object>delete(String namespace, String name, String propagationPolicy)Delete a custom resource in a specific namespaceMap<String,Object>edit(String name, InputStream objectAsStream)Edit a custom resource object which is a non-namespaced object.Map<String,Object>edit(String name, String objectAsString)Edit a custom resource object which is a non-namespaced object.Map<String,Object>edit(String namespace, String name, InputStream objectAsStream)Edit a custom resource object which is a namespaced object.Map<String,Object>edit(String namespace, String name, String objectAsString)Edit a custom resource object which is a namespaced object.Map<String,Object>edit(String namespace, String name, Map<String,Object> object)Edit a custom resource object which is a namespaced object.Map<String,Object>edit(String name, Map<String,Object> object)Edit a custom resource object which is a non-namespaced object.protected okhttp3.HttpUrl.BuilderfetchWatchUrl(String namespace, String name, Map<String,String> labels, io.fabric8.kubernetes.api.model.ListOptions options)Map<String,Object>get(String name)Get a custom resource from the cluster which is non-namespaced.Map<String,Object>get(String namespace, String name)Get a custom resource from the cluster which is namespaced.Map<String,Object>list()List all custom resources in all namespacesMap<String,Object>list(String namespace)List all custom resources in a specific namespaceMap<String,Object>list(String namespace, Map<String,String> labels)List all custom resources in a specific namespace with some labelsMap<String,Object>load(InputStream fileInputStream)Load a custom resource object from an inputstream into a HashMapMap<String,Object>load(String objectAsJsonString)Load a custom resource object from a JSON string into a HashMapMap<String,Object>updateStatus(String name, InputStream objectAsStream)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourceMap<String,Object>updateStatus(String name, String objectAsJsonString)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourceMap<String,Object>updateStatus(String namespace, String name, InputStream objectAsStream)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourceMap<String,Object>updateStatus(String namespace, String name, String objectAsJsonString)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourceMap<String,Object>updateStatus(String namespace, String name, Map<String,Object> objectAsMap)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourceMap<String,Object>updateStatus(String name, Map<String,Object> objectAsMap)Update status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResourcevoidwatch(Watcher<String> watcher)Watchers custom resources across all namespaces.voidwatch(String namespace, io.fabric8.kubernetes.api.model.ListOptions options, Watcher<String> watcher)Watch a custom resource in a specific namespace with some resourceVersion.voidwatch(String namespace, Watcher<String> watcher)Watch custom resources in a specific namespace.voidwatch(String namespace, String resourceVersion, Watcher<String> watcher)Watch a custom resource in a specific namespace with some resourceVersion.Watchwatch(String namespace, String name, Map<String,String> labels, io.fabric8.kubernetes.api.model.ListOptions options, Watcher<String> watcher)Watch custom resources in the parameters specified.Watchwatch(String namespace, String name, Map<String,String> labels, String resourceVersion, Watcher<String> watcher)Watch custom resources in the parameters specified.Methods inherited from class io.fabric8.kubernetes.client.dsl.base.OperationSupport
assertResponseCode, checkName, checkNamespace, createStatus, createStatus, getAPIGroup, getAPIVersion, getConfig, getName, getNamespace, getNamespacedUrl, getNamespacedUrl, getNamespacedUrl, getObjectValueAsMap, getResourceT, getResourceUrl, getResourceUrl, getRootUrl, handleCreate, handleDelete, handleDelete, handleDeploymentRollback, handleGet, handleGet, handleMetric, handlePatch, handlePatch, handleReplace, handleReplace, handleResponse, handleResponse, handleResponse, handleResponse, handleScale, handleStatusUpdate, isResourceNamespaced, requestException, requestFailure, unmarshal, unmarshal, unmarshal
-
Constructor Details
-
RawCustomResourceOperationsImpl
public RawCustomResourceOperationsImpl(okhttp3.OkHttpClient client, Config config, CustomResourceDefinitionContext customResourceDefinition)
-
-
Method Details
-
load
Load a custom resource object from an inputstream into a HashMap- Parameters:
fileInputStream- file input stream- Returns:
- custom resource as HashMap
- Throws:
IOException- exception in case any read operation fails.
-
load
Load a custom resource object from a JSON string into a HashMap- Parameters:
objectAsJsonString- object as JSON string- Returns:
- custom resource as HashMap
- Throws:
IOException- exception in case any problem in reading json.
-
create
Create a custom resource which is a non-namespaced object.- Parameters:
objectAsString- object as JSON string- Returns:
- Object as HashMap
- Throws:
IOException- exception in case of any network/read problems
-
create
public Map<String,Object> create(Map<String,Object> object) throws KubernetesClientException, IOExceptionCreate a custom resource which is non-namespaced.- Parameters:
object- object a HashMap- Returns:
- Object as HashMap
- Throws:
KubernetesClientException- in case of error from Kubernetes APIIOException- in case of problems while reading HashMap
-
create
public Map<String,Object> create(String namespace, String objectAsString) throws KubernetesClientException, IOExceptionCreate a custom resource which is a namespaced object.- Parameters:
namespace- namespace in which we want object to be created.objectAsString- Object as JSON string- Returns:
- Object as HashMap
- Throws:
KubernetesClientException- in case of error from Kubernetes APIIOException- in case of problems while reading JSON object
-
create
public Map<String,Object> create(InputStream objectAsStream) throws KubernetesClientException, IOExceptionCreate a custom resource which is non-namespaced object.- Parameters:
objectAsStream- object as a file input stream- Returns:
- Object as HashMap
- Throws:
KubernetesClientException- in case of error from Kubernetes APIIOException- in case of problems while reading file
-
create
public Map<String,Object> create(String namespace, InputStream objectAsStream) throws KubernetesClientException, IOExceptionCreate a custom resource which is a namespaced object.- Parameters:
namespace- namespace in which we want object to be createdobjectAsStream- object as file input stream- Returns:
- Object as HashMap
- Throws:
KubernetesClientException- in case of error from Kubernetes APIIOException- in case of problems while reading file
-
create
public Map<String,Object> create(String namespace, Map<String,Object> object) throws KubernetesClientException, IOExceptionCreate a custom resource which is a namespaced object.- Parameters:
namespace- namespace in which we want object to be created.object- object as a HashMap- Returns:
- Object as HashMap
- Throws:
KubernetesClientException- in case of error from Kubernetes APIIOException- in case of problems faced while serializing HashMap
-
createOrReplace
Create or replace a custom resource which is a non-namespaced object.- Parameters:
objectAsString- object as JSON string- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serializiation failures or failures from Kuberntes API
-
createOrReplace
public Map<String,Object> createOrReplace(Map<String,Object> customResourceObject) throws IOExceptionCreate or replace a custom resource which is a non-namespced object.- Parameters:
customResourceObject- object as HashMap- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
createOrReplace
Create or replace a custom resource which is non-namespaced object.- Parameters:
inputStream- object as file input stream- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
createOrReplace
public Map<String,Object> createOrReplace(String namespace, String objectAsString) throws IOExceptionCreate or replace a custom resource which is namespaced object.- Parameters:
namespace- desired namespaceobjectAsString- object as JSON String- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
createOrReplace
public Map<String,Object> createOrReplace(String namespace, Map<String,Object> customResourceObject) throws IOExceptionCreate or replace a custom resource which is namespaced object.- Parameters:
namespace- desired namespacecustomResourceObject- object as HashMap- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
createOrReplace
public Map<String,Object> createOrReplace(String namespace, InputStream objectAsStream) throws IOExceptionCreate or replace a custom resource which is namespaced object.- Parameters:
namespace- desired namespaceobjectAsStream- object as file input stream- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
edit
Edit a custom resource object which is a non-namespaced object.- Parameters:
name- name of the custom resourceobject- new object as a HashMap- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
edit
Edit a custom resource object which is a non-namespaced object.- Parameters:
name- name of the custom resourceobjectAsString- new object as a JSON String- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
edit
public Map<String,Object> edit(String namespace, String name, Map<String,Object> object) throws IOExceptionEdit a custom resource object which is a namespaced object.- Parameters:
namespace- desired namespacename- name of the custom resourceobject- new object as a HashMap- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
edit
public Map<String,Object> edit(String namespace, String name, String objectAsString) throws IOExceptionEdit a custom resource object which is a namespaced object.- Parameters:
namespace- desired namespacename- name of the custom resourceobjectAsString- new object as a JSON string- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes API
-
edit
public Map<String,Object> edit(String name, InputStream objectAsStream) throws IOException, KubernetesClientExceptionEdit a custom resource object which is a non-namespaced object.- Parameters:
name- name of the custom resourceobjectAsStream- new object as a file input stream- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes APIKubernetesClientException
-
edit
public Map<String,Object> edit(String namespace, String name, InputStream objectAsStream) throws IOException, KubernetesClientExceptionEdit a custom resource object which is a namespaced object.- Parameters:
namespace- desired namespacename- name of the custom resourceobjectAsStream- new object as a file input stream- Returns:
- Object as HashMap
- Throws:
IOException- in case of network/serialization failures or failures from Kubernetes APIKubernetesClientException
-
updateStatus
public Map<String,Object> updateStatus(String name, Map<String,Object> objectAsMap) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
name- name of custom resourceobjectAsMap- custom resource as a HashMap- Returns:
- updated CustomResource as HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
updateStatus
public Map<String,Object> updateStatus(String name, String objectAsJsonString) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
name- name of CustomResourceobjectAsJsonString- CustomResource as a JSON string- Returns:
- updated CustomResource as a HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
updateStatus
public Map<String,Object> updateStatus(String namespace, String name, Map<String,Object> objectAsMap) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
namespace- namespace of CustomResourcename- name of CustomResourceobjectAsMap- CustomResource as a HashMap- Returns:
- updated CustomResource as a HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
updateStatus
public Map<String,Object> updateStatus(String name, InputStream objectAsStream) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
name- name of CustomResourceobjectAsStream- stream pointing to CustomResource- Returns:
- updated CustomResource as a HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
updateStatus
public Map<String,Object> updateStatus(String namespace, String name, InputStream objectAsStream) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
namespace- namespace of CustomResourcename- name of CustomResourceobjectAsStream- CustomResource object as a stream- Returns:
- updated CustomResource as a HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
updateStatus
public Map<String,Object> updateStatus(String namespace, String name, String objectAsJsonString) throws IOException, KubernetesClientExceptionUpdate status related to a CustomResource, this method does a PUT request on /status endpoint related to the CustomResource- Parameters:
namespace- namespace of CustomResourcename- name of CustomResourceobjectAsJsonString- CustomResource object as a JSON string- Returns:
- updated CustomResource as a HashMap
- Throws:
IOException- in case any failure to parse MapKubernetesClientException- in case any failure from Kubernetes APIs
-
get
Get a custom resource from the cluster which is non-namespaced.- Parameters:
name- name of custom resource- Returns:
- Object as HashMap
-
get
Get a custom resource from the cluster which is namespaced.- Parameters:
namespace- desired namespacename- name of custom resource- Returns:
- Object as HashMap
-
list
List all custom resources in all namespaces- Returns:
- list of custom resources as HashMap
-
list
List all custom resources in a specific namespace- Parameters:
namespace- desired namespace- Returns:
- list of custom resources as HashMap
-
list
List all custom resources in a specific namespace with some labels- Parameters:
namespace- desired namespacelabels- labels as a HashMap- Returns:
- list of custom resources as HashMap
-
delete
Delete all custom resources in a specific namespace- Parameters:
namespace- desired namespace- Returns:
- deleted objects as HashMap
-
delete
Delete all custom resources in a specific namespace- Parameters:
namespace- desired namespacecascading- whether dependent object need to be orphaned or not. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list.- Returns:
- deleted objects as HashMap
- Throws:
IOException- in case of any network/parsing exception
-
delete
public Map<String,Object> delete(String namespace, io.fabric8.kubernetes.api.model.DeleteOptions deleteOptions) throws IOExceptionDelete all custom resources in a specific namespace- Parameters:
namespace- desired namespacedeleteOptions- object provided by Kubernetes API for more fine grained control over deletion. For more information please see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#deleteoptions-v1-meta- Returns:
- deleted object as HashMap
- Throws:
IOException- in case of any network/object parse problems
-
delete
Delete a custom resource in a specific namespace- Parameters:
namespace- desired namespacename- custom resource's name- Returns:
- object as HashMap
- Throws:
IOException
-
delete
public Map<String,Object> delete(String namespace, String name, boolean cascading) throws IOExceptionDelete a custom resource in a specific namespace- Parameters:
namespace- required namespacename- required name of custom resourcecascading- whether dependent object need to be orphaned or not. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list.- Returns:
- deleted objects as HashMap
- Throws:
IOException- exception related to network/object parsing
-
delete
public Map<String,Object> delete(String namespace, String name, String propagationPolicy) throws IOExceptionDelete a custom resource in a specific namespace- Parameters:
namespace- required namespacename- required name of custom resourcepropagationPolicy- Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.- Returns:
- deleted object as HashMap
- Throws:
IOException- in case of network/object parse exception
-
delete
public Map<String,Object> delete(String namespace, String name, io.fabric8.kubernetes.api.model.DeleteOptions deleteOptions) throws IOExceptionDelete a custom resource in a specific namespace- Parameters:
namespace- required namespacename- name of custom resourcedeleteOptions- object provided by Kubernetes API for more fine grained control over deletion. For more information please see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#deleteoptions-v1-meta- Returns:
- deleted object as HashMap
- Throws:
IOException- in case of any network/object parse exception
-
watch
Watch custom resources in a specific namespace. Here Watcher is provided for string type only. User has to deserialize object itself.- Parameters:
namespace- namespace to watchwatcher- watcher object which reports updates with object- Throws:
IOException- in case of network error
-
watch
public void watch(String namespace, String resourceVersion, Watcher<String> watcher) throws IOExceptionWatch a custom resource in a specific namespace with some resourceVersion. Here watcher is provided from string type only. User has to deserialize object itself.- Parameters:
namespace- namespace to watchresourceVersion- resource version since when to watchwatcher- watcher object which reports updates- Throws:
IOException- in case of network error
-
watch
public void watch(String namespace, io.fabric8.kubernetes.api.model.ListOptions options, Watcher<String> watcher) throws IOExceptionWatch a custom resource in a specific namespace with some resourceVersion. Here watcher is provided from string type only. User has to deserialize object itself.- Parameters:
namespace- namespace to watchoptions-ListOptionslist options for watchingwatcher- watcher object which reports updates- Throws:
IOException- in case of network error
-
watch
Watchers custom resources across all namespaces. Here watcher is provided for string type only. User has to deserialize object itself.- Parameters:
watcher- watcher object which reports events- Throws:
IOException- in case of network error
-
watch
public Watch watch(String namespace, String name, Map<String,String> labels, String resourceVersion, Watcher<String> watcher) throws IOExceptionWatch custom resources in the parameters specified. Most of the parameters except watcher are optional, they would be skipped if passed null. Here watcher is provided for string type only. User has to deserialize the object itself.- Parameters:
namespace- namespace to watch (optionalname- name of custom resource (optional)labels- HashMap containing labels (optional)resourceVersion- resource version to start watch fromwatcher- watcher object which reports events- Throws:
IOException- in case of network error
-
watch
public Watch watch(String namespace, String name, Map<String,String> labels, io.fabric8.kubernetes.api.model.ListOptions options, Watcher<String> watcher) throws IOExceptionWatch custom resources in the parameters specified. Most of the parameters except watcher are optional, they would be skipped if passed null. Here watcher is provided for string type only. User has to deserialize the object itself.- Parameters:
namespace- namespace to watch (optionalname- name of custom resource (optional)labels- HashMap containing labels (optional)options-ListOptionslist options for watchwatcher- watcher object which reports events- Returns:
- watch object for watching resource
- Throws:
IOException- in case of network error
-
fetchWatchUrl
protected okhttp3.HttpUrl.Builder fetchWatchUrl(String namespace, String name, Map<String,String> labels, io.fabric8.kubernetes.api.model.ListOptions options) throws MalformedURLException- Throws:
MalformedURLException
-