Skip to content

Commit 98a11d5

Browse files
authored
feat(route53-health-checks): add tags to properties (#729)
* feat(route53-health-checks): add tags to properties * feat: fixed naming of struct fields
1 parent 82e42c8 commit 98a11d5

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

docs/resources/route-53-health-check.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,22 @@ generated: true
1111
Route53HealthCheck
1212
```
1313

14+
## Properties
1415

1516

17+
- `ID`: No Description
18+
- `tag:<key>:`: This resource has tags with property `Tags`. These are key/value pairs that are
19+
added as their own property with the prefix of `tag:` (e.g. [tag:example: "value"])
20+
21+
!!! note - Using Properties
22+
Properties are what [Filters](../config-filtering.md) are written against in your configuration. You use the property
23+
names to write filters for what you want to **keep** and omit from the nuke process.
24+
25+
### String Property
26+
27+
The string representation of a resource is generally the value of the Name, ID or ARN field of the resource. Not all
28+
resources support properties. To write a filter against the string representation, simply omit the `property` field in
29+
the filter.
30+
31+
The string value is always what is used in the output of the log format when a resource is identified.
32+

resources/route53-health-checks.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,18 @@ func (l *Route53HealthCheckLister) List(_ context.Context, o interface{}) ([]res
4242
}
4343

4444
for _, check := range resp.HealthChecks {
45+
tags, err := svc.ListTagsForResource(&route53.ListTagsForResourceInput{
46+
ResourceId: check.Id,
47+
ResourceType: aws.String("healthcheck"),
48+
})
49+
if err != nil {
50+
return nil, err
51+
}
52+
4553
resources = append(resources, &Route53HealthCheck{
46-
svc: svc,
47-
id: check.Id,
54+
svc: svc,
55+
ID: check.Id,
56+
Tags: tags.ResourceTagSet.Tags,
4857
})
4958
}
5059

@@ -59,13 +68,14 @@ func (l *Route53HealthCheckLister) List(_ context.Context, o interface{}) ([]res
5968
}
6069

6170
type Route53HealthCheck struct {
62-
svc *route53.Route53
63-
id *string
71+
svc *route53.Route53
72+
ID *string
73+
Tags []*route53.Tag
6474
}
6575

6676
func (hz *Route53HealthCheck) Remove(_ context.Context) error {
6777
params := &route53.DeleteHealthCheckInput{
68-
HealthCheckId: hz.id,
78+
HealthCheckId: hz.ID,
6979
}
7080

7181
_, err := hz.svc.DeleteHealthCheck(params)
@@ -77,10 +87,9 @@ func (hz *Route53HealthCheck) Remove(_ context.Context) error {
7787
}
7888

7989
func (hz *Route53HealthCheck) Properties() types.Properties {
80-
return types.NewProperties().
81-
Set("ID", hz.id)
90+
return types.NewPropertiesFromStruct(hz)
8291
}
8392

8493
func (hz *Route53HealthCheck) String() string {
85-
return ptr.ToString(hz.id)
94+
return ptr.ToString(hz.ID)
8695
}

0 commit comments

Comments
 (0)