Skip to content

Commit 424fc85

Browse files
committed
refactor(cloudwatchevents-target): standardization
1 parent 60243b3 commit 424fc85

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

resources/cloudwatchevents-targets.go renamed to resources/cloudwatchevents-target.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package resources
22

33
import (
44
"context"
5-
"github.com/ekristen/libnuke/pkg/types"
6-
75
"fmt"
86

97
"github.com/aws/aws-sdk-go/aws"
108
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
119

1210
"github.com/ekristen/libnuke/pkg/registry"
1311
"github.com/ekristen/libnuke/pkg/resource"
12+
"github.com/ekristen/libnuke/pkg/types"
1413

1514
"github.com/ekristen/aws-nuke/v3/pkg/nuke"
1615
)
@@ -75,25 +74,25 @@ type CloudWatchEventsTarget struct {
7574
busName *string
7675
}
7776

78-
func (target *CloudWatchEventsTarget) Remove(_ context.Context) error {
79-
ids := []*string{target.targetID}
80-
_, err := target.svc.RemoveTargets(&cloudwatchevents.RemoveTargetsInput{
77+
func (r *CloudWatchEventsTarget) Remove(_ context.Context) error {
78+
ids := []*string{r.targetID}
79+
_, err := r.svc.RemoveTargets(&cloudwatchevents.RemoveTargetsInput{
8180
Ids: ids,
82-
Rule: target.ruleName,
83-
EventBusName: target.busName,
81+
Rule: r.ruleName,
82+
EventBusName: r.busName,
8483
Force: aws.Bool(true),
8584
})
8685
return err
8786
}
8887

89-
func (target *CloudWatchEventsTarget) String() string {
88+
func (r *CloudWatchEventsTarget) String() string {
9089
// TODO: change this to IAM format rule -> target and mark as breaking change for filters
91-
return fmt.Sprintf("Rule: %s Target ID: %s", *target.ruleName, *target.targetID)
90+
return fmt.Sprintf("Rule: %s Target ID: %s", *r.ruleName, *r.targetID)
9291
}
9392

94-
func (target *CloudWatchEventsTarget) Properties() types.Properties {
93+
func (r *CloudWatchEventsTarget) Properties() types.Properties {
9594
return types.NewProperties().
96-
Set("Name", target.ruleName).
97-
Set("TargetID", target.targetID).
98-
Set("BusName", target.busName)
95+
Set("Name", r.ruleName).
96+
Set("TargetID", r.targetID).
97+
Set("BusName", r.busName)
9998
}

0 commit comments

Comments
 (0)