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

Commit

Permalink
Enable tags for EC2 DHCP Options
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalphettes committed May 12, 2019
1 parent cd0e273 commit cf1e237
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions resources/ec2-dhcp-options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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,
})
}

Expand All @@ -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
}

0 comments on commit cf1e237

Please sign in to comment.