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

feat: Add filter for default OpenSearch Service packages #1128

Closed
Closed
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
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 (i *OSPackage) Filter() error {
if strings.HasPrefix(*i.packageName, "analysis-") || strings.HasPrefix(*i.packageName, "amazon-") {
return fmt.Errorf("Cannot delete default OpenSearch Service packages")
}
return nil
}

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