Interface RmStatusReporter<T extends io.confluent.resourcemanager.api.model.HasMetadata>
- Type Parameters:
T- The resource type (must implement HasMetadata and be a protobuf Message)
- All Known Implementing Classes:
RmIspStatusReporter
-
Method Summary
Modifier and TypeMethodDescriptionaddFinalizer(T resource, String finalizer) Adds a finalizer to the resource's metadata.deleteFinalizer(T resource, String finalizer) Removes a finalizer from the resource's metadata, allowing deletion to proceed once all finalizers have been removed.Re-reads the resource from RM by its identity (name + scopes), returning the currently persisted copy with the latestresourceVersion.reportStatus(T resource, io.confluent.resourcemanager.protobuf.apis.meta.v1.Condition condition) Sets the status condition for the resource.setObservedGeneration(T resource) Updates the observed generation in the status field to match spec.generation
-
Method Details
-
reportStatus
CompletableFuture<T> reportStatus(T resource, io.confluent.resourcemanager.protobuf.apis.meta.v1.Condition condition) Sets the status condition for the resource.- Parameters:
resource- The resource to update (observedGeneration is not updated - this must be set by the application beforehand)condition- The condition that consists of type, status, reason, message, and lastTransitionTime- Returns:
- CompletableFuture with the updated resource
-
getLatest
Re-reads the resource from RM by its identity (name + scopes), returning the currently persisted copy with the latestresourceVersion. Use this before a status update to perform a read-modify-write and avoid optimistic-concurrency conflicts when other writers may have advanced the resource since it was last read.- Parameters:
resource- The resource whose identity to read; its contents other than identity are ignored- Returns:
- CompletableFuture with the current resource, completing exceptionally if it no longer exists
-
setObservedGeneration
-
addFinalizer
Adds a finalizer to the resource's metadata. If the finalizer is already present on the supplied resource, the resource is left unchanged and no update is issued to RM.Note: The decision to skip the update is made against the finalizer list of the
resourceargument, not against current RM state. If a stale resource is passed whose finalizer list has diverged from RM, the returned future may report success without the finalizer actually being persisted. The caller is responsible to read current state, modify, then update, and retry on aresourceVersionconflict.- Parameters:
resource- The resource to update; must reflect current RM statefinalizer- The finalizer to add- Returns:
- CompletableFuture with the updated resource
-
deleteFinalizer
Removes a finalizer from the resource's metadata, allowing deletion to proceed once all finalizers have been removed. If the finalizer is not present on the supplied resource, the resource is left unchanged and no update is issued to RM.Note: The decision to skip the update is made against the finalizer list of the
resourceargument, not against current RM state. If a stale resource is passed whose finalizer list has diverged from RM, the returned future may report success without the finalizer actually being removed. The caller is responsible to read current state, modify, then update, and retry on aresourceVersionconflict.- Parameters:
resource- The resource to update; must reflect current RM statefinalizer- The finalizer to remove- Returns:
- CompletableFuture with the updated resource
-