@@ -25,61 +25,64 @@ private PrimaryUpdateAndCacheUtils() {}
25
25
private static final Logger log = LoggerFactory .getLogger (PrimaryUpdateAndCacheUtils .class );
26
26
27
27
/**
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.
30
30
*
31
31
* @param primary resource
32
32
* @param context of reconciliation
33
33
* @return updated resource
34
34
* @param <P> primary resource type
35
35
*/
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 ) {
37
38
logWarnIfResourceVersionPresent (primary );
38
- return patchAndCacheStatus (
39
+ return patchStatusAndCacheResource (
39
40
primary , context , () -> context .getClient ().resource (primary ).updateStatus ());
40
41
}
41
42
42
43
/**
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.
45
46
*
46
47
* @param primary resource
47
48
* @param context of reconciliation
48
49
* @return updated resource
49
50
* @param <P> primary resource type
50
51
*/
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 ) {
52
54
logWarnIfResourceVersionPresent (primary );
53
- return patchAndCacheStatus (
55
+ return patchStatusAndCacheResource (
54
56
primary , context , () -> context .getClient ().resource (primary ).patchStatus ());
55
57
}
56
58
57
59
/**
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.
60
62
*
61
63
* @param primary resource
62
64
* @param context of reconciliation
63
65
* @return updated resource
64
66
* @param <P> primary resource type
65
67
*/
66
- public static <P extends HasMetadata > P editAndCacheStatus (
68
+ public static <P extends HasMetadata > P editStatusAndCacheResource (
67
69
P primary , Context <P > context , UnaryOperator <P > operation ) {
68
70
logWarnIfResourceVersionPresent (primary );
69
- return patchAndCacheStatus (
71
+ return patchStatusAndCacheResource (
70
72
primary , context , () -> context .getClient ().resource (primary ).editStatus (operation ));
71
73
}
72
74
73
75
/**
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.
75
78
*
76
79
* @param primary resource
77
80
* @param context of reconciliation
78
81
* @param patch free implementation of cache
79
82
* @return the updated resource.
80
83
* @param <P> primary resource type
81
84
*/
82
- public static <P extends HasMetadata > P patchAndCacheStatus (
85
+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
83
86
P primary , Context <P > context , Supplier <P > patch ) {
84
87
var updatedResource = patch .get ();
85
88
context
@@ -90,16 +93,16 @@ public static <P extends HasMetadata> P patchAndCacheStatus(
90
93
}
91
94
92
95
/**
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.
95
98
*
96
99
* @param primary resource
97
100
* @param freshResourceWithStatus - fresh resource with target state
98
101
* @param context of reconciliation
99
102
* @return the updated resource.
100
103
* @param <P> primary resource type
101
104
*/
102
- public static <P extends HasMetadata > P ssaPatchAndCacheStatus (
105
+ public static <P extends HasMetadata > P ssaPatchStatusAndCacheResource (
103
106
P primary , P freshResourceWithStatus , Context <P > context ) {
104
107
logWarnIfResourceVersionPresent (freshResourceWithStatus );
105
108
var res =
@@ -122,7 +125,8 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
122
125
}
123
126
124
127
/**
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.
126
130
*
127
131
* @param primary resource
128
132
* @param freshResourceWithStatus - fresh resource with target state
@@ -131,10 +135,10 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
131
135
* @return the updated resource.
132
136
* @param <P> primary resource type
133
137
*/
134
- public static <P extends HasMetadata > P ssaPatchAndCacheStatus (
138
+ public static <P extends HasMetadata > P ssaPatchStatusAndCacheResource (
135
139
P primary , P freshResourceWithStatus , Context <P > context , PrimaryResourceCache <P > cache ) {
136
140
logWarnIfResourceVersionPresent (freshResourceWithStatus );
137
- return patchAndCacheStatus (
141
+ return patchStatusAndCacheResource (
138
142
primary ,
139
143
cache ,
140
144
() ->
@@ -151,64 +155,66 @@ public static <P extends HasMetadata> P ssaPatchAndCacheStatus(
151
155
}
152
156
153
157
/**
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}.
155
160
*
156
161
* @param primary resource
157
162
* @param context of reconciliation
158
163
* @param cache - resource cache managed by user
159
164
* @return the updated resource.
160
165
* @param <P> primary resource type
161
166
*/
162
- public static <P extends HasMetadata > P editAndCacheStatus (
167
+ public static <P extends HasMetadata > P editStatusAndCacheResource (
163
168
P primary , Context <P > context , PrimaryResourceCache <P > cache , UnaryOperator <P > operation ) {
164
169
logWarnIfResourceVersionPresent (primary );
165
- return patchAndCacheStatus (
170
+ return patchStatusAndCacheResource (
166
171
primary , cache , () -> context .getClient ().resource (primary ).editStatus (operation ));
167
172
}
168
173
169
174
/**
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}
172
177
*
173
178
* @param primary resource
174
179
* @param context of reconciliation
175
180
* @param cache - resource cache managed by user
176
181
* @return the updated resource.
177
182
* @param <P> primary resource type
178
183
*/
179
- public static <P extends HasMetadata > P patchAndCacheStatus (
184
+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
180
185
P primary , Context <P > context , PrimaryResourceCache <P > cache ) {
181
186
logWarnIfResourceVersionPresent (primary );
182
- return patchAndCacheStatus (
187
+ return patchStatusAndCacheResource (
183
188
primary , cache , () -> context .getClient ().resource (primary ).patchStatus ());
184
189
}
185
190
186
191
/**
187
- * Updates the resource and adds it to the {@link PrimaryResourceCache}.
192
+ * Updates the resource status and caches the response in provided {@link PrimaryResourceCache}.
188
193
*
189
194
* @param primary resource
190
195
* @param context of reconciliation
191
196
* @param cache - resource cache managed by user
192
197
* @return the updated resource.
193
198
* @param <P> primary resource type
194
199
*/
195
- public static <P extends HasMetadata > P updateAndCacheStatus (
200
+ public static <P extends HasMetadata > P updateStatusAndCacheResource (
196
201
P primary , Context <P > context , PrimaryResourceCache <P > cache ) {
197
202
logWarnIfResourceVersionPresent (primary );
198
- return patchAndCacheStatus (
203
+ return patchStatusAndCacheResource (
199
204
primary , cache , () -> context .getClient ().resource (primary ).updateStatus ());
200
205
}
201
206
202
207
/**
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}.
204
210
*
205
211
* @param primary resource
206
212
* @param cache resource cache managed by user
207
213
* @param patch implementation of resource update*
208
214
* @return the updated resource.
209
215
* @param <P> primary resource type
210
216
*/
211
- public static <P extends HasMetadata > P patchAndCacheStatus (
217
+ public static <P extends HasMetadata > P patchStatusAndCacheResource (
212
218
P primary , PrimaryResourceCache <P > cache , Supplier <P > patch ) {
213
219
var updatedResource = patch .get ();
214
220
cache .cacheResource (primary , updatedResource );
0 commit comments