Skip to content

Commit

Permalink
Introduce fix for soft-deletion (#221)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Hoppe <[email protected]>
  • Loading branch information
roberth1988 and Robert Hoppe authored Aug 9, 2024
1 parent b486f6e commit da7d4e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/services/postgres-flex/v1.0/instance/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"net/http"
"strings"
"time"

"github.com/SchwarzIT/community-stackit-go-client/pkg/validate"
Expand Down Expand Up @@ -50,9 +51,16 @@ func (DeleteResponse) WaitHandler(ctx context.Context, c *ClientWithResponses, p
return wait.New(func() (interface{}, bool, error) {
res, err := c.Get(ctx, projectID, instanceID)
if err = validate.Response(res, err); err != nil {
// old handling of not found
if res != nil && res.StatusCode() == http.StatusNotFound {
return nil, true, nil
}

// new soft-deletion
if res.JSON200 != nil && res.JSON200.Item.Status != nil && strings.ToUpper(*res.JSON200.Item.Status) != "DELETED" {
return nil, true, nil
}

return nil, false, err
}
return nil, false, nil
Expand Down

0 comments on commit da7d4e8

Please sign in to comment.