diff --git a/README.md b/README.md index 64495316..077502d4 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ providers: - route53.HealthCheck - route53.HostedZone - s3.Bucket -- sns.SNS +- sns.Topic - sqs.Queue # Development diff --git a/pkg/provider/aws/config/sns.yaml b/pkg/provider/aws/config/sns.yaml index 55d1077f..8378dd77 100644 --- a/pkg/provider/aws/config/sns.yaml +++ b/pkg/provider/aws/config/sns.yaml @@ -1,5 +1,5 @@ types: - - name: SNS + - name: Topic listApi: call: ListTopics outputKey: Topics diff --git a/pkg/provider/aws/sns_test.go b/pkg/provider/aws/sns_test.go index 84b1aa2e..70e800fa 100644 --- a/pkg/provider/aws/sns_test.go +++ b/pkg/provider/aws/sns_test.go @@ -13,11 +13,11 @@ func TestFetchSnsTopic(t *testing.T) { ctx := setupIntegrationTest(t) - resources := testprovider.FetchResources(ctx.ctx, t, ctx.p, "sns.SNS") + resources := testprovider.FetchResources(ctx.ctx, t, ctx.p, "sns.Topic") testingutil.AssertResourceCount(t, resources, "", 1) testingutil.AssertResourceFilteredCount(t, resources, 1, testingutil.ResourceFilter{ - Type: "sns.SNS", + Type: "sns.Topic", Region: defaultRegion, Tags: model.Tags{ { diff --git a/pkg/provider/aws/zz_integration_stats.json b/pkg/provider/aws/zz_integration_stats.json index 647d8bb8..f2fb8fdc 100644 --- a/pkg/provider/aws/zz_integration_stats.json +++ b/pkg/provider/aws/zz_integration_stats.json @@ -33,6 +33,6 @@ "route53.HealthCheck", "route53.HostedZone", "s3.Bucket", - "sns.SNS", + "sns.Topic", "sqs.Queue" ] diff --git a/pkg/provider/aws/zz_sns.go b/pkg/provider/aws/zz_sns.go index 91fcae39..421d8f61 100755 --- a/pkg/provider/aws/zz_sns.go +++ b/pkg/provider/aws/zz_sns.go @@ -12,35 +12,35 @@ import ( ) func (p *Provider) register_sns(mapping map[string]mapper) { - mapping["sns.SNS"] = mapper{ + mapping["sns.Topic"] = mapper{ ServiceEndpointID: "sns", - FetchFunc: p.fetch_sns_SNS, + FetchFunc: p.fetch_sns_Topic, IdField: "TopicArn", IsGlobal: false, } } -func (p *Provider) fetch_sns_SNS(ctx context.Context, output chan<- model.Resource) error { +func (p *Provider) fetch_sns_Topic(ctx context.Context, output chan<- model.Resource) error { client := sns.NewFromConfig(p.config) input := &sns.ListTopicsInput{} - resourceConverter := p.converterFor("sns.SNS") + resourceConverter := p.converterFor("sns.Topic") paginator := sns.NewListTopicsPaginator(client, input) for paginator.HasMorePages() { page, err := paginator.NextPage(ctx) if err != nil { - return fmt.Errorf("failed to fetch %s: %w", "sns.SNS", err) + return fmt.Errorf("failed to fetch %s: %w", "sns.Topic", err) } - if err := resourceconverter.SendAllConvertedTags(ctx, output, resourceConverter, page.Topics, p.getTags_sns_SNS); err != nil { + if err := resourceconverter.SendAllConvertedTags(ctx, output, resourceConverter, page.Topics, p.getTags_sns_Topic); err != nil { return err } } return nil } -func (p *Provider) getTags_sns_SNS(ctx context.Context, resource types.Topic) (model.Tags, error) { +func (p *Provider) getTags_sns_Topic(ctx context.Context, resource types.Topic) (model.Tags, error) { client := sns.NewFromConfig(p.config) input := &sns.ListTagsForResourceInput{} @@ -48,7 +48,7 @@ func (p *Provider) getTags_sns_SNS(ctx context.Context, resource types.Topic) (m output, err := client.ListTagsForResource(ctx, input) if err != nil { - return nil, fmt.Errorf("failed to fetch %s tags: %w", "sns.SNS", err) + return nil, fmt.Errorf("failed to fetch %s tags: %w", "sns.Topic", err) } tagField_0 := output.Tags