@@ -63,13 +63,10 @@ type IResource interface {
6363 // Example: func (r *ResourceVolume) DoCreate(ctx context.Context, newState *catalog.CreateVolumeRequestContent) (string, *catalog.VolumeInfo, error)
6464 DoCreate (ctx context.Context , newState any ) (id string , remoteState any , e error )
6565
66- // DoUpdate updates the resource. ID must not change as a result of this operation. Returns optionally remote state.
66+ // [Optional] DoUpdate updates the resource. ID must not change as a result of this operation. Returns optionally remote state.
6767 // If remote state is available as part of the operation, return it; otherwise return nil.
68- // Example: func (r *ResourceSchema) DoUpdate(ctx context.Context, id string, newState *catalog.CreateSchema) (*catalog.SchemaInfo, error)
69- DoUpdate (ctx context.Context , id string , newState any ) (remoteState any , e error )
70-
71- // [Optional] DoUpdateWithChanges updates the resource with information about changes computed during plan. Returns optionally remote state.
72- DoUpdateWithChanges (ctx context.Context , id string , newState any , changes * deployplan.Changes ) (remoteState any , e error )
68+ // Example: func (r *ResourceSchema) DoUpdate(ctx context.Context, id string, newState *catalog.CreateSchema, changes *deployplan.Changes) (*catalog.SchemaInfo, error)
69+ DoUpdate (ctx context.Context , id string , newState any , changes * deployplan.Changes ) (remoteState any , e error )
7370
7471 // [Optional] DoUpdateWithID performs an update that may result in resource having a new ID. Returns new id and optionally remote state.
7572 DoUpdateWithID (ctx context.Context , id string , newState any ) (newID string , remoteState any , e error )
@@ -94,15 +91,14 @@ type Adapter struct {
9491 doRefresh * calladapt.BoundCaller
9592 doDelete * calladapt.BoundCaller
9693 doCreate * calladapt.BoundCaller
97- doUpdate * calladapt.BoundCaller
9894
9995 // Optional:
100- doUpdateWithChanges * calladapt.BoundCaller
101- doUpdateWithID * calladapt.BoundCaller
102- waitAfterCreate * calladapt.BoundCaller
103- waitAfterUpdate * calladapt.BoundCaller
104- classifyChange * calladapt.BoundCaller
105- doResize * calladapt.BoundCaller
96+ doUpdate * calladapt.BoundCaller
97+ doUpdateWithID * calladapt.BoundCaller
98+ waitAfterCreate * calladapt.BoundCaller
99+ waitAfterUpdate * calladapt.BoundCaller
100+ classifyChange * calladapt.BoundCaller
101+ doResize * calladapt.BoundCaller
106102
107103 fieldTriggersLocal map [string ]deployplan.ActionType
108104 fieldTriggersRemote map [string ]deployplan.ActionType
@@ -128,7 +124,6 @@ func NewAdapter(typedNil any, client *databricks.WorkspaceClient) (*Adapter, err
128124 doDelete : nil ,
129125 doCreate : nil ,
130126 doUpdate : nil ,
131- doUpdateWithChanges : nil ,
132127 doUpdateWithID : nil ,
133128 doResize : nil ,
134129 waitAfterCreate : nil ,
@@ -225,14 +220,9 @@ func (a *Adapter) initMethods(resource any) error {
225220 return err
226221 }
227222
228- a .doUpdate , err = prepareCallRequired (resource , "DoUpdate" )
229- if err != nil {
230- return err
231- }
232-
233223 // Optional methods with varying signatures:
234224
235- a .doUpdateWithChanges , err = calladapt .PrepareCall (resource , calladapt .TypeOf [IResource ](), "DoUpdateWithChanges " )
225+ a .doUpdate , err = calladapt .PrepareCall (resource , calladapt .TypeOf [IResource ](), "DoUpdate " )
236226 if err != nil {
237227 return err
238228 }
@@ -299,7 +289,6 @@ func (a *Adapter) validate() error {
299289 validations := []any {
300290 "PrepareState return" , a .prepareState .OutTypes [0 ], stateType ,
301291 "DoCreate newState" , a .doCreate .InTypes [1 ], stateType ,
302- "DoUpdate newState" , a .doUpdate .InTypes [2 ], stateType ,
303292 }
304293
305294 // If RemapState is implemented, validate its signature.
@@ -319,19 +308,13 @@ func (a *Adapter) validate() error {
319308 }
320309 validations = append (validations , "DoCreate remoteState return" , a .doCreate .OutTypes [1 ], remoteType )
321310
322- // Validate DoUpdate: must return (remoteType, error)
323- if len (a .doUpdate .OutTypes ) != 2 {
324- return fmt .Errorf ("DoUpdate must return (remoteType, error), got %d return values" , len (a .doUpdate .OutTypes ))
325- }
326- validations = append (validations , "DoUpdate remoteState return" , a .doUpdate .OutTypes [0 ], remoteType )
327-
328- if a .doUpdateWithChanges != nil {
329- validations = append (validations , "DoUpdateWithChanges newState" , a .doUpdateWithChanges .InTypes [2 ], stateType )
330- // DoUpdateWithChanges must return (remoteType, error)
331- if len (a .doUpdateWithChanges .OutTypes ) != 2 {
332- return fmt .Errorf ("DoUpdateWithChanges must return (remoteType, error), got %d return values" , len (a .doUpdateWithChanges .OutTypes ))
311+ // Validate DoUpdate: must return (remoteType, error) if implemented
312+ if a .doUpdate != nil {
313+ validations = append (validations , "DoUpdate newState" , a .doUpdate .InTypes [2 ], stateType )
314+ if len (a .doUpdate .OutTypes ) != 2 {
315+ return fmt .Errorf ("DoUpdate must return (remoteType, error), got %d return values" , len (a .doUpdate .OutTypes ))
333316 }
334- validations = append (validations , "DoUpdateWithChanges remoteState return" , a .doUpdateWithChanges .OutTypes [0 ], remoteType )
317+ validations = append (validations , "DoUpdate remoteState return" , a .doUpdate .OutTypes [0 ], remoteType )
335318 }
336319
337320 if a .doResize != nil {
@@ -471,30 +454,19 @@ func (a *Adapter) DoCreate(ctx context.Context, newState any) (string, any, erro
471454 return id , remoteState , nil
472455}
473456
474- // DoUpdate updates the resource. Returns remote state if available, otherwise nil.
475- func (a * Adapter ) DoUpdate (ctx context.Context , id string , newState any ) (any , error ) {
476- outs , err := a .doUpdate .Call (ctx , id , newState )
477- if err != nil {
478- return nil , err
479- }
480-
481- remoteState := normalizeNilPointer (outs [0 ])
482- return remoteState , nil
483- }
484-
485- // HasDoUpdateWithChanges returns true if the resource implements DoUpdateWithChanges method.
486- func (a * Adapter ) HasDoUpdateWithChanges () bool {
487- return a .doUpdateWithChanges != nil
457+ // HasDoUpdate returns true if the resource implements DoUpdate method.
458+ func (a * Adapter ) HasDoUpdate () bool {
459+ return a .doUpdate != nil
488460}
489461
490- // DoUpdateWithChanges updates the resource with information about changes computed during plan.
462+ // DoUpdate updates the resource with information about changes computed during plan.
491463// Returns remote state if available, otherwise nil.
492- func (a * Adapter ) DoUpdateWithChanges (ctx context.Context , id string , newState any , changes * deployplan.Changes ) (any , error ) {
493- if a .doUpdateWithChanges == nil {
494- return nil , errors .New ("internal error: DoUpdateWithChanges not found" )
464+ func (a * Adapter ) DoUpdate (ctx context.Context , id string , newState any , changes * deployplan.Changes ) (any , error ) {
465+ if a .doUpdate == nil {
466+ return nil , errors .New ("internal error: DoUpdate not found" )
495467 }
496468
497- outs , err := a .doUpdateWithChanges .Call (ctx , id , newState , changes )
469+ outs , err := a .doUpdate .Call (ctx , id , newState , changes )
498470 if err != nil {
499471 return nil , err
500472 }
0 commit comments