public class HasMetadataOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>> extends BaseOperation<T,L,R>
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_GRACE_PERIOD_IN_SECONDS |
static io.fabric8.kubernetes.api.model.DeletionPropagation |
DEFAULT_PROPAGATION_POLICY |
apiVersion, listType
type
apiGroupName, apiGroupVersion, client, config, context, dryRun, JSON, JSON_MAPPER, JSON_MERGE_PATCH, JSON_PATCH, name, namespace, resourceT, STRATEGIC_MERGE_JSON_PATCH, YAML_MAPPER
DEFAULT_BACKOFF_MULTIPLIER, DEFAULT_INITIAL_BACKOFF_MILLIS
Constructor and Description |
---|
HasMetadataOperation(OperationContext ctx,
Class<T> type,
Class<L> listType) |
Modifier and Type | Method and Description |
---|---|
T |
accept(Consumer<T> consumer)
Issues a JSON patch against the item based upon the changes made by the function provided as argument
|
protected <V extends io.fabric8.kubernetes.api.builder.VisitableBuilder<T,V>> |
createVisitableBuilder(T item) |
T |
edit(UnaryOperator<T> function)
Issues a JSON patch against the item based upon the changes made to the object returned by the function.
|
T |
edit(io.fabric8.kubernetes.api.builder.Visitor... visitors)
Issues a JSON patch against the item based upon the changes made to the object by the visitors.
|
T |
editStatus(UnaryOperator<T> function) |
protected T |
modifyItemForReplaceOrPatch(Supplier<T> current,
T item)
Modify the item prior to a replace or a JSON patch diff
|
BaseOperation<T,L,R> |
newInstance(OperationContext context) |
T |
patch(PatchContext patchContext,
String patch)
Update field(s) of a resource using type specified in
PatchContext (defaults to strategic merge if not specified). |
T |
patch(PatchContext patchContext,
T item)
Update field(s) of a resource using type specified in
PatchContext (defaults to strategic merge if not specified). |
protected T |
patch(PatchContext context,
T base,
T item,
boolean status) |
T |
patchStatus(T item)
Does a PATCH request to the /status subresource ignoring changes to anything except the status stanza.
|
T |
replace(T item)
Replace the server's state with the given item.
|
protected T |
replace(T item,
boolean status)
base replace operation, which is effectively a forced update with retries
|
T |
replaceStatus(T item)
Similar to
Replaceable.replace(Object) , but only affects the status subresource |
protected T |
requireFromServer()
Get the current item from the server
Will always return non-null or throw an exception. |
protected T |
requireFromServer(io.fabric8.kubernetes.api.model.ObjectMeta metadata)
Get the current item from the server, consulting the metadata for the name if needed
Will always return non-null or throw an exception. |
protected void |
validateOperation(Class<T> type) |
cascading, createOrReplace, delete, delete, delete, dryRun, edit, fetchListUrl, forOperationType, fromServer, get, getConfigType, getFieldQueryParam, getGracePeriodSeconds, getGroup, getItem, getKind, getLabelQueryParam, getListType, getMandatory, getOperationType, getPlural, getPropagationPolicy, getReadiness, getResourceVersion, getRootPaths, getVersion, handleCreate, handleDeploymentRollback, handleGet, handlePatch, handlePatch, handleResponse, handleScale, handleUpdate, inAnyNamespace, inform, informOnCondition, inNamespace, isCascading, isReady, isReloadingFromServer, isResourceNamespaced, list, list, list, load, load, load, load, lockResourceVersion, require, runnableInformer, sendPatchedObject, setListType, setNamespace, setType, updateApiVersion, updateApiVersion, updateStatus, waitUntilCondition, waitUntilReady, watch, watch, watch, withField, withFields, withGracePeriod, withIndexers, withInvolvedObject, withItem, withLabel, withLabelIn, withLabelNotIn, withLabels, withLabelSelector, withName, withNewFilter, withoutField, withoutFields, withoutLabel, withoutLabels, withPropagationPolicy, withResourceVersion, withWaitRetryBackoff
create, create, getType
assertResponseCode, checkName, checkNamespace, createStatus, createStatus, getAPIGroupName, getAPIGroupVersion, getConfig, getName, getNamespace, getNamespacedUrl, getNamespacedUrl, getNamespacedUrl, getObjectValueAsMap, getResourceT, getResourceUrl, getResourceUrl, getResourceUrl, getResourceURLForPatchOperation, getResourceURLForWriteOperation, getRootUrl, handleCreate, handleDelete, handleDelete, handleDeploymentRollback, handleGet, handleGet, handleMetric, handlePatch, handlePatch, handlePatch, handleResponse, handleResponse, handleResponse, handleResponse, handleScale, handleUpdate, handleUpdate, requestException, requestException, requestFailure, requestFailure, retryWithExponentialBackoff, unmarshal, unmarshal, unmarshal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFullResourceName, getName, getNamespace
withLabel, withoutLabel
inform, inform
create, create
dryRun
getNamespace
public static final io.fabric8.kubernetes.api.model.DeletionPropagation DEFAULT_PROPAGATION_POLICY
public static final long DEFAULT_GRACE_PERIOD_IN_SECONDS
public HasMetadataOperation(OperationContext ctx, Class<T> type, Class<L> listType)
public T edit(UnaryOperator<T> function)
Editable
It is generally convenient to use a Builder constructed off of the item.
edit
in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
edit
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
function
- to modify the itempublic T editStatus(UnaryOperator<T> function)
editStatus
in interface StatusEditable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
editStatus
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
public T accept(Consumer<T> consumer)
Editable
accept
in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
accept
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
consumer
- to modify the itemprotected <V extends io.fabric8.kubernetes.api.builder.VisitableBuilder<T,V>> io.fabric8.kubernetes.api.builder.VisitableBuilder<T,V> createVisitableBuilder(T item)
public T edit(io.fabric8.kubernetes.api.builder.Visitor... visitors)
Editable
edit
in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
edit
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
visitors
- to modify the Builderprotected T requireFromServer()
protected T requireFromServer(io.fabric8.kubernetes.api.model.ObjectMeta metadata)
public T replace(T item)
Replaceable
If Lockable.lockResourceVersion(String)
has been used to lock the resourceVersion,
this operation is effectively a single update attempt against that version.
If Lockable.lockResourceVersion(String)
has not been called, this operation
will be retried a number of times in the event of a conflict. If a resourceVersion has been set
on the item, the first update attempt will be made against that version. Subsequent attempts will fetch
the latest resourceVersion from the server.
replace
in interface Replaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
replace
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
item
- with the replacement statepublic T replaceStatus(T item)
StatusReplaceable
Replaceable.replace(Object)
, but only affects the status subresourcereplaceStatus
in interface StatusReplaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
replaceStatus
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
item
- with the status subresourceprotected T modifyItemForReplaceOrPatch(Supplier<T> current, T item)
current
- item from the serveritem
- to be modifiedprotected T replace(T item, boolean status)
protected T patch(PatchContext context, T base, T item, boolean status)
public T patchStatus(T item)
StatusPatchable
This method has the same patching behavior as Patchable.patch(PatchContext, Object)
, with PatchType.JSON_MERGE
but against the status subresource.
Set the resourceVersion to null to prevent optimistic locking.
patchStatus
in interface StatusPatchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
patchStatus
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
item
- kubernetes objectpublic T patch(PatchContext patchContext, T item)
Patchable
PatchContext
(defaults to strategic merge if not specified).
PatchType.JSON
- will create a JSON patch against the current item.
WARNING: This may overwrite concurrent changes (between when you obtained your item and the current state) in an unexpected way.
Consider using edit instead. The resourceVersion and other fields of the item may be modified by this call.
PatchType.JSON_MERGE
- will send the serialization of the item as a JSON MERGE patch.
Set the resourceVersion to null to prevent optimistic locking.
PatchType.STRATEGIC_MERGE
- will send the serialization of the item as a STRATEGIC MERGE patch.
Set the resourceVersion to null to prevent optimistic locking.
patch
in interface Patchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
patch
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
patchContext
- PatchContext
for patch requestitem
- to be patched with patched valuespublic T patch(PatchContext patchContext, String patch)
Patchable
PatchContext
(defaults to strategic merge if not specified).patch
in interface Patchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
patch
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
patchContext
- PatchContext
for patch requestpatch
- The patch to be applied to the resource JSON file.public BaseOperation<T,L,R> newInstance(OperationContext context)
newInstance
in class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,R extends Resource<T>>
Copyright © 2015–2020 Red Hat. All rights reserved.