Skip to content

Commit 6ef0b23

Browse files
committed
feat: improve resource names in chart
1 parent 23144a7 commit 6ef0b23

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

internal/chart/networkmanager.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ func mapRegistrations(tgs []*vpc.DescribeTGRegistrationsOutput) *opts.TreeData {
4848
account = *attachment.ResourceOwnerId
4949
}
5050

51-
name := fmt.Sprintf("%s\n%s\n%s",
51+
name := fmt.Sprintf("%s\n%s\n%s\n%s",
5252
common.GetEC2Tag(attachment.Tags, "Name", aws.ToString(attachment.TransitGatewayAttachmentId)),
5353
account,
5454
aws.ToString(attachment.ResourceId),
55+
common.GetEC2Tag(attachment.Tags, "cidr", ""),
5556
)
5657

5758
node := &opts.TreeData{

internal/common/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,17 @@ func GetEC2Tag(tags []ec2types.Tag, key string, missing string) string {
4242
}
4343
return missing
4444
}
45+
46+
func SetEC2Tag(tags []ec2types.Tag, key string, value *string) []ec2types.Tag {
47+
for _, tag := range tags {
48+
if aws.ToString(tag.Key) == key {
49+
tag.Key = value
50+
return tags
51+
}
52+
}
53+
newTags := append(tags, ec2types.Tag{
54+
Key: aws.String(key),
55+
Value: value,
56+
})
57+
return newTags
58+
}

0 commit comments

Comments
 (0)