Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundle/direct/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (d *DeploymentUnit) Deploy(ctx context.Context, db *dstate.DeploymentState,
case deployplan.Update:
return d.Update(ctx, db, oldID, newState, planEntry)
case deployplan.UpdateWithID:
return d.UpdateWithID(ctx, db, oldID, newState)
return d.UpdateWithID(ctx, db, oldID, newState, planEntry)
case deployplan.Resize:
return d.Resize(ctx, db, oldID, newState, planEntry)
default:
Expand Down Expand Up @@ -195,12 +195,12 @@ func (d *DeploymentUnit) Update(ctx context.Context, db *dstate.DeploymentState,
return nil
}

func (d *DeploymentUnit) UpdateWithID(ctx context.Context, db *dstate.DeploymentState, oldID string, newState any) error {
func (d *DeploymentUnit) UpdateWithID(ctx context.Context, db *dstate.DeploymentState, oldID string, newState any, planEntry *deployplan.PlanEntry) error {
var newID string
var remoteState any
err := retryOnTransientErr(ctx, func() error {
var e error
newID, remoteState, e = d.Adapter.DoUpdateWithID(ctx, oldID, newState)
newID, remoteState, e = d.Adapter.DoUpdateWithID(ctx, oldID, newState, planEntry)
return e
})
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions bundle/direct/dresources/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ type IResource interface {
DoUpdate(ctx context.Context, id string, newState any, entry *PlanEntry) (remoteState any, e error)

// [Optional] DoUpdateWithID performs an update that may result in resource having a new ID. Returns new id and optionally remote state.
DoUpdateWithID(ctx context.Context, id string, newState any) (newID string, remoteState any, e error)
// Example: func (r *ResourceCatalog) DoUpdateWithID(ctx context.Context, id string, newState *catalog.CreateCatalog, entry *PlanEntry) (string, *catalog.CatalogInfo, error)
DoUpdateWithID(ctx context.Context, id string, newState any, entry *PlanEntry) (newID string, remoteState any, e error)

// [Optional] DoResize resizes the resource. Only supported by clusters
DoResize(ctx context.Context, id string, newState any, entry *PlanEntry) error
Expand Down Expand Up @@ -593,12 +594,12 @@ func (a *Adapter) HasDoUpdateWithID() bool {
}

// DoUpdateWithID updates the resource and may change its ID. Returns newID and remoteState if available.
func (a *Adapter) DoUpdateWithID(ctx context.Context, oldID string, newState any) (string, any, error) {
func (a *Adapter) DoUpdateWithID(ctx context.Context, oldID string, newState any, entry *PlanEntry) (string, any, error) {
if a.doUpdateWithID == nil {
return "", nil, errors.New("internal error: DoUpdateWithID not found")
}

outs, err := a.doUpdateWithID.Call(ctx, oldID, newState)
outs, err := a.doUpdateWithID.Call(ctx, oldID, newState, entry)
if err != nil {
return "", nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion bundle/direct/dresources/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (r *ResourceCatalog) DoUpdate(ctx context.Context, id string, config *catal
}

// DoUpdateWithID updates the catalog and returns the new ID if the name changes.
func (r *ResourceCatalog) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateCatalog) (string, *catalog.CatalogInfo, error) {
func (r *ResourceCatalog) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateCatalog, _ *PlanEntry) (string, *catalog.CatalogInfo, error) {
updateRequest := catalog.UpdateCatalog{
Comment: config.Comment,
CustomMaxRetentionHours: config.CustomMaxRetentionHours,
Expand Down
2 changes: 1 addition & 1 deletion bundle/direct/dresources/external_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *ResourceExternalLocation) DoUpdate(ctx context.Context, id string, conf
}

// DoUpdateWithID updates the external location and returns the new ID if the name changes.
func (r *ResourceExternalLocation) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateExternalLocation) (string, *catalog.ExternalLocationInfo, error) {
func (r *ResourceExternalLocation) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateExternalLocation, _ *PlanEntry) (string, *catalog.ExternalLocationInfo, error) {
updateRequest := catalog.UpdateExternalLocation{
Comment: config.Comment,
CredentialName: config.CredentialName,
Expand Down
6 changes: 3 additions & 3 deletions bundle/direct/dresources/secret_scope_acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ func (r *ResourceSecretScopeAcls) DoCreate(ctx context.Context, state *SecretSco
}

// We implement DoUpdateWithId to ensure that the updated ID gets recorded in state.
func (r *ResourceSecretScopeAcls) DoUpdateWithID(ctx context.Context, id string, state *SecretScopeAclsState) (string, *SecretScopeAclsState, error) {
func (r *ResourceSecretScopeAcls) DoUpdateWithID(ctx context.Context, id string, state *SecretScopeAclsState, _ *PlanEntry) (string, *SecretScopeAclsState, error) {
err := r.setACLs(ctx, state.ScopeName, state.Acls)
if err != nil {
return "", nil, err
}
return state.ScopeName, nil, nil
}

func (r *ResourceSecretScopeAcls) DoUpdate(ctx context.Context, id string, state *SecretScopeAclsState, _ *PlanEntry) (*SecretScopeAclsState, error) {
_, _, err := r.DoUpdateWithID(ctx, id, state)
func (r *ResourceSecretScopeAcls) DoUpdate(ctx context.Context, id string, state *SecretScopeAclsState, entry *PlanEntry) (*SecretScopeAclsState, error) {
_, _, err := r.DoUpdateWithID(ctx, id, state, entry)
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion bundle/direct/dresources/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *ResourceVolume) DoUpdate(ctx context.Context, id string, config *catalo
return response, err
}

func (r *ResourceVolume) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateVolumeRequestContent) (string, *catalog.VolumeInfo, error) {
func (r *ResourceVolume) DoUpdateWithID(ctx context.Context, id string, config *catalog.CreateVolumeRequestContent, _ *PlanEntry) (string, *catalog.VolumeInfo, error) {
updateRequest := catalog.UpdateVolumeRequestContent{
Comment: config.Comment,
Name: id,
Expand Down
Loading