Skip to content

Commit

Permalink
fix(oss): delete bucket policy if there's no more statements left aft…
Browse files Browse the repository at this point in the history
…er revoke
  • Loading branch information
Ayushi Sharma committed Dec 6, 2024
1 parent 676a585 commit c3ff20d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/providers/oss/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,19 @@ func (p *provider) RevokeAccess(ctx context.Context, pc *domain.ProviderConfig,
return err
}

err = client.SetBucketPolicy(g.Resource.URN, updatedPolicy)
if err != nil {
return fmt.Errorf("failed to set bucket policy: %w", err)
}

if updatedPolicy == "" {
err := client.DeleteBucketPolicy(g.Resource.URN)
err = client.DeleteBucketPolicy(g.Resource.URN)
if err != nil {
return fmt.Errorf("failed to delete bucket policy: %w", err)
}
return nil
}

err = client.SetBucketPolicy(g.Resource.URN, updatedPolicy)
if err != nil {
return fmt.Errorf("failed to set bucket policy: %w", err)
}

return nil
}

Expand Down

0 comments on commit c3ff20d

Please sign in to comment.