Skip to content

Commit

Permalink
Merge pull request #488 from ekristen/neptune-fixes
Browse files Browse the repository at this point in the history
feat: neptune - new properties and fix filter on engine
  • Loading branch information
ekristen authored Jan 2, 2025
2 parents 30eff30 + 26f7af9 commit 45a1d70
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
6 changes: 6 additions & 0 deletions resources/neptune-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func (l *NeptuneClusterLister) List(_ context.Context, o interface{}) ([]resourc
resources := make([]resource.Resource, 0)

params := &neptune.DescribeDBClustersInput{
Filters: []*neptune.Filter{
{
Name: aws.String("engine"),
Values: []*string{aws.String("neptune")},
},
},
MaxRecords: aws.Int64(100),
}

Expand Down
34 changes: 25 additions & 9 deletions resources/neptune-snapshots.go → resources/neptune-snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package resources

import (
"context"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/neptune"

"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 @@ -36,6 +38,12 @@ func (l *NeptuneSnapshotLister) List(_ context.Context, o interface{}) ([]resour

params := &neptune.DescribeDBClusterSnapshotsInput{
MaxRecords: aws.Int64(100),
Filters: []*neptune.Filter{
{
Name: aws.String("engine"),
Values: []*string{aws.String("neptune")},
},
},
}

for {
Expand All @@ -46,8 +54,10 @@ func (l *NeptuneSnapshotLister) List(_ context.Context, o interface{}) ([]resour

for _, dbClusterSnapshot := range output.DBClusterSnapshots {
resources = append(resources, &NeptuneSnapshot{
svc: svc,
ID: dbClusterSnapshot.DBClusterSnapshotIdentifier,
svc: svc,
ID: dbClusterSnapshot.DBClusterSnapshotIdentifier,
Status: dbClusterSnapshot.Status,
CreateTime: dbClusterSnapshot.SnapshotCreateTime,
})
}

Expand All @@ -62,18 +72,24 @@ func (l *NeptuneSnapshotLister) List(_ context.Context, o interface{}) ([]resour
}

type NeptuneSnapshot struct {
svc *neptune.Neptune
ID *string
svc *neptune.Neptune
ID *string
Status *string
CreateTime *time.Time
}

func (f *NeptuneSnapshot) Remove(_ context.Context) error {
_, err := f.svc.DeleteDBClusterSnapshot(&neptune.DeleteDBClusterSnapshotInput{
DBClusterSnapshotIdentifier: f.ID,
func (r *NeptuneSnapshot) Remove(_ context.Context) error {
_, err := r.svc.DeleteDBClusterSnapshot(&neptune.DeleteDBClusterSnapshotInput{
DBClusterSnapshotIdentifier: r.ID,
})

return err
}

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

func (r *NeptuneSnapshot) Properties() types.Properties {
return types.NewPropertiesFromStruct(r)
}

0 comments on commit 45a1d70

Please sign in to comment.