File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
public interface DependentResource <R extends HasMetadata > {
9
9
default R build () {
10
- throw new UnsupportedOperationException (
11
- "Should be implemented only if DependentResource is configured as creatable" );
10
+ if (getConfiguration ().creatable ()) {
11
+ throw new IllegalStateException (
12
+ "Should be implemented if DependentResource is configured as creatable" );
13
+ }
14
+ throw new IllegalStateException ("Should not be called if DependentResource is not creatable" );
12
15
}
13
16
14
17
ResourceCache <R > getCache ();
@@ -20,7 +23,11 @@ default R fetchFor(HasMetadata owner) {
20
23
DependentResourceConfiguration <R > getConfiguration ();
21
24
22
25
default R update (R fetched ) {
23
- return fetched ;
26
+ if (getConfiguration ().updatable ()) {
27
+ throw new IllegalStateException (
28
+ "Should be implemented if DependentResource is configured as updatable" );
29
+ }
30
+ throw new IllegalStateException ("Should not be called if DependentResource is not updatable" );
24
31
}
25
32
26
33
}
You can’t perform that action at this time.
0 commit comments