Skip to content

Commit

Permalink
feat(neptune-cluster): tags and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ekristen committed Dec 13, 2024
1 parent a590066 commit 2791fdb
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions resources/neptune-clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/ekristen/libnuke/pkg/registry"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/ekristen/libnuke/pkg/types"

"github.com/ekristen/aws-nuke/v3/pkg/nuke"
)
Expand Down Expand Up @@ -42,9 +43,20 @@ func (l *NeptuneClusterLister) List(_ context.Context, o interface{}) ([]resourc
}

for _, dbCluster := range output.DBClusters {
var dbTags []*neptune.Tag
tags, err := svc.ListTagsForResource(&neptune.ListTagsForResourceInput{
ResourceName: dbCluster.DBClusterArn,
})
if err != nil {
opts.Logger.WithError(err).Warn("failed to list tags for resource")
} else {
dbTags = tags.TagList
}

resources = append(resources, &NeptuneCluster{
svc: svc,
ID: dbCluster.DBClusterIdentifier,
svc: svc,
ID: dbCluster.DBClusterIdentifier,
Tags: dbTags,
})
}

Expand All @@ -59,8 +71,9 @@ func (l *NeptuneClusterLister) List(_ context.Context, o interface{}) ([]resourc
}

type NeptuneCluster struct {
svc *neptune.Neptune
ID *string
svc *neptune.Neptune
ID *string
Tags []*neptune.Tag
}

func (f *NeptuneCluster) Remove(_ context.Context) error {
Expand All @@ -72,6 +85,10 @@ func (f *NeptuneCluster) Remove(_ context.Context) error {
return err
}

func (f *NeptuneCluster) Properties() types.Properties {
return types.NewPropertiesFromStruct(f)
}

func (f *NeptuneCluster) String() string {
return *f.ID
}

0 comments on commit 2791fdb

Please sign in to comment.