diff --git a/README.md b/README.md index 757ba609..b33e49e0 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,6 @@ As a quick start, the following IAM policy can be used to grant the all permissi "cloudwatch:GetMetricData", "cloudwatch:GetMetricStatistics", "cloudwatch:ListMetrics", - "apigateway:GET", "aps:ListWorkspaces", "autoscaling:DescribeAutoScalingGroups", "dms:DescribeReplicationInstances", @@ -167,11 +166,6 @@ These are the bare minimum permissions required to run Static and Discovery Jobs "cloudwatch:ListMetrics" ``` -This permission is required to discover resources for the AWS/ApiGateway namespace -```json -"apigateway:GET" -``` - This permission is required to discover resources for the AWS/AutoScaling namespace ```json "autoscaling:DescribeAutoScalingGroups" diff --git a/pkg/clients/tagging/v1/client.go b/pkg/clients/tagging/v1/client.go index feb4c043..ed7034ef 100644 --- a/pkg/clients/tagging/v1/client.go +++ b/pkg/clients/tagging/v1/client.go @@ -5,8 +5,6 @@ import ( "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/apigateway/apigatewayiface" - "github.com/aws/aws-sdk-go/service/apigatewayv2/apigatewayv2iface" "github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface" "github.com/aws/aws-sdk-go/service/databasemigrationservice/databasemigrationserviceiface" "github.com/aws/aws-sdk-go/service/ec2/ec2iface" @@ -27,8 +25,6 @@ type client struct { logger logging.Logger taggingAPI resourcegroupstaggingapiiface.ResourceGroupsTaggingAPIAPI autoscalingAPI autoscalingiface.AutoScalingAPI - apiGatewayAPI apigatewayiface.APIGatewayAPI - apiGatewayV2API apigatewayv2iface.ApiGatewayV2API ec2API ec2iface.EC2API dmsAPI databasemigrationserviceiface.DatabaseMigrationServiceAPI prometheusSvcAPI prometheusserviceiface.PrometheusServiceAPI @@ -40,8 +36,6 @@ func NewClient( logger logging.Logger, taggingAPI resourcegroupstaggingapiiface.ResourceGroupsTaggingAPIAPI, autoscalingAPI autoscalingiface.AutoScalingAPI, - apiGatewayAPI apigatewayiface.APIGatewayAPI, - apiGatewayV2API apigatewayv2iface.ApiGatewayV2API, ec2API ec2iface.EC2API, dmsClient databasemigrationserviceiface.DatabaseMigrationServiceAPI, prometheusClient prometheusserviceiface.PrometheusServiceAPI, @@ -52,8 +46,6 @@ func NewClient( logger: logger, taggingAPI: taggingAPI, autoscalingAPI: autoscalingAPI, - apiGatewayAPI: apiGatewayAPI, - apiGatewayV2API: apiGatewayV2API, ec2API: ec2API, dmsAPI: dmsClient, prometheusSvcAPI: prometheusClient, diff --git a/pkg/clients/tagging/v1/filters.go b/pkg/clients/tagging/v1/filters.go index 72de9561..8f1ebb83 100644 --- a/pkg/clients/tagging/v1/filters.go +++ b/pkg/clients/tagging/v1/filters.go @@ -3,19 +3,15 @@ package v1 import ( "context" "fmt" - "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/apigatewayv2" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/prometheusservice" "github.com/aws/aws-sdk-go/service/shield" "github.com/aws/aws-sdk-go/service/storagegateway" - "github.com/grafana/regexp" "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" @@ -32,57 +28,6 @@ type ServiceFilter struct { // ServiceFilters maps a service namespace to (optional) ServiceFilter var ServiceFilters = map[string]ServiceFilter{ - "AWS/ApiGateway": { - FilterFunc: func(ctx context.Context, client client, inputResources []*model.TaggedResource) ([]*model.TaggedResource, error) { - promutil.APIGatewayAPICounter.Inc() - const maxPages = 10 - - var ( - limit int64 = 500 // max number of results per page. default=25, max=500 - input = apigateway.GetRestApisInput{Limit: &limit} - output = apigateway.GetRestApisOutput{} - pageNum int - outputResources []*model.TaggedResource - ) - - err := client.apiGatewayAPI.GetRestApisPagesWithContext(ctx, &input, func(page *apigateway.GetRestApisOutput, lastPage bool) bool { - promutil.APIGatewayAPICounter.Inc() - pageNum++ - output.Items = append(output.Items, page.Items...) - return pageNum <= maxPages - }) - if err != nil { - return nil, fmt.Errorf("error calling apiGatewayAPI.GetRestApisPages, %w", err) - } - outputV2, err := client.apiGatewayV2API.GetApisWithContext(ctx, &apigatewayv2.GetApisInput{}) - promutil.APIGatewayAPIV2Counter.Inc() - if err != nil { - return nil, fmt.Errorf("error calling apiGatewayAPIv2.GetApis, %w", err) - } - - for _, resource := range inputResources { - for i, gw := range output.Items { - searchString := regexp.MustCompile(fmt.Sprintf(".*restapis/%s$", *gw.Id)) - if searchString.MatchString(resource.ARN) { - r := resource - r.ARN = strings.ReplaceAll(resource.ARN, *gw.Id, *gw.Name) - outputResources = append(outputResources, r) - output.Items = append(output.Items[:i], output.Items[i+1:]...) - break - } - } - for i, gw := range outputV2.Items { - searchString := regexp.MustCompile(fmt.Sprintf(".*apis/%s$", *gw.ApiId)) - if searchString.MatchString(resource.ARN) { - outputResources = append(outputResources, resource) - outputV2.Items = append(outputV2.Items[:i], outputV2.Items[i+1:]...) - break - } - } - } - return outputResources, nil - }, - }, "AWS/AutoScaling": { ResourceFunc: func(ctx context.Context, client client, job *config.Job, region string) ([]*model.TaggedResource, error) { pageNum := 0 diff --git a/pkg/clients/tagging/v1/filters_test.go b/pkg/clients/tagging/v1/filters_test.go index b83f9548..98f14aa5 100644 --- a/pkg/clients/tagging/v1/filters_test.go +++ b/pkg/clients/tagging/v1/filters_test.go @@ -7,10 +7,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/apigateway/apigatewayiface" - "github.com/aws/aws-sdk-go/service/apigatewayv2" - "github.com/aws/aws-sdk-go/service/apigatewayv2/apigatewayv2iface" "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/aws/aws-sdk-go/service/databasemigrationservice/databasemigrationserviceiface" @@ -32,174 +28,6 @@ func TestValidServiceNames(t *testing.T) { } } -func TestApiGatewayFilterFunc(t *testing.T) { - tests := []struct { - name string - iface client - inputResources []*model.TaggedResource - outputResources []*model.TaggedResource - }{ - { - "api gateway resources skip stages", - client{ - apiGatewayAPI: apiGatewayClient{ - getRestApisOutput: &apigateway.GetRestApisOutput{ - Items: []*apigateway.RestApi{ - { - ApiKeySource: nil, - BinaryMediaTypes: nil, - CreatedDate: nil, - Description: nil, - DisableExecuteApiEndpoint: nil, - EndpointConfiguration: nil, - Id: aws.String("gwid1234"), - MinimumCompressionSize: nil, - Name: aws.String("apiname"), - Policy: nil, - Tags: nil, - Version: nil, - Warnings: nil, - }, - }, - Position: nil, - }, - }, - apiGatewayV2API: apiGatewayV2Client{ - getRestApisOutput: &apigatewayv2.GetApisOutput{ - Items: []*apigatewayv2.Api{}, - }, - }, - }, - []*model.TaggedResource{ - { - ARN: "arn:aws:apigateway:us-east-1::/restapis/gwid1234/stages/main", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value", - }, - }, - }, - { - ARN: "arn:aws:apigateway:us-east-1::/restapis/gwid1234", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value 2", - }, - }, - }, - }, - []*model.TaggedResource{ - { - ARN: "arn:aws:apigateway:us-east-1::/restapis/apiname", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value 2", - }, - }, - }, - }, - }, - { - "api gateway v2", - client{ - apiGatewayAPI: apiGatewayClient{ - getRestApisOutput: &apigateway.GetRestApisOutput{ - Items: []*apigateway.RestApi{}, - }, - }, - apiGatewayV2API: apiGatewayV2Client{ - getRestApisOutput: &apigatewayv2.GetApisOutput{ - Items: []*apigatewayv2.Api{ - { - CreatedDate: nil, - Description: nil, - DisableExecuteApiEndpoint: nil, - ApiId: aws.String("gwid9876"), - Name: aws.String("apiv2name"), - Tags: nil, - Version: nil, - Warnings: nil, - }, - }, - NextToken: nil, - }, - }, - }, - []*model.TaggedResource{ - { - ARN: "arn:aws:apigateway:us-east-1::/apis/gwid9876/stages/$default", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value", - }, - }, - }, - { - ARN: "arn:aws:apigateway:us-east-1::/apis/gwid9876", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value 2", - }, - }, - }, - }, - []*model.TaggedResource{ - { - ARN: "arn:aws:apigateway:us-east-1::/apis/gwid9876", - Namespace: "apigateway", - Region: "us-east-1", - Tags: []model.Tag{ - { - Key: "Test", - Value: "Value 2", - }, - }, - }, - }, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - apigateway := ServiceFilters["AWS/ApiGateway"] - - outputResources, err := apigateway.FilterFunc(context.Background(), test.iface, test.inputResources) - if err != nil { - t.Logf("Error from FilterFunc: %v", err) - t.FailNow() - } - if len(outputResources) != len(test.outputResources) { - t.Logf("len(outputResources) = %d, want %d", len(outputResources), len(test.outputResources)) - t.Fail() - } - for i, resource := range outputResources { - if len(test.outputResources) <= i { - break - } - wantResource := *test.outputResources[i] - if !reflect.DeepEqual(*resource, wantResource) { - t.Errorf("outputResources[%d] = %+v, want %+v", i, *resource, wantResource) - } - } - }) - } -} - func TestDMSFilterFunc(t *testing.T) { tests := []struct { name string @@ -430,22 +258,3 @@ func (dms dmsClient) DescribeReplicationTasksPagesWithContext(_ aws.Context, _ * fn(dms.describeReplicationTasksOutput, true) return nil } - -type apiGatewayClient struct { - apigatewayiface.APIGatewayAPI - getRestApisOutput *apigateway.GetRestApisOutput -} - -func (apigateway apiGatewayClient) GetRestApisPagesWithContext(_ aws.Context, _ *apigateway.GetRestApisInput, fn func(*apigateway.GetRestApisOutput, bool) bool, _ ...request.Option) error { - fn(apigateway.getRestApisOutput, true) - return nil -} - -type apiGatewayV2Client struct { - apigatewayv2iface.ApiGatewayV2API - getRestApisOutput *apigatewayv2.GetApisOutput -} - -func (apigateway apiGatewayV2Client) GetApisWithContext(_ aws.Context, _ *apigatewayv2.GetApisInput, _ ...request.Option) (*apigatewayv2.GetApisOutput, error) { - return apigateway.getRestApisOutput, nil -} diff --git a/pkg/clients/tagging/v2/client.go b/pkg/clients/tagging/v2/client.go index a7bb8e01..1c423912 100644 --- a/pkg/clients/tagging/v2/client.go +++ b/pkg/clients/tagging/v2/client.go @@ -6,8 +6,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/amp" - "github.com/aws/aws-sdk-go-v2/service/apigateway" - "github.com/aws/aws-sdk-go-v2/service/apigatewayv2" "github.com/aws/aws-sdk-go-v2/service/autoscaling" "github.com/aws/aws-sdk-go-v2/service/databasemigrationservice" "github.com/aws/aws-sdk-go-v2/service/ec2" @@ -26,8 +24,6 @@ type client struct { logger logging.Logger taggingAPI *resourcegroupstaggingapi.Client autoscalingAPI *autoscaling.Client - apiGatewayAPI *apigateway.Client - apiGatewayV2API *apigatewayv2.Client ec2API *ec2.Client dmsAPI *databasemigrationservice.Client prometheusSvcAPI *amp.Client @@ -39,8 +35,6 @@ func NewClient( logger logging.Logger, taggingAPI *resourcegroupstaggingapi.Client, autoscalingAPI *autoscaling.Client, - apiGatewayAPI *apigateway.Client, - apiGatewayV2API *apigatewayv2.Client, ec2API *ec2.Client, dmsClient *databasemigrationservice.Client, prometheusClient *amp.Client, @@ -51,8 +45,6 @@ func NewClient( logger: logger, taggingAPI: taggingAPI, autoscalingAPI: autoscalingAPI, - apiGatewayAPI: apiGatewayAPI, - apiGatewayV2API: apiGatewayV2API, ec2API: ec2API, dmsAPI: dmsClient, prometheusSvcAPI: prometheusClient, diff --git a/pkg/clients/tagging/v2/filters.go b/pkg/clients/tagging/v2/filters.go index 75189770..185935da 100644 --- a/pkg/clients/tagging/v2/filters.go +++ b/pkg/clients/tagging/v2/filters.go @@ -3,19 +3,15 @@ package v2 import ( "context" "fmt" - "strings" "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go-v2/service/amp" - "github.com/aws/aws-sdk-go-v2/service/apigateway" - "github.com/aws/aws-sdk-go-v2/service/apigatewayv2" "github.com/aws/aws-sdk-go-v2/service/autoscaling" "github.com/aws/aws-sdk-go-v2/service/databasemigrationservice" "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/shield" "github.com/aws/aws-sdk-go-v2/service/storagegateway" "github.com/aws/aws-sdk-go/aws" - "github.com/grafana/regexp" "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" @@ -32,58 +28,6 @@ type ServiceFilter struct { // ServiceFilters maps a service namespace to (optional) ServiceFilter var ServiceFilters = map[string]ServiceFilter{ - "AWS/ApiGateway": { - FilterFunc: func(ctx context.Context, client client, inputResources []*model.TaggedResource) ([]*model.TaggedResource, error) { - var limit int32 = 500 // max number of results per page. default=25, max=500 - const maxPages = 10 - input := apigateway.GetRestApisInput{Limit: &limit} - output := apigateway.GetRestApisOutput{} - var pageNum int - - paginator := apigateway.NewGetRestApisPaginator(client.apiGatewayAPI, &input, func(options *apigateway.GetRestApisPaginatorOptions) { - options.StopOnDuplicateToken = true - }) - for paginator.HasMorePages() && pageNum <= maxPages { - page, err := paginator.NextPage(ctx) - promutil.APIGatewayAPICounter.Inc() - if err != nil { - return nil, fmt.Errorf("error calling apiGatewayAPI.GetRestApis, %w", err) - } - pageNum++ - output.Items = append(output.Items, page.Items...) - } - - outputV2, err := client.apiGatewayV2API.GetApis(ctx, &apigatewayv2.GetApisInput{}) - if err != nil { - return nil, fmt.Errorf("error calling apigatewayv2.GetApis, %w", err) - } - - var outputResources []*model.TaggedResource - for _, resource := range inputResources { - for i, gw := range output.Items { - searchString := regexp.MustCompile(fmt.Sprintf(".*apis/%s$", *gw.Id)) - if searchString.MatchString(resource.ARN) { - r := resource - r.ARN = strings.ReplaceAll(resource.ARN, *gw.Id, *gw.Name) - outputResources = append(outputResources, r) - output.Items = append(output.Items[:i], output.Items[i+1:]...) - break - } - } - - for i, gw := range outputV2.Items { - searchString := regexp.MustCompile(fmt.Sprintf(".*apis/%s$", *gw.ApiId)) - if searchString.MatchString(resource.ARN) { - outputResources = append(outputResources, resource) - outputV2.Items = append(outputV2.Items[:i], outputV2.Items[i+1:]...) - break - } - } - } - - return outputResources, nil - }, - }, "AWS/AutoScaling": { ResourceFunc: func(ctx context.Context, client client, job *config.Job, region string) ([]*model.TaggedResource, error) { pageNum := 0 diff --git a/pkg/clients/v1/factory.go b/pkg/clients/v1/factory.go index 630fa84b..7f6a691f 100644 --- a/pkg/clients/v1/factory.go +++ b/pkg/clients/v1/factory.go @@ -11,10 +11,6 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/apigateway/apigatewayiface" - "github.com/aws/aws-sdk-go/service/apigatewayv2" - "github.com/aws/aws-sdk-go/service/apigatewayv2/apigatewayv2iface" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface" "github.com/aws/aws-sdk-go/service/cloudwatch" @@ -230,8 +226,6 @@ func createTaggingClient(logger logging.Logger, session *session.Session, region logger, createTagSession(session, region, role, logger.IsDebugEnabled()), createASGSession(session, region, role, logger.IsDebugEnabled()), - createAPIGatewaySession(session, region, role, fips, logger.IsDebugEnabled()), - createAPIGatewayV2Session(session, region, role, fips, logger.IsDebugEnabled()), createEC2Session(session, region, role, fips, logger.IsDebugEnabled()), createDMSSession(session, region, role, fips, logger.IsDebugEnabled()), createPrometheusSession(session, region, role, fips, logger.IsDebugEnabled()), @@ -455,38 +449,6 @@ func createDMSSession(sess *session.Session, region *string, role config.Role, f return databasemigrationservice.New(sess, setSTSCreds(sess, config, role)) } -func createAPIGatewaySession(sess *session.Session, region *string, role config.Role, fips bool, isDebugEnabled bool) apigatewayiface.APIGatewayAPI { - maxAPIGatewayAPIRetries := 5 - config := &aws.Config{Region: region, MaxRetries: &maxAPIGatewayAPIRetries} - if fips { - // https://docs.aws.amazon.com/general/latest/gr/apigateway.html - endpoint := fmt.Sprintf("https://apigateway-fips.%s.amazonaws.com", *region) - config.Endpoint = aws.String(endpoint) - } - - if isDebugEnabled { - config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody) - } - - return apigateway.New(sess, setSTSCreds(sess, config, role)) -} - -func createAPIGatewayV2Session(sess *session.Session, region *string, role config.Role, fips bool, isDebugEnabled bool) apigatewayv2iface.ApiGatewayV2API { - maxAPIGatewayAPIRetries := 5 - config := &aws.Config{Region: region, MaxRetries: &maxAPIGatewayAPIRetries} - if fips { - // https://docs.aws.amazon.com/general/latest/gr/apigateway.html - endpoint := fmt.Sprintf("https://apigateway-fips.%s.amazonaws.com", *region) - config.Endpoint = aws.String(endpoint) - } - - if isDebugEnabled { - config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody) - } - - return apigatewayv2.New(sess, setSTSCreds(sess, config, role)) -} - func createShieldSession(sess *session.Session, region *string, role config.Role, fips bool, isDebugEnabled bool) shieldiface.ShieldAPI { maxShieldAPIRetries := 5 config := &aws.Config{Region: region, MaxRetries: &maxShieldAPIRetries} diff --git a/pkg/clients/v1/factory_test.go b/pkg/clients/v1/factory_test.go index 928722f9..e08badaa 100644 --- a/pkg/clients/v1/factory_test.go +++ b/pkg/clients/v1/factory_test.go @@ -1048,18 +1048,6 @@ func TestCreateDMSSession(t *testing.T) { }) } -func TestCreateAPIGatewaySession(t *testing.T) { - testAWSClient( - t, - "APIGateway", - func(t *testing.T, s *session.Session, region *string, role config.Role, fips bool) { - iface := createAPIGatewaySession(s, region, role, fips, false) - if iface == nil { - t.Fail() - } - }) -} - func TestCreateStorageGatewaySession(t *testing.T) { testAWSClient( t, diff --git a/pkg/clients/v2/factory.go b/pkg/clients/v2/factory.go index dd24be81..e54e7b00 100644 --- a/pkg/clients/v2/factory.go +++ b/pkg/clients/v2/factory.go @@ -12,8 +12,6 @@ import ( aws_config "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/credentials/stscreds" "github.com/aws/aws-sdk-go-v2/service/amp" - "github.com/aws/aws-sdk-go-v2/service/apigateway" - "github.com/aws/aws-sdk-go-v2/service/apigatewayv2" "github.com/aws/aws-sdk-go-v2/service/autoscaling" "github.com/aws/aws-sdk-go-v2/service/cloudwatch" "github.com/aws/aws-sdk-go-v2/service/databasemigrationservice" @@ -180,8 +178,6 @@ func (c *CachingFactory) GetTaggingClient(region string, role config.Role, concu c.logger, c.createTaggingClient(c.clients[role][region].awsConfig), c.createAutoScalingClient(c.clients[role][region].awsConfig), - c.createAPIGatewayClient(c.clients[role][region].awsConfig), - c.createAPIGatewayV2Client(c.clients[role][region].awsConfig), c.createEC2Client(c.clients[role][region].awsConfig), c.createDMSClient(c.clients[role][region].awsConfig), c.createPrometheusClient(c.clients[role][region].awsConfig), @@ -226,8 +222,6 @@ func (c *CachingFactory) Refresh() { c.logger, c.createTaggingClient(cache.awsConfig), c.createAutoScalingClient(cache.awsConfig), - c.createAPIGatewayClient(cache.awsConfig), - c.createAPIGatewayV2Client(cache.awsConfig), c.createEC2Client(cache.awsConfig), c.createDMSClient(cache.awsConfig), c.createPrometheusClient(cache.awsConfig), @@ -319,26 +313,6 @@ func (c *CachingFactory) createDMSClient(assumedConfig *aws.Config) *databasemig }) } -func (c *CachingFactory) createAPIGatewayClient(assumedConfig *aws.Config) *apigateway.Client { - return apigateway.NewFromConfig(*assumedConfig, func(options *apigateway.Options) { - if c.logger.IsDebugEnabled() { - options.ClientLogMode = aws.LogRequestWithBody | aws.LogResponseWithBody - } - - options.RetryMaxAttempts = 5 - }) -} - -func (c *CachingFactory) createAPIGatewayV2Client(assumedConfig *aws.Config) *apigatewayv2.Client { - return apigatewayv2.NewFromConfig(*assumedConfig, func(options *apigatewayv2.Options) { - if c.logger.IsDebugEnabled() { - options.ClientLogMode = aws.LogRequestWithBody | aws.LogResponseWithBody - } - - options.RetryMaxAttempts = 5 - }) -} - func (c *CachingFactory) createStorageGatewayClient(assumedConfig *aws.Config) *storagegateway.Client { return storagegateway.NewFromConfig(*assumedConfig, func(options *storagegateway.Options) { if c.logger.IsDebugEnabled() { diff --git a/pkg/exporter.go b/pkg/exporter.go index 68a2c84d..6ea6fbcc 100644 --- a/pkg/exporter.go +++ b/pkg/exporter.go @@ -22,7 +22,6 @@ var Metrics = []prometheus.Collector{ promutil.ResourceGroupTaggingAPICounter, promutil.AutoScalingAPICounter, promutil.TargetGroupsAPICounter, - promutil.APIGatewayAPICounter, promutil.Ec2APICounter, promutil.DmsAPICounter, promutil.StoragegatewayAPICounter, diff --git a/pkg/promutil/prometheus.go b/pkg/promutil/prometheus.go index cbc2c4fa..19cc9b95 100644 --- a/pkg/promutil/prometheus.go +++ b/pkg/promutil/prometheus.go @@ -38,12 +38,6 @@ var ( Name: "yace_cloudwatch_targetgroupapi_requests_total", Help: "Help is not implemented yet.", }) - APIGatewayAPICounter = prometheus.NewCounter(prometheus.CounterOpts{ - Name: "yace_cloudwatch_apigatewayapi_requests_total", - }) - APIGatewayAPIV2Counter = prometheus.NewCounter(prometheus.CounterOpts{ - Name: "yace_cloudwatch_apigatewayapiv2_requests_total", - }) Ec2APICounter = prometheus.NewCounter(prometheus.CounterOpts{ Name: "yace_cloudwatch_ec2api_requests_total", Help: "Help is not implemented yet.",