From a7caa3259ca0d3a95584600a6c5d142687086e58 Mon Sep 17 00:00:00 2001 From: jbleduigou Date: Mon, 16 Oct 2023 21:33:28 +0200 Subject: [PATCH 1/2] feat: retrieve tags of Kinesis Data Streams --- providers/aws/kinesis/streams.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/providers/aws/kinesis/streams.go b/providers/aws/kinesis/streams.go index de718e6d4..e7306e5cd 100644 --- a/providers/aws/kinesis/streams.go +++ b/providers/aws/kinesis/streams.go @@ -30,6 +30,18 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) { } for _, stream := range output.StreamSummaries { + tags := make([]Tag, 0) + tagsResp, err := kinesisClient.ListTagsForStream(context.Background(), &kinesis.ListTagsForStreamInput{ + StreamARN: stream.StreamARN, + }) + if err == nil { + for _, t := range tagsResp.Tags { + tags = append(tags, Tag{ + Key: aws.ToString(t.Key), + Value: aws.ToString(t.Value), + }) + } + } resources = append(resources, Resource{ Provider: "AWS", Account: client.Name, @@ -40,6 +52,7 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) { Cost: 0, CreatedAt: *stream.StreamCreationTimestamp, FetchedAt: time.Now(), + Tags: tags, Link: fmt.Sprintf("https://%s.console.aws.amazon.com/kinesis/home?region=%s#/streams/details/%s", client.AWSClient.Region, client.AWSClient.Region, *stream.StreamName), }) consumers, err := getStreamConsumers(ctx, kinesisClient, stream, client.Name, client.AWSClient.Region) From 25c9c28dd2fe2fd93c02c875d9173b0831bf71a7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Le Duigou Date: Tue, 17 Oct 2023 07:33:58 +0200 Subject: [PATCH 2/2] fix: log message when failed to retrieve tags Co-authored-by: Azanul Haque <42029519+Azanul@users.noreply.github.com> --- providers/aws/kinesis/streams.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/providers/aws/kinesis/streams.go b/providers/aws/kinesis/streams.go index e7306e5cd..6052ba3ae 100644 --- a/providers/aws/kinesis/streams.go +++ b/providers/aws/kinesis/streams.go @@ -41,6 +41,8 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) { Value: aws.ToString(t.Value), }) } + } else { + log.Warn("Failed to fetch tags for kinesis streams") } resources = append(resources, Resource{ Provider: "AWS",