@@ -9,9 +9,11 @@ public class UpdateControl<P extends HasMetadata> extends BaseControl<UpdateCont
9
9
private final boolean updateStatus ;
10
10
private final boolean updateResource ;
11
11
private final boolean patch ;
12
+ private final boolean onlyOnChange ;
12
13
13
14
private UpdateControl (
14
- P resource , boolean updateStatus , boolean updateResource , boolean patch ) {
15
+ P resource , boolean updateStatus , boolean updateResource , boolean patch , boolean onlyOnChange ) {
16
+ this .onlyOnChange = onlyOnChange ;
15
17
if ((updateResource || updateStatus ) && resource == null ) {
16
18
throw new IllegalArgumentException ("CustomResource cannot be null in case of update" );
17
19
}
@@ -31,7 +33,11 @@ private UpdateControl(
31
33
* @return initialized update control
32
34
*/
33
35
public static <T extends HasMetadata > UpdateControl <T > updateResource (T customResource ) {
34
- return new UpdateControl <>(customResource , false , true , false );
36
+ return new UpdateControl <>(customResource , false , true , false , false );
37
+ }
38
+
39
+ public static <T extends HasMetadata > UpdateControl <T > updateResourceIfChanged (T customResource ) {
40
+ return new UpdateControl <>(customResource , false , true , false , true );
35
41
}
36
42
37
43
/**
@@ -50,7 +56,11 @@ public static <T extends HasMetadata> UpdateControl<T> updateResource(T customRe
50
56
* @return UpdateControl instance
51
57
*/
52
58
public static <T extends HasMetadata > UpdateControl <T > patchStatus (T customResource ) {
53
- return new UpdateControl <>(customResource , true , false , true );
59
+ return new UpdateControl <>(customResource , true , false , true , false );
60
+ }
61
+
62
+ public static <T extends HasMetadata > UpdateControl <T > patchStatusIfChanged (T customResource ) {
63
+ return new UpdateControl <>(customResource , true , false , true , true );
54
64
}
55
65
56
66
/**
@@ -66,7 +76,11 @@ public static <T extends HasMetadata> UpdateControl<T> patchStatus(T customResou
66
76
* @return UpdateControl instance
67
77
*/
68
78
public static <T extends HasMetadata > UpdateControl <T > updateStatus (T customResource ) {
69
- return new UpdateControl <>(customResource , true , false , false );
79
+ return new UpdateControl <>(customResource , true , false , false , false );
80
+ }
81
+
82
+ public static <T extends HasMetadata > UpdateControl <T > updateStatusIfChanged (T customResource ) {
83
+ return new UpdateControl <>(customResource , true , false , false , false );
70
84
}
71
85
72
86
/**
@@ -79,17 +93,22 @@ public static <T extends HasMetadata> UpdateControl<T> updateStatus(T customReso
79
93
*/
80
94
public static <T extends HasMetadata > UpdateControl <T > updateResourceAndStatus (
81
95
T customResource ) {
82
- return new UpdateControl <>(customResource , true , true , false );
96
+ return new UpdateControl <>(customResource , true , true , false , false );
97
+ }
98
+
99
+ public static <T extends HasMetadata > UpdateControl <T > updateResourceAndStatusIfChanged (
100
+ T customResource ) {
101
+ return new UpdateControl <>(customResource , true , true , false , true );
83
102
}
84
103
85
104
public static <T extends HasMetadata > UpdateControl <T > patchResourceAndStatus (
86
105
T customResource ) {
87
- return new UpdateControl <>(customResource , true , true , true );
106
+ return new UpdateControl <>(customResource , true , true , true , false );
88
107
}
89
108
90
109
91
110
public static <T extends HasMetadata > UpdateControl <T > noUpdate () {
92
- return new UpdateControl <>(null , false , false , false );
111
+ return new UpdateControl <>(null , false , false , false , false );
93
112
}
94
113
95
114
public P getResource () {
@@ -115,4 +134,8 @@ public boolean isNoUpdate() {
115
134
public boolean isUpdateResourceAndStatus () {
116
135
return updateResource && updateStatus ;
117
136
}
137
+
138
+ public boolean isOnlyOnChange () {
139
+ return onlyOnChange ;
140
+ }
118
141
}
0 commit comments