@@ -25,61 +25,64 @@ private PrimaryUpdateAndCacheUtils() {}
2525 private static final Logger log = LoggerFactory .getLogger (PrimaryUpdateAndCacheUtils .class );
2626
2727 /**
28- * Makes sure that the up-to-date primary resource will be present during the next reconciliation.
29- * Using update (PUT) method.
28+ * Updates status and makes sure that the up-to-date primary resource will be present during the
29+ * next reconciliation. Using update (PUT) method.
3030 *
3131 * @param primary resource
3232 * @param context of reconciliation
3333 * @return updated resource
3434 * @param <P> primary resource type
3535 */
36- public static <P extends HasMetadata > P updateAndCacheStatus (P primary , Context <P > context ) {
36+ public static <P extends HasMetadata > P updateStatusAndCacheResource (
37+ P primary , Context <P > context ) {
3738 logWarnIfResourceVersionPresent (primary );
38- return patchAndCacheStatus (
39+ return patchStatusAndCacheResource (
3940 primary , context , () -> context .getClient ().resource (primary ).updateStatus ());
4041 }
4142
4243 /**
43- * Makes sure that the up-to-date primary resource will be present during the next reconciliation.
44- * Using JSON Merge patch.
44+ * Patches status with and makes sure that the up-to-date primary resource will be present during
45+ * the next reconciliation. Using JSON Merge patch.
4546 *
4647 * @param primary resource
4748 * @param context of reconciliation
4849 * @return updated resource
4950 * @param <P> primary resource type
5051 */
51- public static <P extends HasMetadata > P patchAndCacheStatus (P primary , Context <P > context ) {
52+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
53+ P primary , Context <P > context ) {
5254 logWarnIfResourceVersionPresent (primary );
53- return patchAndCacheStatus (
55+ return patchStatusAndCacheResource (
5456 primary , context , () -> context .getClient ().resource (primary ).patchStatus ());
5557 }
5658
5759 /**
58- * Makes sure that the up-to-date primary resource will be present during the next reconciliation.
59- * Using JSON Patch.
60+ * Patches status and makes sure that the up-to-date primary resource will be present during the
61+ * next reconciliation. Using JSON Patch.
6062 *
6163 * @param primary resource
6264 * @param context of reconciliation
6365 * @return updated resource
6466 * @param <P> primary resource type
6567 */
66- public static <P extends HasMetadata > P editAndCacheStatus (
68+ public static <P extends HasMetadata > P editStatusAndCacheResource (
6769 P primary , Context <P > context , UnaryOperator <P > operation ) {
6870 logWarnIfResourceVersionPresent (primary );
69- return patchAndCacheStatus (
71+ return patchStatusAndCacheResource (
7072 primary , context , () -> context .getClient ().resource (primary ).editStatus (operation ));
7173 }
7274
7375 /**
74- * Makes sure that the up-to-date primary resource will be present during the next reconciliation.
76+ * Patches the resource with supplied method and makes sure that the up-to-date primary resource
77+ * will be present during the next reconciliation.
7578 *
7679 * @param primary resource
7780 * @param context of reconciliation
7881 * @param patch free implementation of cache
7982 * @return the updated resource.
8083 * @param <P> primary resource type
8184 */
82- public static <P extends HasMetadata > P patchAndCacheStatus (
85+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
8386 P primary , Context <P > context , Supplier <P > patch ) {
8487 var updatedResource = patch .get ();
8588 context
@@ -90,16 +93,16 @@ public static <P extends HasMetadata> P patchAndCacheStatus(
9093 }
9194
9295 /**
93- * Makes sure that the up-to-date primary resource will be present during the next reconciliation.
94- * Using Server Side Apply.
96+ * Patches status and makes sure that the up-to-date primary resource will be present during the
97+ * next reconciliation. Using Server Side Apply.
9598 *
9699 * @param primary resource
97100 * @param freshResourceWithStatus - fresh resource with target state
98101 * @param context of reconciliation
99102 * @return the updated resource.
100103 * @param <P> primary resource type
101104 */
102- public static <P extends HasMetadata > P ssaPatchAndCacheStatus (
105+ public static <P extends HasMetadata > P ssaPatchStatusAndCacheResource (
103106 P primary , P freshResourceWithStatus , Context <P > context ) {
104107 logWarnIfResourceVersionPresent (freshResourceWithStatus );
105108 var res =
@@ -122,7 +125,8 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
122125 }
123126
124127 /**
125- * Patches the resource and adds it to the {@link PrimaryResourceCache}.
128+ * Patches the resource status and caches the response in provided {@link PrimaryResourceCache}.
129+ * Uses Server Side Apply.
126130 *
127131 * @param primary resource
128132 * @param freshResourceWithStatus - fresh resource with target state
@@ -131,10 +135,10 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
131135 * @return the updated resource.
132136 * @param <P> primary resource type
133137 */
134- public static <P extends HasMetadata > P ssaPatchAndCacheStatus (
138+ public static <P extends HasMetadata > P ssaPatchStatusAndCacheResource (
135139 P primary , P freshResourceWithStatus , Context <P > context , PrimaryResourceCache <P > cache ) {
136140 logWarnIfResourceVersionPresent (freshResourceWithStatus );
137- return patchAndCacheStatus (
141+ return patchStatusAndCacheResource (
138142 primary ,
139143 cache ,
140144 () ->
@@ -151,64 +155,66 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
151155 }
152156
153157 /**
154- * Patches the resource with JSON Patch and adds it to the {@link PrimaryResourceCache}.
158+ * Patches the resource with JSON Patch and caches the response in provided {@link
159+ * PrimaryResourceCache}.
155160 *
156161 * @param primary resource
157162 * @param context of reconciliation
158163 * @param cache - resource cache managed by user
159164 * @return the updated resource.
160165 * @param <P> primary resource type
161166 */
162- public static <P extends HasMetadata > P editAndCacheStatus (
167+ public static <P extends HasMetadata > P editStatusAndCacheResource (
163168 P primary , Context <P > context , PrimaryResourceCache <P > cache , UnaryOperator <P > operation ) {
164169 logWarnIfResourceVersionPresent (primary );
165- return patchAndCacheStatus (
170+ return patchStatusAndCacheResource (
166171 primary , cache , () -> context .getClient ().resource (primary ).editStatus (operation ));
167172 }
168173
169174 /**
170- * Patches the resource with JSON Merge patch and adds it to the {@link PrimaryResourceCache}
171- * provided.
175+ * Patches the resource status with JSON Merge patch and caches the response in provided {@link
176+ * PrimaryResourceCache}
172177 *
173178 * @param primary resource
174179 * @param context of reconciliation
175180 * @param cache - resource cache managed by user
176181 * @return the updated resource.
177182 * @param <P> primary resource type
178183 */
179- public static <P extends HasMetadata > P patchAndCacheStatus (
184+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
180185 P primary , Context <P > context , PrimaryResourceCache <P > cache ) {
181186 logWarnIfResourceVersionPresent (primary );
182- return patchAndCacheStatus (
187+ return patchStatusAndCacheResource (
183188 primary , cache , () -> context .getClient ().resource (primary ).patchStatus ());
184189 }
185190
186191 /**
187- * Updates the resource and adds it to the {@link PrimaryResourceCache}.
192+ * Updates the resource status and caches the response in provided {@link PrimaryResourceCache}.
188193 *
189194 * @param primary resource
190195 * @param context of reconciliation
191196 * @param cache - resource cache managed by user
192197 * @return the updated resource.
193198 * @param <P> primary resource type
194199 */
195- public static <P extends HasMetadata > P updateAndCacheStatus (
200+ public static <P extends HasMetadata > P updateStatusAndCacheResource (
196201 P primary , Context <P > context , PrimaryResourceCache <P > cache ) {
197202 logWarnIfResourceVersionPresent (primary );
198- return patchAndCacheStatus (
203+ return patchStatusAndCacheResource (
199204 primary , cache , () -> context .getClient ().resource (primary ).updateStatus ());
200205 }
201206
202207 /**
203- * Updates the resource using the user provided implementation anc caches the result.
208+ * Updates the resource using the user provided implementation and caches the response in provided
209+ * {@link PrimaryResourceCache}.
204210 *
205211 * @param primary resource
206212 * @param cache resource cache managed by user
207213 * @param patch implementation of resource update*
208214 * @return the updated resource.
209215 * @param <P> primary resource type
210216 */
211- public static <P extends HasMetadata > P patchAndCacheStatus (
217+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
212218 P primary , PrimaryResourceCache <P > cache , Supplier <P > patch ) {
213219 var updatedResource = patch .get ();
214220 cache .cacheResource (primary , updatedResource );
0 commit comments