@@ -62,7 +62,19 @@ type ResourceConfig struct {
62
62
// these APIs, we basically need to revert to custom code because there's
63
63
// very little consistency to the APIs that we can use to instruct the code
64
64
// generator :(
65
- UpdateOperation * UpdateOperationConfig `json:"update_operation,omitempty"`
65
+ UpdateOperation * CustomOperationsConfig `json:"update_operation,omitempty"`
66
+ // FindOperation contains instructions for the code generator to generate
67
+ // Go code for the find operation for the resource. For some resources,
68
+ // there is no describe/find/list apis. However, it is possible to write
69
+ // `find` function for such resources using another resource's (say,
70
+ // resource B) `find` function. Then, one could write custom code to find
71
+ // the relevant resource from the response of resource B's find function.
72
+ //
73
+ // Additionally, if there the `find` function for a resource is not
74
+ // available then reconciler's progression is stalled with the error `find`
75
+ // operation `notImplemented`. Custom find function allows the reconciler's
76
+ // progression.
77
+ FindOperation * CustomOperationsConfig `json:"find_operation,omitempty"`
66
78
// Reconcile describes options for controlling the reconciliation
67
79
// logic for a particular resource.
68
80
Reconcile * ReconcileConfig `json:"reconcile,omitempty"`
@@ -312,12 +324,12 @@ type ListOperationConfig struct {
312
324
MatchFields []string `json:"match_fields"`
313
325
}
314
326
315
- // UpdateOperationConfig contains instructions for the code generator to handle
316
- // Update operations for service APIs that have resources that have
317
- // difficult-to-standardize update operations.
318
- type UpdateOperationConfig struct {
327
+ // CustomOperationsConfig contains instructions for the code generator to handle
328
+ // custom update/find operations for service APIs that have resources that have
329
+ // difficult-to-standardize update/find operations.
330
+ type CustomOperationsConfig struct {
319
331
// CustomMethodName is a string for the method name to replace the
320
- // sdkUpdate() method implementation for this resource
332
+ // sdkUpdate()/sdkFind() method implementation for this resource
321
333
CustomMethodName string `json:"custom_method_name"`
322
334
// OmitUnchangedFields instructs the code generator on how to generate
323
335
// `newUpdateRequestPayload` function. If the boolean is true, the code generator
@@ -651,6 +663,19 @@ func (c *Config) GetCustomUpdateMethodName(resourceName string) string {
651
663
return ""
652
664
}
653
665
666
+ func (c * Config ) GetCustomFindMethodName (resourceName string ) string {
667
+ if c == nil {
668
+ return ""
669
+ }
670
+ rConfig , found := c .Resources [resourceName ]
671
+ if found {
672
+ if rConfig .FindOperation != nil {
673
+ return rConfig .FindOperation .CustomMethodName
674
+ }
675
+ }
676
+ return ""
677
+ }
678
+
654
679
// GetAllRenames returns all of the CRD's field renames observed in the generator config
655
680
// for a given map of operations.
656
681
func (c * Config ) GetAllRenames (
0 commit comments