diff --git a/resources/ec2-dhcp-options.go b/resources/ec2-dhcp-options.go index ddd3162f..3ccdd552 100644 --- a/resources/ec2-dhcp-options.go +++ b/resources/ec2-dhcp-options.go @@ -3,11 +3,13 @@ package resources import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/rebuy-de/aws-nuke/pkg/types" ) type EC2DHCPOption struct { - svc *ec2.EC2 - id *string + svc *ec2.EC2 + id *string + tags []*ec2.Tag } func init() { @@ -26,8 +28,9 @@ func ListEC2DHCPOptions(sess *session.Session) ([]Resource, error) { for _, out := range resp.DhcpOptions { resources = append(resources, &EC2DHCPOption{ - svc: svc, - id: out.DhcpOptionsId, + svc: svc, + id: out.DhcpOptionsId, + tags: out.Tags, }) } @@ -47,6 +50,14 @@ func (e *EC2DHCPOption) Remove() error { return nil } +func (e *EC2DHCPOption) Properties() types.Properties { + properties := types.NewProperties() + for _, tagValue := range e.tags { + properties.SetTag(tagValue.Key, tagValue.Value) + } + return properties +} + func (e *EC2DHCPOption) String() string { return *e.id }