Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Add filter for opensearch default packages (#1130)
Browse files Browse the repository at this point in the history
* Adding filter to skip default opensearch packages
  • Loading branch information
swhite-oreilly authored Oct 23, 2023
1 parent c6b2a70 commit 4d35ec1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/opensearchservice-packages.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package resources

import (
"fmt"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws/session"
Expand Down Expand Up @@ -54,6 +56,13 @@ func ListOSPackages(sess *session.Session) ([]Resource, error) {
return resources, nil
}

func (o *OSPackage) Filter() error {
if strings.HasPrefix(*o.packageID, "G") {
return fmt.Errorf("cannot delete default opensearch packages")
}
return nil
}

func (o *OSPackage) Remove() error {
_, err := o.svc.DeletePackage(&opensearchservice.DeletePackageInput{
PackageID: o.packageID,
Expand Down

0 comments on commit 4d35ec1

Please sign in to comment.