@@ -3,11 +3,14 @@ package resources
3
3
import (
4
4
"context"
5
5
6
+ "github.com/sirupsen/logrus"
7
+
6
8
"github.com/aws/aws-sdk-go/aws"
7
9
"github.com/aws/aws-sdk-go/service/neptune"
8
10
9
11
"github.com/ekristen/libnuke/pkg/registry"
10
12
"github.com/ekristen/libnuke/pkg/resource"
13
+ "github.com/ekristen/libnuke/pkg/types"
11
14
12
15
"github.com/ekristen/aws-nuke/v3/pkg/nuke"
13
16
)
@@ -47,9 +50,22 @@ func (l *NeptuneInstanceLister) List(_ context.Context, o interface{}) ([]resour
47
50
}
48
51
49
52
for _ , dbInstance := range output .DBInstances {
53
+ var dbTags []* neptune.Tag
54
+ tags , err := svc .ListTagsForResource (& neptune.ListTagsForResourceInput {
55
+ ResourceName : dbInstance .DBInstanceArn ,
56
+ })
57
+ if err != nil {
58
+ logrus .WithError (err ).Warn ("failed to list tags for resource" )
59
+ }
60
+ if tags .TagList != nil {
61
+ dbTags = tags .TagList
62
+ }
63
+
50
64
resources = append (resources , & NeptuneInstance {
51
- svc : svc ,
52
- ID : dbInstance .DBInstanceIdentifier ,
65
+ svc : svc ,
66
+ ID : dbInstance .DBInstanceIdentifier ,
67
+ Name : dbInstance .DBName ,
68
+ Tags : dbTags ,
53
69
})
54
70
}
55
71
@@ -64,19 +80,25 @@ func (l *NeptuneInstanceLister) List(_ context.Context, o interface{}) ([]resour
64
80
}
65
81
66
82
type NeptuneInstance struct {
67
- svc * neptune.Neptune
68
- ID * string
83
+ svc * neptune.Neptune
84
+ ID * string
85
+ Name * string
86
+ Tags []* neptune.Tag
69
87
}
70
88
71
- func (f * NeptuneInstance ) Remove (_ context.Context ) error {
72
- _ , err := f .svc .DeleteDBInstance (& neptune.DeleteDBInstanceInput {
73
- DBInstanceIdentifier : f .ID ,
89
+ func (r * NeptuneInstance ) Remove (_ context.Context ) error {
90
+ _ , err := r .svc .DeleteDBInstance (& neptune.DeleteDBInstanceInput {
91
+ DBInstanceIdentifier : r .ID ,
74
92
SkipFinalSnapshot : aws .Bool (true ),
75
93
})
76
94
77
95
return err
78
96
}
79
97
80
- func (f * NeptuneInstance ) String () string {
81
- return * f .ID
98
+ func (r * NeptuneInstance ) Properties () types.Properties {
99
+ return types .NewPropertiesFromStruct (r )
100
+ }
101
+
102
+ func (r * NeptuneInstance ) String () string {
103
+ return * r .ID
82
104
}
0 commit comments