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

Commit

Permalink
Merge pull request #365 from hmalphettes/ec2-dhcp-options-tags
Browse files Browse the repository at this point in the history
Enable tags for EC2 DHCP Options
  • Loading branch information
svenwltr authored May 13, 2019
2 parents cd0e273 + cf1e237 commit c72475f
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 c72475f

Please sign in to comment.