public class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>> extends OperationSupport implements OperationInfo, MixedOperation<T,L,R>, Resource<T>
Modifier and Type | Field and Description |
---|---|
protected String |
apiVersion |
protected Class<L> |
listType |
protected Class<T> |
type |
apiGroupName, apiGroupVersion, client, config, context, dryRun, JSON, JSON_MAPPER, JSON_PATCH, name, namespace, resourceT, STRATEGIC_MERGE_JSON_PATCH, YAML_MAPPER
DEFAULT_BACKOFF_MULTIPLIER, DEFAULT_INITIAL_BACKOFF_MILLIS
Modifier | Constructor and Description |
---|---|
protected |
BaseOperation(OperationContext ctx) |
Modifier and Type | Method and Description |
---|---|
T |
accept(Consumer<T> consumer) |
EditReplacePatchDeletable<T> |
cascading(boolean cascading)
deletes dependent resources.
|
T |
create(T... resources) |
T |
create(T resource) |
T |
createOrReplace(T... items)
Creates a provided resource in a Kubernetes Cluster.
|
Boolean |
delete()
Deletes resource and all managed resources, returns null or false if not found.
|
Boolean |
delete(List<T> items) |
Boolean |
delete(T... items) |
WritableOperation<T> |
dryRun(boolean isDryRun)
Indicates whether modifications should not be persisted or not.
|
<V> T |
edit(Class<V> visitorType,
io.fabric8.kubernetes.api.builder.Visitor<V> visitor) |
T |
edit(UnaryOperator<T> function) |
T |
edit(io.fabric8.kubernetes.api.builder.Visitor... visitors) |
protected URL |
fetchListUrl(URL url,
io.fabric8.kubernetes.api.model.ListOptions listOptions) |
OperationInfo |
forOperationType(String type) |
Gettable<T> |
fromServer() |
T |
get() |
String |
getApiVersion() |
protected Class<? extends Config> |
getConfigType() |
String |
getFieldQueryParam() |
protected Map<String,String> |
getFields() |
protected Map<String,String[]> |
getFieldsNot() |
Long |
getGracePeriodSeconds() |
T |
getItem() |
String |
getKind() |
String |
getLabelQueryParam() |
protected Map<String,String> |
getLabels() |
protected Map<String,String[]> |
getLabelsIn() |
protected Map<String,String[]> |
getLabelsNot() |
protected Map<String,String[]> |
getLabelsNotIn() |
Class<L> |
getListType() |
T |
getMandatory() |
String |
getOperationType() |
io.fabric8.kubernetes.api.model.DeletionPropagation |
getPropagationPolicy() |
Readiness |
getReadiness() |
String |
getResourceT() |
String |
getResourceVersion() |
io.fabric8.kubernetes.api.model.RootPaths |
getRootPaths() |
Class<T> |
getType() |
protected T |
handleCreate(T resource) |
protected io.fabric8.kubernetes.api.model.Status |
handleDeploymentRollback(io.fabric8.kubernetes.api.model.extensions.DeploymentRollback deploymentRollback) |
protected T |
handleGet(URL resourceUrl) |
protected T |
handlePatch(T current,
Map<String,Object> patchedUpdate) |
protected T |
handlePatch(T current,
T updated) |
protected T |
handleReplace(T updated) |
protected T |
handleResponse(okhttp3.Request.Builder requestBuilder) |
protected io.fabric8.kubernetes.api.model.autoscaling.v1.Scale |
handleScale(io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scaleParam) |
NonNamespaceOperation<T,L,R> |
inAnyNamespace() |
NonNamespaceOperation<T,L,R> |
inNamespace(String namespace) |
boolean |
isApiGroup()
Return true if this is an API Group where the versions include a slash in them
|
Boolean |
isCascading() |
Boolean |
isReady() |
Boolean |
isReloadingFromServer() |
boolean |
isResourceNamespaced() |
L |
list() |
L |
list(Integer limitVal,
String continueVal)
List resources from APIServer.
|
L |
list(io.fabric8.kubernetes.api.model.ListOptions listOptions)
List resource from Kubernetes API server.
|
R |
load(File file)
Load from a
File . |
R |
load(InputStream is)
Load from an
InputStream . |
R |
load(String path)
Load from path.
|
R |
load(URL url)
Load from a
URL . |
Replaceable<T> |
lockResourceVersion(String resourceVersion) |
BaseOperation<T,L,R> |
newInstance(OperationContext context) |
T |
patch(T item) |
T |
replace(T item) |
T |
require() |
protected T |
sendPatchedObject(T oldObject,
T updatedObject) |
void |
setListType(Class<L> listType) |
void |
setNamespace(String namespace) |
void |
setType(Class<T> type) |
protected void |
updateApiVersion(io.fabric8.kubernetes.api.model.HasMetadata hasMetadata)
Updates the resource if it has missing or default apiGroupVersion values and the resource is currently
using API Groups with custom version strings
|
protected void |
updateApiVersion(io.fabric8.kubernetes.api.model.KubernetesResourceList<T> list)
Updates the list items if they have missing or default apiGroupVersion values and the resource is currently
using API Groups with custom version strings
|
T |
updateStatus(T item)
When the status subresource is enabled, the /status subresource for the custom resource is exposed.
|
T |
waitUntilCondition(Predicate<T> condition,
long amount,
TimeUnit timeUnit) |
T |
waitUntilReady(long amount,
TimeUnit timeUnit) |
Watch |
watch(io.fabric8.kubernetes.api.model.ListOptions options,
Watcher<T> watcher)
Watch returns
Watch interface that watches requested resource |
Watch |
watch(String resourceVersion,
Watcher<T> watcher)
Watch returns
Watch interface that watches requested resource from
specified resourceVersion |
Watch |
watch(Watcher<T> watcher)
Watch returns
Watch interface that watches requested resource |
FilterWatchListDeletable<T,L> |
withField(String key,
String value) |
FilterWatchListDeletable<T,L> |
withFields(Map<String,String> fields) |
FilterWatchListDeletable<T,L> |
withGracePeriod(long gracePeriodSeconds)
The duration in seconds before the object should be deleted.
|
FilterWatchListDeletable<T,L> |
withInvolvedObject(io.fabric8.kubernetes.api.model.ObjectReference objectReference)
Filter with the object that this event is about.
|
BaseOperation<T,L,R> |
withItem(T item) |
FilterWatchListDeletable<T,L> |
withLabel(String key) |
FilterWatchListDeletable<T,L> |
withLabel(String key,
String value) |
FilterWatchListDeletable<T,L> |
withLabelIn(String key,
String... values) |
FilterWatchListDeletable<T,L> |
withLabelNotIn(String key,
String... values) |
FilterWatchListDeletable<T,L> |
withLabels(Map<String,String> labels) |
FilterWatchListDeletable<T,L> |
withLabelSelector(io.fabric8.kubernetes.api.model.LabelSelector selector) |
R |
withName(String name) |
FilterWatchListDeletable<T,L> |
withoutField(String key,
String value) |
FilterWatchListDeletable<T,L> |
withoutFields(Map<String,String> fields)
Deprecated.
as the underlying implementation does not align with the arguments fully.
Method is created to have a similar API as `withoutLabels`, but should eventually be replaced
with something better for the same reasons.
It is possible to negate multiple values with the same key, e.g.:
foo != bar , foo != baz
To support this a multi-value map is needed, as a regular map would override the key with the new value.
|
FilterWatchListDeletable<T,L> |
withoutLabel(String key) |
FilterWatchListDeletable<T,L> |
withoutLabel(String key,
String value) |
FilterWatchListDeletable<T,L> |
withoutLabels(Map<String,String> labels)
Deprecated.
as the underlying implementation does not align with the arguments anymore.
It is possible to negate multiple values with the same key, e.g.:
foo != bar , foo != baz
To support this a multi-value map is needed, as a regular map would override the key with the new value.
|
EditReplacePatchDeletable<T> |
withPropagationPolicy(io.fabric8.kubernetes.api.model.DeletionPropagation propagationPolicy)
Whether and how garbage collection will be performed.
|
R |
withResourceVersion(String resourceVersion) |
BaseOperation<T,L,R> |
withWaitRetryBackoff(long initialBackoff,
TimeUnit backoffUnit,
double backoffMultiplier)
Configure the backoff strategy to use when waiting for conditions, in case the watcher encounters a retryable error.
|
assertResponseCode, checkName, checkNamespace, createStatus, createStatus, getAPIGroup, getAPIVersion, getConfig, getName, getNamespace, getNamespacedUrl, getNamespacedUrl, getNamespacedUrl, getObjectValueAsMap, getResourceUrl, getResourceUrl, getResourceURLForWriteOperation, getRootUrl, handleCreate, handleDelete, handleDelete, handleDeploymentRollback, handleGet, handleGet, handleMetric, handlePatch, handlePatch, handleReplace, handleReplace, handleResponse, handleResponse, handleResponse, handleResponse, handleScale, handleStatusUpdate, requestException, requestFailure, unmarshal, unmarshal, unmarshal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getNamespace
dryRun
protected String apiVersion
protected BaseOperation(OperationContext ctx)
public BaseOperation<T,L,R> newInstance(OperationContext context)
protected URL fetchListUrl(URL url, io.fabric8.kubernetes.api.model.ListOptions listOptions) throws MalformedURLException
MalformedURLException
public T get()
public T require()
require
in interface Requirable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
public T getMandatory()
public io.fabric8.kubernetes.api.model.RootPaths getRootPaths()
public T edit(UnaryOperator<T> function)
public T edit(io.fabric8.kubernetes.api.builder.Visitor... visitors)
public Replaceable<T> lockResourceVersion(String resourceVersion)
lockResourceVersion
in interface Lockable<Replaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
public NonNamespaceOperation<T,L,R> inNamespace(String namespace)
inNamespace
in interface Namespaceable<NonNamespaceOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>>
public NonNamespaceOperation<T,L,R> inAnyNamespace()
inAnyNamespace
in interface AnyNamespaceable<FilterWatchListMultiDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public EditReplacePatchDeletable<T> cascading(boolean cascading)
Cascading
cascading
in interface Cascading<EditReplacePatchDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
cascading
- whether dependents should be orphaned or not.public R load(InputStream is)
Loadable
InputStream
.public Gettable<T> fromServer()
fromServer
in interface FromServerable<Gettable<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
@SafeVarargs public final T create(T... resources)
create
in interface Createable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
public T create(T resource)
create
in interface Createable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
@SafeVarargs public final T createOrReplace(T... items)
CreateOrReplaceable
createOrReplace
in interface CreateOrReplaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
items
- item to create or replacepublic FilterWatchListDeletable<T,L> withLabels(Map<String,String> labels)
withLabels
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withLabelSelector(io.fabric8.kubernetes.api.model.LabelSelector selector)
withLabelSelector
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
@Deprecated public FilterWatchListDeletable<T,L> withoutLabels(Map<String,String> labels)
withoutLabels
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withLabelIn(String key, String... values)
withLabelIn
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withLabelNotIn(String key, String... values)
withLabelNotIn
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withLabel(String key, String value)
withLabel
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withLabel(String key)
withLabel
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withoutLabel(String key, String value)
withoutLabel
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withoutLabel(String key)
withoutLabel
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withFields(Map<String,String> fields)
withFields
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withField(String key, String value)
withField
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withInvolvedObject(io.fabric8.kubernetes.api.model.ObjectReference objectReference)
Filterable
withInvolvedObject
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
objectReference
- ObjectReference
for providing information of referred object@Deprecated public FilterWatchListDeletable<T,L> withoutFields(Map<String,String> fields)
withoutFields
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public FilterWatchListDeletable<T,L> withoutField(String key, String value)
withoutField
in interface Filterable<FilterWatchListDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>>
public String getLabelQueryParam()
public String getFieldQueryParam()
public L list()
public L list(Integer limitVal, String continueVal)
Listable
public L list(io.fabric8.kubernetes.api.model.ListOptions listOptions)
Listable
public Boolean delete()
Deletable
@SafeVarargs public final Boolean delete(T... items)
delete
in interface MultiDeleteable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
public Boolean delete(List<T> items)
delete
in interface MultiDeleteable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
public T updateStatus(T item)
StatusUpdatable
updateStatus
in interface StatusUpdatable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
item
- kubernetes objectpublic BaseOperation<T,L,R> withItem(T item)
public R withResourceVersion(String resourceVersion)
withResourceVersion
in interface Versionable<WatchAndWaitable<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
public Watch watch(Watcher<T> watcher)
Watchable
Watch
interface that watches requested resourcepublic Watch watch(String resourceVersion, Watcher<T> watcher)
Watchable
Watch
interface that watches requested resource from
specified resourceVersionpublic Watch watch(io.fabric8.kubernetes.api.model.ListOptions options, Watcher<T> watcher)
Watchable
Watch
interface that watches requested resourcepublic T replace(T item)
replace
in interface Replaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
public boolean isResourceNamespaced()
isResourceNamespaced
in class OperationSupport
protected T handleResponse(okhttp3.Request.Builder requestBuilder) throws ExecutionException, InterruptedException, IOException
protected T handleCreate(T resource) throws ExecutionException, InterruptedException, IOException
protected T handleReplace(T updated) throws ExecutionException, InterruptedException, IOException
protected T handlePatch(T current, T updated) throws ExecutionException, InterruptedException, IOException
protected T handlePatch(T current, Map<String,Object> patchedUpdate) throws ExecutionException, InterruptedException, IOException
protected io.fabric8.kubernetes.api.model.autoscaling.v1.Scale handleScale(io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scaleParam)
protected io.fabric8.kubernetes.api.model.Status handleDeploymentRollback(io.fabric8.kubernetes.api.model.extensions.DeploymentRollback deploymentRollback)
protected T handleGet(URL resourceUrl) throws InterruptedException, ExecutionException, IOException
public Boolean isCascading()
public T getItem()
public String getResourceVersion()
public Boolean isReloadingFromServer()
public Long getGracePeriodSeconds()
public io.fabric8.kubernetes.api.model.DeletionPropagation getPropagationPolicy()
public String getResourceT()
getResourceT
in class OperationSupport
public String getKind()
getKind
in interface OperationInfo
public String getOperationType()
getOperationType
in interface OperationInfo
public OperationInfo forOperationType(String type)
forOperationType
in interface OperationInfo
public FilterWatchListDeletable<T,L> withGracePeriod(long gracePeriodSeconds)
GracePeriodConfigurable
withGracePeriod
in interface GracePeriodConfigurable<Deletable>
gracePeriodSeconds
- grace period integer value in secondspublic EditReplacePatchDeletable<T> withPropagationPolicy(io.fabric8.kubernetes.api.model.DeletionPropagation propagationPolicy)
PropagationPolicyConfigurable
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.
withPropagationPolicy
in interface PropagationPolicyConfigurable<EditReplacePatchDeletable<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
propagationPolicy
- propagation policy in form of string DeletionPropagation
public BaseOperation<T,L,R> withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier)
Waitable
withWaitRetryBackoff
in interface Waitable<T extends io.fabric8.kubernetes.api.model.HasMetadata,T extends io.fabric8.kubernetes.api.model.HasMetadata>
initialBackoff
- the value for the initial backoff on first errorbackoffUnit
- the TimeUnit for the initial backoff valuebackoffMultiplier
- what to multiply the backoff by on each subsequent errorprotected void updateApiVersion(io.fabric8.kubernetes.api.model.KubernetesResourceList<T> list)
list
- Kubernetes resource listprotected void updateApiVersion(io.fabric8.kubernetes.api.model.HasMetadata hasMetadata)
hasMetadata
- object whose api version needs to be updatedpublic String getApiVersion()
public boolean isApiGroup()
public Readiness getReadiness()
public T waitUntilReady(long amount, TimeUnit timeUnit) throws InterruptedException
waitUntilReady
in interface Waitable<T extends io.fabric8.kubernetes.api.model.HasMetadata,T extends io.fabric8.kubernetes.api.model.HasMetadata>
InterruptedException
public T waitUntilCondition(Predicate<T> condition, long amount, TimeUnit timeUnit) throws InterruptedException
waitUntilCondition
in interface Waitable<T extends io.fabric8.kubernetes.api.model.HasMetadata,T extends io.fabric8.kubernetes.api.model.HasMetadata>
InterruptedException
public void setNamespace(String namespace)
public WritableOperation<T> dryRun(boolean isDryRun)
DryRunable
dryRun
in interface DryRunable<WritableOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata>>
isDryRun
- whether dry run is enabled or disabledCopyright © 2015–2021 Red Hat. All rights reserved.