Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
feat: Remove regional override (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbernays authored Aug 8, 2022
1 parent 5e20e88 commit 7f8025a
Show file tree
Hide file tree
Showing 139 changed files with 253 additions and 780 deletions.
8 changes: 2 additions & 6 deletions resources/services/accessanalyzer/analyzers.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,7 @@ func fetchAccessAnalyzerAnalyzerFindings(ctx context.Context, meta schema.Client
AnalyzerArn: analyzer.Arn,
}
for {
response, err := svc.ListFindings(ctx, &config, func(options *accessanalyzer.Options) {
options.Region = c.Region
})
response, err := svc.ListFindings(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand All @@ -298,9 +296,7 @@ func fetchAccessAnalyzerAnalyzerArchiveRules(ctx context.Context, meta schema.Cl
AnalyzerName: analyzer.Name,
}
for {
response, err := svc.ListArchiveRules(ctx, &config, func(options *accessanalyzer.Options) {
options.Region = c.Region
})
response, err := svc.ListArchiveRules(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
7 changes: 2 additions & 5 deletions resources/services/acm/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,14 @@ func AcmCertificates() *schema.Table {
func fetchAcmCertificates(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
cl := meta.(*client.Client)
svc := cl.Services().ACM
optsFn := func(o *acm.Options) {
o.Region = cl.Region
}
var input acm.ListCertificatesInput
for {
output, err := svc.ListCertificates(ctx, &input, optsFn)
output, err := svc.ListCertificates(ctx, &input)
if err != nil {
return diag.WrapError(err)
}
for _, item := range output.CertificateSummaryList {
do, err := svc.DescribeCertificate(ctx, &acm.DescribeCertificateInput{CertificateArn: item.CertificateArn}, optsFn)
do, err := svc.DescribeCertificate(ctx, &acm.DescribeCertificateInput{CertificateArn: item.CertificateArn})
if err != nil {
return diag.WrapError(err)
}
Expand Down
4 changes: 1 addition & 3 deletions resources/services/apigateway/api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ func fetchApigatewayApiKeys(ctx context.Context, meta schema.ClientMeta, parent
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetApiKeys(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetApiKeys(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
4 changes: 1 addition & 3 deletions resources/services/apigateway/client_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ func fetchApigatewayClientCertificates(ctx context.Context, meta schema.ClientMe
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetClientCertificates(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetClientCertificates(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
8 changes: 2 additions & 6 deletions resources/services/apigateway/domain_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ func fetchApigatewayDomainNames(ctx context.Context, meta schema.ClientMeta, par
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetDomainNames(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetDomainNames(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand All @@ -222,9 +220,7 @@ func fetchApigatewayDomainNameBasePathMappings(ctx context.Context, meta schema.
svc := c.Services().Apigateway
config := apigateway.GetBasePathMappingsInput{DomainName: r.DomainName}
for {
response, err := svc.GetBasePathMappings(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetBasePathMappings(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
44 changes: 11 additions & 33 deletions resources/services/apigateway/rest_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,7 @@ func fetchApigatewayRestApis(ctx context.Context, meta schema.ClientMeta, parent
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetRestApis(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetRestApis(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand All @@ -764,9 +762,7 @@ func fetchApigatewayRestApiAuthorizers(ctx context.Context, meta schema.ClientMe
svc := c.Services().Apigateway
config := apigateway.GetAuthorizersInput{RestApiId: r.Id}
for {
response, err := svc.GetAuthorizers(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetAuthorizers(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -787,9 +783,7 @@ func fetchApigatewayRestApiDeployments(ctx context.Context, meta schema.ClientMe
svc := c.Services().Apigateway
config := apigateway.GetDeploymentsInput{RestApiId: r.Id}
for {
response, err := svc.GetDeployments(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetDeployments(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -810,9 +804,7 @@ func fetchApigatewayRestApiDocumentationParts(ctx context.Context, meta schema.C
svc := c.Services().Apigateway
config := apigateway.GetDocumentationPartsInput{RestApiId: r.Id}
for {
response, err := svc.GetDocumentationParts(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetDocumentationParts(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -833,9 +825,7 @@ func fetchApigatewayRestApiDocumentationVersions(ctx context.Context, meta schem
svc := c.Services().Apigateway
config := apigateway.GetDocumentationVersionsInput{RestApiId: r.Id}
for {
response, err := svc.GetDocumentationVersions(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetDocumentationVersions(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -856,9 +846,7 @@ func fetchApigatewayRestApiGatewayResponses(ctx context.Context, meta schema.Cli
svc := c.Services().Apigateway
config := apigateway.GetGatewayResponsesInput{RestApiId: r.Id}
for {
response, err := svc.GetGatewayResponses(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetGatewayResponses(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -879,9 +867,7 @@ func fetchApigatewayRestApiModels(ctx context.Context, meta schema.ClientMeta, p
svc := c.Services().Apigateway
config := apigateway.GetModelsInput{RestApiId: r.Id}
for {
response, err := svc.GetModels(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetModels(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand Down Expand Up @@ -911,9 +897,7 @@ func resolveApigatewayRestAPIModelModelTemplate(ctx context.Context, meta schema
ModelName: r.Name,
}

response, err := svc.GetModelTemplate(ctx, &config, func(options *apigateway.Options) {
options.Region = cl.Region
})
response, err := svc.GetModelTemplate(ctx, &config)
if err != nil {
if client.IsAWSError(err, "BadRequestException") {
// This is an application level error and the user has nothing to do with that.
Expand All @@ -935,9 +919,7 @@ func fetchApigatewayRestApiRequestValidators(ctx context.Context, meta schema.Cl
svc := c.Services().Apigateway
config := apigateway.GetRequestValidatorsInput{RestApiId: r.Id}
for {
response, err := svc.GetRequestValidators(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetRequestValidators(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -958,9 +940,7 @@ func fetchApigatewayRestApiResources(ctx context.Context, meta schema.ClientMeta
svc := c.Services().Apigateway
config := apigateway.GetResourcesInput{RestApiId: r.Id}
for {
response, err := svc.GetResources(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetResources(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand All @@ -981,9 +961,7 @@ func fetchApigatewayRestApiStages(ctx context.Context, meta schema.ClientMeta, p
svc := c.Services().Apigateway
config := apigateway.GetStagesInput{RestApiId: r.Id}

response, err := svc.GetStages(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetStages(ctx, &config)
if err != nil {
if c.IsNotFoundError(err) {
return nil
Expand Down
8 changes: 2 additions & 6 deletions resources/services/apigateway/usage_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ func fetchApigatewayUsagePlans(ctx context.Context, meta schema.ClientMeta, pare
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetUsagePlans(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetUsagePlans(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand All @@ -225,9 +223,7 @@ func fetchApigatewayUsagePlanKeys(ctx context.Context, meta schema.ClientMeta, p
svc := c.Services().Apigateway
config := apigateway.GetUsagePlanKeysInput{UsagePlanId: r.Id}
for {
response, err := svc.GetUsagePlanKeys(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetUsagePlanKeys(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
4 changes: 1 addition & 3 deletions resources/services/apigateway/vpc_links.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ func fetchApigatewayVpcLinks(ctx context.Context, meta schema.ClientMeta, parent
c := meta.(*client.Client)
svc := c.Services().Apigateway
for {
response, err := svc.GetVpcLinks(ctx, &config, func(options *apigateway.Options) {
options.Region = c.Region
})
response, err := svc.GetVpcLinks(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
40 changes: 10 additions & 30 deletions resources/services/apigatewayv2/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,7 @@ func fetchApigatewayv2Apis(ctx context.Context, meta schema.ClientMeta, parent *
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetApis(ctx, &config, func(o *apigatewayv2.Options) {
// o.Region = c.Region
})
response, err := svc.GetApis(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -914,9 +912,7 @@ func fetchApigatewayv2ApiAuthorizers(ctx context.Context, meta schema.ClientMeta
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetAuthorizers(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetAuthorizers(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -937,9 +933,7 @@ func fetchApigatewayv2ApiDeployments(ctx context.Context, meta schema.ClientMeta
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetDeployments(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetDeployments(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -960,9 +954,7 @@ func fetchApigatewayv2ApiIntegrations(ctx context.Context, meta schema.ClientMet
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetIntegrations(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetIntegrations(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -985,9 +977,7 @@ func fetchApigatewayv2ApiIntegrationResponses(ctx context.Context, meta schema.C
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetIntegrationResponses(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetIntegrationResponses(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -1008,9 +998,7 @@ func fetchApigatewayv2ApiModels(ctx context.Context, meta schema.ClientMeta, par
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetModels(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetModels(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -1033,9 +1021,7 @@ func resolveApigatewayv2apiModelModelTemplate(ctx context.Context, meta schema.C
cl := meta.(*client.Client)
svc := cl.Services().Apigatewayv2

response, err := svc.GetModelTemplate(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = cl.Region
})
response, err := svc.GetModelTemplate(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand All @@ -1049,9 +1035,7 @@ func fetchApigatewayv2ApiRoutes(ctx context.Context, meta schema.ClientMeta, par
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetRoutes(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetRoutes(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -1074,9 +1058,7 @@ func fetchApigatewayv2ApiRouteResponses(ctx context.Context, meta schema.ClientM
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetRouteResponses(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetRouteResponses(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand All @@ -1097,9 +1079,7 @@ func fetchApigatewayv2ApiStages(ctx context.Context, meta schema.ClientMeta, par
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetStages(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetStages(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand Down
4 changes: 1 addition & 3 deletions resources/services/apigatewayv2/domain_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ func fetchApigatewayv2DomainNameRestApiMappings(ctx context.Context, meta schema
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetApiMappings(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetApiMappings(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand Down
4 changes: 1 addition & 3 deletions resources/services/apigatewayv2/vpc_links.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ func fetchApigatewayv2VpcLinks(ctx context.Context, meta schema.ClientMeta, pare
c := meta.(*client.Client)
svc := c.Services().Apigatewayv2
for {
response, err := svc.GetVpcLinks(ctx, &config, func(o *apigatewayv2.Options) {
o.Region = c.Region
})
response, err := svc.GetVpcLinks(ctx, &config)

if err != nil {
return diag.WrapError(err)
Expand Down
4 changes: 1 addition & 3 deletions resources/services/applicationautoscaling/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ func fetchApplicationautoscalingPolicies(ctx context.Context, meta schema.Client
ServiceNamespace: types.ServiceNamespace(c.AutoscalingNamespace),
}
for {
output, err := svc.DescribeScalingPolicies(ctx, &config, func(o *applicationautoscaling.Options) {
o.Region = c.Region
})
output, err := svc.DescribeScalingPolicies(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
Expand Down
Loading

0 comments on commit 7f8025a

Please sign in to comment.