Skip to content

Commit 949fac6

Browse files
committed
feat: add tag support for APIGatewayDomainName resource
1 parent 16c6fbe commit 949fac6

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

resources/apigateway-domainnames.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,25 @@ func (l *APIGatewayDomainNameLister) List(ctx context.Context, o interface{}) ([
4343

4444
for i := range output.Items {
4545
item := &output.Items[i]
46+
47+
// Get tags for the domain
48+
tagsOutput, err := svc.GetTags(ctx, &apigateway.GetTagsInput{
49+
ResourceArn: aws.String("arn:aws:apigateway:" + opts.Config.Region + "::/domainnames/" + *item.DomainName),
50+
})
51+
if err != nil {
52+
return nil, err
53+
}
54+
55+
tags := make(map[string]string)
56+
for key, value := range tagsOutput.Tags {
57+
tags[key] = value
58+
}
59+
4660
resources = append(resources, &APIGatewayDomainName{
4761
svc: svc,
4862
DomainName: item.DomainName,
4963
DomainNameID: item.DomainNameId,
64+
Tags: tags,
5065
})
5166
}
5267

@@ -64,6 +79,7 @@ type APIGatewayDomainName struct {
6479
svc *apigateway.Client
6580
DomainName *string
6681
DomainNameID *string
82+
Tags map[string]string
6783
}
6884

6985
func (f *APIGatewayDomainName) Remove(ctx context.Context) error {
@@ -76,9 +92,20 @@ func (f *APIGatewayDomainName) Remove(ctx context.Context) error {
7692
}
7793

7894
func (f *APIGatewayDomainName) Properties() types.Properties {
79-
return types.NewPropertiesFromStruct(f)
95+
properties := types.NewProperties()
96+
97+
// Add all tags with "tag:" prefix
98+
for key, value := range f.Tags {
99+
properties.Set("tag:"+key, value)
100+
}
101+
102+
// Add other properties
103+
properties.Set("DomainName", f.DomainName)
104+
properties.Set("DomainNameID", f.DomainNameID)
105+
106+
return properties
80107
}
81108

82109
func (f *APIGatewayDomainName) String() string {
83110
return *f.DomainName
84-
}
111+
}

0 commit comments

Comments
 (0)