Package org.jdrupes.vmoperator.common
Class K8sDynamicStub
java.lang.Object
org.jdrupes.vmoperator.common.K8sGenericStub<K8sDynamicModel,K8sDynamicModels>
org.jdrupes.vmoperator.common.K8sDynamicStubBase<K8sDynamicModel,K8sDynamicModels>
org.jdrupes.vmoperator.common.K8sDynamicStub
A stub for namespaced custom objects.
It uses a dynamic model
(see K8sDynamicModel
) for representing the object’s
state and can therefore be used for any kind of object, especially
custom objects.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A factory for creating K8sDynamicModel(s) objects.Nested classes/interfaces inherited from class org.jdrupes.vmoperator.common.K8sGenericStub
K8sGenericStub.GenericSupplier<O extends io.kubernetes.client.common.KubernetesObject,
L extends io.kubernetes.client.common.KubernetesListObject, R extends K8sGenericStub<O, L>> -
Field Summary
Fields inherited from class org.jdrupes.vmoperator.common.K8sGenericStub
client, context, name, namespace
-
Constructor Summary
ConstructorDescriptionK8sDynamicStub
(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, String name) Instantiates a new dynamic stub. -
Method Summary
Modifier and TypeMethodDescriptionstatic K8sDynamicStub
createFromYaml
(K8sClient client, io.kubernetes.client.Discovery.APIResource context, Reader yaml) Creates a stub from yaml.static K8sDynamicStub
get
(K8sClient client, io.kubernetes.client.apimachinery.GroupVersionKind gvk, String namespace, String name) Get a dynamic object stub.static K8sDynamicStub
get
(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, String name) Get a dynamic object stub.static Collection
<K8sDynamicStub> Get the stubs for the objects in the given namespace.static Collection
<K8sDynamicStub> list
(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, io.kubernetes.client.util.generic.options.ListOptions options) Get the stubs for the objects in the given namespace that match the criteria from the given options.Methods inherited from class org.jdrupes.vmoperator.common.K8sGenericStub
apiResource, apply, context, create, delete, group, kind, list, model, name, namespace, patch, patch, plural, toString, update, update, updateStatus, updateStatus, updateStatus, version
-
Constructor Details
-
K8sDynamicStub
public K8sDynamicStub(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, String name) Instantiates a new dynamic stub.- Parameters:
client
- the clientcontext
- the contextnamespace
- the namespacename
- the name
-
-
Method Details
-
get
public static K8sDynamicStub get(K8sClient client, io.kubernetes.client.apimachinery.GroupVersionKind gvk, String namespace, String name) throws io.kubernetes.client.openapi.ApiException Get a dynamic object stub.If the version in parameter
gvk
is an empty string, the stub refers to the first object with matching group and kind.- Parameters:
client
- the clientgvk
- the group, version and kindnamespace
- the namespacename
- the name- Returns:
- the stub if the object exists
- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-
get
public static K8sDynamicStub get(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, String name) Get a dynamic object stub.- Parameters:
client
- the clientcontext
- the contextnamespace
- the namespacename
- the name- Returns:
- the stub if the object exists
- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-
createFromYaml
public static K8sDynamicStub createFromYaml(K8sClient client, io.kubernetes.client.Discovery.APIResource context, Reader yaml) throws io.kubernetes.client.openapi.ApiException Creates a stub from yaml.- Parameters:
client
- the clientcontext
- the contextyaml
- the yaml- Returns:
- the k 8 s dynamic stub
- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-
list
public static Collection<K8sDynamicStub> list(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace, io.kubernetes.client.util.generic.options.ListOptions options) throws io.kubernetes.client.openapi.ApiException Get the stubs for the objects in the given namespace that match the criteria from the given options.- Parameters:
client
- the clientnamespace
- the namespaceoptions
- the options- Returns:
- the collection
- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-
list
public static Collection<K8sDynamicStub> list(K8sClient client, io.kubernetes.client.Discovery.APIResource context, String namespace) throws io.kubernetes.client.openapi.ApiException Get the stubs for the objects in the given namespace.- Parameters:
client
- the clientnamespace
- the namespace- Returns:
- the collection
- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-