diff --git a/config/go.mod b/config/go.mod index 12e0b72250f..bfb2577685a 100644 --- a/config/go.mod +++ b/config/go.mod @@ -19,6 +19,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../service/internal/presigned-url/ diff --git a/credentials/go.mod b/credentials/go.mod index 9e88907273a..64e2981867a 100644 --- a/credentials/go.mod +++ b/credentials/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2 => ../ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../service/internal/presigned-url/ replace github.com/aws/aws-sdk-go-v2/service/sso => ../service/sso/ diff --git a/example/service/s3/listObjects/go.mod b/example/service/s3/listObjects/go.mod index e8219d20ef5..8f019afb6a7 100644 --- a/example/service/s3/listObjects/go.mod +++ b/example/service/s3/listObjects/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../../service/internal/accept-encoding/ diff --git a/example/service/s3/usingPrivateLink/go.mod b/example/service/s3/usingPrivateLink/go.mod index f5f32a899fc..48c4c9a4186 100644 --- a/example/service/s3/usingPrivateLink/go.mod +++ b/example/service/s3/usingPrivateLink/go.mod @@ -17,6 +17,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../../service/internal/accept-encoding/ diff --git a/feature/dynamodb/attributevalue/go.mod b/feature/dynamodb/attributevalue/go.mod index b249093fda6..169262ed08e 100644 --- a/feature/dynamodb/attributevalue/go.mod +++ b/feature/dynamodb/attributevalue/go.mod @@ -11,6 +11,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/dynamodb/expression/go.mod b/feature/dynamodb/expression/go.mod index 14e2914deb9..ae2c6208f4c 100644 --- a/feature/dynamodb/expression/go.mod +++ b/feature/dynamodb/expression/go.mod @@ -12,6 +12,8 @@ replace github.com/aws/aws-sdk-go-v2 => ../../../ replace github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue => ../../../feature/dynamodb/attributevalue/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/dynamodbstreams/attributevalue/go.mod b/feature/dynamodbstreams/attributevalue/go.mod index 832c9708cd7..9f9d5d973af 100644 --- a/feature/dynamodbstreams/attributevalue/go.mod +++ b/feature/dynamodbstreams/attributevalue/go.mod @@ -11,6 +11,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/s3/manager/go.mod b/feature/s3/manager/go.mod index 896dffba809..70b1da604e5 100644 --- a/feature/s3/manager/go.mod +++ b/feature/s3/manager/go.mod @@ -18,6 +18,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../service/internal/accept-encoding/ diff --git a/internal/protocoltest/awsrestjson/api_client.go b/internal/protocoltest/awsrestjson/api_client.go index f0fe5258307..753f5f3ea0d 100644 --- a/internal/protocoltest/awsrestjson/api_client.go +++ b/internal/protocoltest/awsrestjson/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/internal/protocoltest/awsrestjson/endpoints.go b/internal/protocoltest/awsrestjson/endpoints.go index d2c3297c776..f8ccf073520 100644 --- a/internal/protocoltest/awsrestjson/endpoints.go +++ b/internal/protocoltest/awsrestjson/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/awsrestjson/generated.json b/internal/protocoltest/awsrestjson/generated.json index adbf3595cbd..72e8aa11c26 100644 --- a/internal/protocoltest/awsrestjson/generated.json +++ b/internal/protocoltest/awsrestjson/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/awsrestjson/go.mod b/internal/protocoltest/awsrestjson/go.mod index f667057b59b..01e16f47184 100644 --- a/internal/protocoltest/awsrestjson/go.mod +++ b/internal/protocoltest/awsrestjson/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go b/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go index 957e7a6b44d..aeab3b2cb15 100644 --- a/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go +++ b/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Rest Json Protocol endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restjson.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restjson.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restjson.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/ec2query/api_client.go b/internal/protocoltest/ec2query/api_client.go index 02af5dc7055..6160cbdd646 100644 --- a/internal/protocoltest/ec2query/api_client.go +++ b/internal/protocoltest/ec2query/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/internal/protocoltest/ec2query/endpoints.go b/internal/protocoltest/ec2query/endpoints.go index 447ffdeb812..bc7e1c29e9a 100644 --- a/internal/protocoltest/ec2query/endpoints.go +++ b/internal/protocoltest/ec2query/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/ec2query/generated.json b/internal/protocoltest/ec2query/generated.json index 31e2f50517a..e7251475826 100644 --- a/internal/protocoltest/ec2query/generated.json +++ b/internal/protocoltest/ec2query/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/ec2query/go.mod b/internal/protocoltest/ec2query/go.mod index 496142fd4af..e447994af56 100644 --- a/internal/protocoltest/ec2query/go.mod +++ b/internal/protocoltest/ec2query/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/ec2query/internal/endpoints/endpoints.go b/internal/protocoltest/ec2query/internal/endpoints/endpoints.go index fd1298187c6..0789b7b35af 100644 --- a/internal/protocoltest/ec2query/internal/endpoints/endpoints.go +++ b/internal/protocoltest/ec2query/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EC2 Protocol endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsec2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsec2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsec2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/jsonrpc/api_client.go b/internal/protocoltest/jsonrpc/api_client.go index 01a960acf8a..19a2d5ebc27 100644 --- a/internal/protocoltest/jsonrpc/api_client.go +++ b/internal/protocoltest/jsonrpc/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/internal/protocoltest/jsonrpc/endpoints.go b/internal/protocoltest/jsonrpc/endpoints.go index a681a544032..f10dd122564 100644 --- a/internal/protocoltest/jsonrpc/endpoints.go +++ b/internal/protocoltest/jsonrpc/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/jsonrpc/generated.json b/internal/protocoltest/jsonrpc/generated.json index 7f0b43a6249..cd595a5eeb7 100644 --- a/internal/protocoltest/jsonrpc/generated.json +++ b/internal/protocoltest/jsonrpc/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/jsonrpc/go.mod b/internal/protocoltest/jsonrpc/go.mod index b10d6973b72..cbb71a5398b 100644 --- a/internal/protocoltest/jsonrpc/go.mod +++ b/internal/protocoltest/jsonrpc/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go index 99e00b4aed7..d7af1f6ca38 100644 --- a/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go +++ b/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Json Protocol endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonprotocol.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonprotocol.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonprotocol.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/jsonrpc10/api_client.go b/internal/protocoltest/jsonrpc10/api_client.go index 1c19346210f..e29e371cd2e 100644 --- a/internal/protocoltest/jsonrpc10/api_client.go +++ b/internal/protocoltest/jsonrpc10/api_client.go @@ -8,6 +8,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -159,6 +160,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -202,6 +204,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/internal/protocoltest/jsonrpc10/endpoints.go b/internal/protocoltest/jsonrpc10/endpoints.go index 13f9c42ff86..e8dda385577 100644 --- a/internal/protocoltest/jsonrpc10/endpoints.go +++ b/internal/protocoltest/jsonrpc10/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/jsonrpc10/generated.json b/internal/protocoltest/jsonrpc10/generated.json index 51bb72d6008..f1955c71d7b 100644 --- a/internal/protocoltest/jsonrpc10/generated.json +++ b/internal/protocoltest/jsonrpc10/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/jsonrpc10/go.mod b/internal/protocoltest/jsonrpc10/go.mod index 764c24a00f1..17bb36b6521 100644 --- a/internal/protocoltest/jsonrpc10/go.mod +++ b/internal/protocoltest/jsonrpc10/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go index 1b325caf10a..e7e133910e9 100644 --- a/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go +++ b/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver JSON RPC 10 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonrpc10.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonrpc10.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "jsonrpc10.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/query/api_client.go b/internal/protocoltest/query/api_client.go index e3f969b23cc..3570c7f7af3 100644 --- a/internal/protocoltest/query/api_client.go +++ b/internal/protocoltest/query/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/internal/protocoltest/query/api_op_GreetingWithErrors_test.go b/internal/protocoltest/query/api_op_GreetingWithErrors_test.go index a653a80725f..02134f96f72 100644 --- a/internal/protocoltest/query/api_op_GreetingWithErrors_test.go +++ b/internal/protocoltest/query/api_op_GreetingWithErrors_test.go @@ -207,7 +207,6 @@ func TestClient_GreetingWithErrors_InvalidGreeting_awsAwsqueryDeserialize(t *tes } func TestClient_GreetingWithErrors_CustomCodeError_awsAwsqueryDeserialize(t *testing.T) { - t.Skip("skipping for release-2021-05-20") cases := map[string]struct { StatusCode int Header http.Header diff --git a/internal/protocoltest/query/endpoints.go b/internal/protocoltest/query/endpoints.go index b9c2d645db8..6916f6ee82e 100644 --- a/internal/protocoltest/query/endpoints.go +++ b/internal/protocoltest/query/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/query/generated.json b/internal/protocoltest/query/generated.json index ae81eb67b1d..f4ca332d1f3 100644 --- a/internal/protocoltest/query/generated.json +++ b/internal/protocoltest/query/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/query/go.mod b/internal/protocoltest/query/go.mod index 13135976a9a..ae30b9c33c2 100644 --- a/internal/protocoltest/query/go.mod +++ b/internal/protocoltest/query/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/query/internal/endpoints/endpoints.go b/internal/protocoltest/query/internal/endpoints/endpoints.go index a49ff1e248f..26542682a8d 100644 --- a/internal/protocoltest/query/internal/endpoints/endpoints.go +++ b/internal/protocoltest/query/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Query Protocol endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsquery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsquery.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "awsquery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/restxml/api_client.go b/internal/protocoltest/restxml/api_client.go index e148652dda9..3a7a8b263cb 100644 --- a/internal/protocoltest/restxml/api_client.go +++ b/internal/protocoltest/restxml/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/internal/protocoltest/restxml/endpoints.go b/internal/protocoltest/restxml/endpoints.go index 6084b8e6f25..5c86ce7998e 100644 --- a/internal/protocoltest/restxml/endpoints.go +++ b/internal/protocoltest/restxml/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/restxml/generated.json b/internal/protocoltest/restxml/generated.json index 185c57825c6..0f0ad2fb62d 100644 --- a/internal/protocoltest/restxml/generated.json +++ b/internal/protocoltest/restxml/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/restxml/go.mod b/internal/protocoltest/restxml/go.mod index 01e860f9f2f..5099dc0af82 100644 --- a/internal/protocoltest/restxml/go.mod +++ b/internal/protocoltest/restxml/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/restxml/internal/endpoints/endpoints.go b/internal/protocoltest/restxml/internal/endpoints/endpoints.go index 46d9ed631bc..0bfa66e0976 100644 --- a/internal/protocoltest/restxml/internal/endpoints/endpoints.go +++ b/internal/protocoltest/restxml/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Rest Xml Protocol endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxml.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxml.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxml.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/internal/protocoltest/restxmlwithnamespace/api_client.go b/internal/protocoltest/restxmlwithnamespace/api_client.go index d84c942a369..cdfabacb9cb 100644 --- a/internal/protocoltest/restxmlwithnamespace/api_client.go +++ b/internal/protocoltest/restxmlwithnamespace/api_client.go @@ -8,6 +8,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -159,6 +160,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -202,6 +204,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/internal/protocoltest/restxmlwithnamespace/endpoints.go b/internal/protocoltest/restxmlwithnamespace/endpoints.go index 887eeb3e4f5..5ba67e58c51 100644 --- a/internal/protocoltest/restxmlwithnamespace/endpoints.go +++ b/internal/protocoltest/restxmlwithnamespace/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/restxmlwithnamespace/generated.json b/internal/protocoltest/restxmlwithnamespace/generated.json index ae698ac61da..a5cdcbc77ca 100644 --- a/internal/protocoltest/restxmlwithnamespace/generated.json +++ b/internal/protocoltest/restxmlwithnamespace/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/restxmlwithnamespace/go.mod b/internal/protocoltest/restxmlwithnamespace/go.mod index 048398f5c0d..03a35a0209c 100644 --- a/internal/protocoltest/restxmlwithnamespace/go.mod +++ b/internal/protocoltest/restxmlwithnamespace/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go b/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go index 10a0a12d8d2..888042eb241 100644 --- a/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go +++ b/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Rest Xml Protocol Namespace endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxmlwithnamespace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxmlwithnamespace.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "restxmlwithnamespace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/accessanalyzer/api_client.go b/service/accessanalyzer/api_client.go index d618f224949..bde8fae159f 100644 --- a/service/accessanalyzer/api_client.go +++ b/service/accessanalyzer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/accessanalyzer/endpoints.go b/service/accessanalyzer/endpoints.go index 0f3ea2ad96c..f31f3027a54 100644 --- a/service/accessanalyzer/endpoints.go +++ b/service/accessanalyzer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/accessanalyzer/generated.json b/service/accessanalyzer/generated.json index 9930250adb5..913fbf07374 100644 --- a/service/accessanalyzer/generated.json +++ b/service/accessanalyzer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/accessanalyzer/go.mod b/service/accessanalyzer/go.mod index 7a225277ffd..1ed4f2189f5 100644 --- a/service/accessanalyzer/go.mod +++ b/service/accessanalyzer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/accessanalyzer/internal/endpoints/endpoints.go b/service/accessanalyzer/internal/endpoints/endpoints.go index 7ef03239c31..7ba5c68fa7b 100644 --- a/service/accessanalyzer/internal/endpoints/endpoints.go +++ b/service/accessanalyzer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AccessAnalyzer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "access-analyzer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "access-analyzer.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "access-analyzer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/acm/api_client.go b/service/acm/api_client.go index c4a110ee7a1..fb7daace0a5 100644 --- a/service/acm/api_client.go +++ b/service/acm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/acm/endpoints.go b/service/acm/endpoints.go index 4ed1e2f5cb2..9a1223bbf1e 100644 --- a/service/acm/endpoints.go +++ b/service/acm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/acm/generated.json b/service/acm/generated.json index 3d6d58d5bd4..783a7d1eaa1 100644 --- a/service/acm/generated.json +++ b/service/acm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/acm/go.mod b/service/acm/go.mod index 9144943a5b6..278a209f567 100644 --- a/service/acm/go.mod +++ b/service/acm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/acm/internal/endpoints/endpoints.go b/service/acm/internal/endpoints/endpoints.go index 669a9ee2194..b16f20a78c3 100644 --- a/service/acm/internal/endpoints/endpoints.go +++ b/service/acm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ACM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/acmpca/api_client.go b/service/acmpca/api_client.go index 96061c6ee8a..5fb7dec349b 100644 --- a/service/acmpca/api_client.go +++ b/service/acmpca/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/acmpca/endpoints.go b/service/acmpca/endpoints.go index 4afd6ea3f4f..cefd02161e8 100644 --- a/service/acmpca/endpoints.go +++ b/service/acmpca/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/acmpca/generated.json b/service/acmpca/generated.json index 87c96e4398e..6989b913886 100644 --- a/service/acmpca/generated.json +++ b/service/acmpca/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/acmpca/go.mod b/service/acmpca/go.mod index 35b4001fd30..49598d0b6bd 100644 --- a/service/acmpca/go.mod +++ b/service/acmpca/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/acmpca/internal/endpoints/endpoints.go b/service/acmpca/internal/endpoints/endpoints.go index dcc43ac15f8..d6abde29b0c 100644 --- a/service/acmpca/internal/endpoints/endpoints.go +++ b/service/acmpca/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ACM PCA endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm-pca.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -122,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm-pca.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -152,6 +184,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "acm-pca.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/alexaforbusiness/api_client.go b/service/alexaforbusiness/api_client.go index 4dce69f21f7..8571b031649 100644 --- a/service/alexaforbusiness/api_client.go +++ b/service/alexaforbusiness/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/alexaforbusiness/endpoints.go b/service/alexaforbusiness/endpoints.go index c01599219f7..e55f0a9655b 100644 --- a/service/alexaforbusiness/endpoints.go +++ b/service/alexaforbusiness/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/alexaforbusiness/generated.json b/service/alexaforbusiness/generated.json index faf886cfcd6..117b90f2303 100644 --- a/service/alexaforbusiness/generated.json +++ b/service/alexaforbusiness/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/alexaforbusiness/go.mod b/service/alexaforbusiness/go.mod index 88ffdc67c75..86ade19c423 100644 --- a/service/alexaforbusiness/go.mod +++ b/service/alexaforbusiness/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/alexaforbusiness/internal/endpoints/endpoints.go b/service/alexaforbusiness/internal/endpoints/endpoints.go index 9cacd85168b..35261e149b9 100644 --- a/service/alexaforbusiness/internal/endpoints/endpoints.go +++ b/service/alexaforbusiness/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Alexa For Business endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a4b.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a4b.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a4b.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/amp/api_client.go b/service/amp/api_client.go index c74ef92fdde..d05bcd4f406 100644 --- a/service/amp/api_client.go +++ b/service/amp/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/amp/endpoints.go b/service/amp/endpoints.go index c4ec6cc47a2..1b3f22a676b 100644 --- a/service/amp/endpoints.go +++ b/service/amp/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amp/generated.json b/service/amp/generated.json index db8abe48ee9..767ca5092f4 100644 --- a/service/amp/generated.json +++ b/service/amp/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amp/go.mod b/service/amp/go.mod index f9dae74c7da..c1fead3378d 100644 --- a/service/amp/go.mod +++ b/service/amp/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amp/internal/endpoints/endpoints.go b/service/amp/internal/endpoints/endpoints.go index 87cb690b200..559ea8ffdbe 100644 --- a/service/amp/internal/endpoints/endpoints.go +++ b/service/amp/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver amp endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,15 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "aps.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -77,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "aps.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -107,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "aps.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/amplify/api_client.go b/service/amplify/api_client.go index 918c2803463..68fa018c4d6 100644 --- a/service/amplify/api_client.go +++ b/service/amplify/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/amplify/endpoints.go b/service/amplify/endpoints.go index 564b04aecd7..e81de185673 100644 --- a/service/amplify/endpoints.go +++ b/service/amplify/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amplify/generated.json b/service/amplify/generated.json index 555eba53074..bdc286bfdbf 100644 --- a/service/amplify/generated.json +++ b/service/amplify/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amplify/go.mod b/service/amplify/go.mod index 77959a4501c..4635b36a993 100644 --- a/service/amplify/go.mod +++ b/service/amplify/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amplify/internal/endpoints/endpoints.go b/service/amplify/internal/endpoints/endpoints.go index 57a27174b2f..cedb0fdc5d9 100644 --- a/service/amplify/internal/endpoints/endpoints.go +++ b/service/amplify/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Amplify endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplify.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplify.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplify.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/amplifybackend/api_client.go b/service/amplifybackend/api_client.go index 0e576249f04..f9a84408217 100644 --- a/service/amplifybackend/api_client.go +++ b/service/amplifybackend/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/amplifybackend/endpoints.go b/service/amplifybackend/endpoints.go index 36504d6e4cc..119bd48c845 100644 --- a/service/amplifybackend/endpoints.go +++ b/service/amplifybackend/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amplifybackend/generated.json b/service/amplifybackend/generated.json index ed1568a97fd..29450f7e694 100644 --- a/service/amplifybackend/generated.json +++ b/service/amplifybackend/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amplifybackend/go.mod b/service/amplifybackend/go.mod index 6656c27ec9a..36f89ae99b5 100644 --- a/service/amplifybackend/go.mod +++ b/service/amplifybackend/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amplifybackend/internal/endpoints/endpoints.go b/service/amplifybackend/internal/endpoints/endpoints.go index e83e96e2046..cd6947538f5 100644 --- a/service/amplifybackend/internal/endpoints/endpoints.go +++ b/service/amplifybackend/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AmplifyBackend endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,8 +82,27 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplifybackend.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "ap-northeast-1": endpoints.Endpoint{}, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{}, + "ap-southeast-2": endpoints.Endpoint{}, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "eu-west-2": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + "us-east-2": endpoints.Endpoint{}, + "us-west-2": endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -70,6 +111,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplifybackend.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +146,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "amplifybackend.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/apigateway/api_client.go b/service/apigateway/api_client.go index bc5bf5861f1..fb8ffe4c8b3 100644 --- a/service/apigateway/api_client.go +++ b/service/apigateway/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" agcust "github.com/aws/aws-sdk-go-v2/service/apigateway/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/apigateway/endpoints.go b/service/apigateway/endpoints.go index 4242a22d0c7..f086ac78d1f 100644 --- a/service/apigateway/endpoints.go +++ b/service/apigateway/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigateway/generated.json b/service/apigateway/generated.json index 089e853c169..5d427b02d33 100644 --- a/service/apigateway/generated.json +++ b/service/apigateway/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigateway/go.mod b/service/apigateway/go.mod index 34745e39348..f9b7dbec6ad 100644 --- a/service/apigateway/go.mod +++ b/service/apigateway/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigateway/internal/endpoints/endpoints.go b/service/apigateway/internal/endpoints/endpoints.go index ec6be94b1b1..491055670cd 100644 --- a/service/apigateway/internal/endpoints/endpoints.go +++ b/service/apigateway/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver API Gateway endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -130,6 +162,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/apigatewaymanagementapi/api_client.go b/service/apigatewaymanagementapi/api_client.go index 40eada6d764..19318eee03a 100644 --- a/service/apigatewaymanagementapi/api_client.go +++ b/service/apigatewaymanagementapi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/apigatewaymanagementapi/endpoints.go b/service/apigatewaymanagementapi/endpoints.go index 9ffce519777..9d762da2149 100644 --- a/service/apigatewaymanagementapi/endpoints.go +++ b/service/apigatewaymanagementapi/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigatewaymanagementapi/generated.json b/service/apigatewaymanagementapi/generated.json index 2bc3136f431..f0cd230e5d1 100644 --- a/service/apigatewaymanagementapi/generated.json +++ b/service/apigatewaymanagementapi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigatewaymanagementapi/go.mod b/service/apigatewaymanagementapi/go.mod index 0ab9f67dffd..0c31afd299c 100644 --- a/service/apigatewaymanagementapi/go.mod +++ b/service/apigatewaymanagementapi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigatewaymanagementapi/internal/endpoints/endpoints.go b/service/apigatewaymanagementapi/internal/endpoints/endpoints.go index ebbb86c388e..6ec75037d9b 100644 --- a/service/apigatewaymanagementapi/internal/endpoints/endpoints.go +++ b/service/apigatewaymanagementapi/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ApiGatewayManagementApi endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,30 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "execute-api.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -92,12 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "execute-api.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - "cn-northwest-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -108,9 +114,6 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-iso-east-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso-b", @@ -129,11 +132,12 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "execute-api.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-gov-east-1": endpoints.Endpoint{}, - "us-gov-west-1": endpoints.Endpoint{}, - }, }, } diff --git a/service/apigatewayv2/api_client.go b/service/apigatewayv2/api_client.go index fed0f5f626d..bbd9b22b94b 100644 --- a/service/apigatewayv2/api_client.go +++ b/service/apigatewayv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/apigatewayv2/endpoints.go b/service/apigatewayv2/endpoints.go index a5fa9d0eaed..725fc197933 100644 --- a/service/apigatewayv2/endpoints.go +++ b/service/apigatewayv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigatewayv2/generated.json b/service/apigatewayv2/generated.json index 73b967b7586..60a1089c91a 100644 --- a/service/apigatewayv2/generated.json +++ b/service/apigatewayv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigatewayv2/go.mod b/service/apigatewayv2/go.mod index 7fca10f53ff..bd3d40a178e 100644 --- a/service/apigatewayv2/go.mod +++ b/service/apigatewayv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigatewayv2/internal/endpoints/endpoints.go b/service/apigatewayv2/internal/endpoints/endpoints.go index 25a2bead9db..ab3d8fd5611 100644 --- a/service/apigatewayv2/internal/endpoints/endpoints.go +++ b/service/apigatewayv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ApiGatewayV2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -130,6 +162,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apigateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/appconfig/api_client.go b/service/appconfig/api_client.go index 04d6ac84e7e..4ce920116e0 100644 --- a/service/appconfig/api_client.go +++ b/service/appconfig/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/appconfig/endpoints.go b/service/appconfig/endpoints.go index 888d8f2912c..189a972956b 100644 --- a/service/appconfig/endpoints.go +++ b/service/appconfig/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appconfig/generated.json b/service/appconfig/generated.json index e25e7008baf..080c38ffae0 100644 --- a/service/appconfig/generated.json +++ b/service/appconfig/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appconfig/go.mod b/service/appconfig/go.mod index 494aba903f4..205c1ff18ac 100644 --- a/service/appconfig/go.mod +++ b/service/appconfig/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appconfig/internal/endpoints/endpoints.go b/service/appconfig/internal/endpoints/endpoints.go index 7610b669504..8f23819555d 100644 --- a/service/appconfig/internal/endpoints/endpoints.go +++ b/service/appconfig/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AppConfig endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appconfig.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appconfig.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appconfig.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/appflow/api_client.go b/service/appflow/api_client.go index 2c3c6e58626..154590680dd 100644 --- a/service/appflow/api_client.go +++ b/service/appflow/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/appflow/endpoints.go b/service/appflow/endpoints.go index 45ea7fc2235..0b548cc9d54 100644 --- a/service/appflow/endpoints.go +++ b/service/appflow/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appflow/generated.json b/service/appflow/generated.json index 055cd0c1c13..adcd5d6022c 100644 --- a/service/appflow/generated.json +++ b/service/appflow/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appflow/go.mod b/service/appflow/go.mod index 76438259646..bd5dabff5bf 100644 --- a/service/appflow/go.mod +++ b/service/appflow/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appflow/internal/endpoints/endpoints.go b/service/appflow/internal/endpoints/endpoints.go index 9746f944518..e2586b69d6e 100644 --- a/service/appflow/internal/endpoints/endpoints.go +++ b/service/appflow/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Appflow endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appflow.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/appintegrations/api_client.go b/service/appintegrations/api_client.go index 0e681371e1b..3a34694905b 100644 --- a/service/appintegrations/api_client.go +++ b/service/appintegrations/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/appintegrations/endpoints.go b/service/appintegrations/endpoints.go index 426bb29e601..45325d9fd66 100644 --- a/service/appintegrations/endpoints.go +++ b/service/appintegrations/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appintegrations/generated.json b/service/appintegrations/generated.json index c95cb6ada84..51ac76eee5f 100644 --- a/service/appintegrations/generated.json +++ b/service/appintegrations/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appintegrations/go.mod b/service/appintegrations/go.mod index 0269e82b2b4..a47869b949a 100644 --- a/service/appintegrations/go.mod +++ b/service/appintegrations/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appintegrations/internal/endpoints/endpoints.go b/service/appintegrations/internal/endpoints/endpoints.go index 2ad7b1259b5..9eb777ac6f3 100644 --- a/service/appintegrations/internal/endpoints/endpoints.go +++ b/service/appintegrations/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AppIntegrations endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "app-integrations.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -80,6 +107,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "app-integrations.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "app-integrations.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/applicationautoscaling/api_client.go b/service/applicationautoscaling/api_client.go index cbb64ecc035..43d52db52d7 100644 --- a/service/applicationautoscaling/api_client.go +++ b/service/applicationautoscaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/applicationautoscaling/endpoints.go b/service/applicationautoscaling/endpoints.go index 089dfa0c95b..a564c2e3842 100644 --- a/service/applicationautoscaling/endpoints.go +++ b/service/applicationautoscaling/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationautoscaling/generated.json b/service/applicationautoscaling/generated.json index 19b471cac16..a648466d7a1 100644 --- a/service/applicationautoscaling/generated.json +++ b/service/applicationautoscaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationautoscaling/go.mod b/service/applicationautoscaling/go.mod index 604e8ff4031..d0444dec17c 100644 --- a/service/applicationautoscaling/go.mod +++ b/service/applicationautoscaling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationautoscaling/internal/endpoints/endpoints.go b/service/applicationautoscaling/internal/endpoints/endpoints.go index 4e0b190e6c0..b4322173a17 100644 --- a/service/applicationautoscaling/internal/endpoints/endpoints.go +++ b/service/applicationautoscaling/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Application Auto Scaling endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-autoscaling.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-autoscaling.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -133,6 +165,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-autoscaling.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/applicationcostprofiler/api_client.go b/service/applicationcostprofiler/api_client.go index c06f3c456c9..efd52f51309 100644 --- a/service/applicationcostprofiler/api_client.go +++ b/service/applicationcostprofiler/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/applicationcostprofiler/endpoints.go b/service/applicationcostprofiler/endpoints.go index 4fa3ef1b179..6bbcc05067a 100644 --- a/service/applicationcostprofiler/endpoints.go +++ b/service/applicationcostprofiler/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationcostprofiler/generated.json b/service/applicationcostprofiler/generated.json index 5748057b76e..a6e49df4f43 100644 --- a/service/applicationcostprofiler/generated.json +++ b/service/applicationcostprofiler/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationcostprofiler/go.mod b/service/applicationcostprofiler/go.mod index 1ccf2e76064..1ce9ddd5039 100644 --- a/service/applicationcostprofiler/go.mod +++ b/service/applicationcostprofiler/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationcostprofiler/internal/endpoints/endpoints.go b/service/applicationcostprofiler/internal/endpoints/endpoints.go index 2d07e7d5e15..2db6f8aa888 100644 --- a/service/applicationcostprofiler/internal/endpoints/endpoints.go +++ b/service/applicationcostprofiler/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ApplicationCostProfiler endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-cost-profiler.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-cost-profiler.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "application-cost-profiler.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/applicationdiscoveryservice/api_client.go b/service/applicationdiscoveryservice/api_client.go index 790057b8073..9bf1a838434 100644 --- a/service/applicationdiscoveryservice/api_client.go +++ b/service/applicationdiscoveryservice/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/applicationdiscoveryservice/endpoints.go b/service/applicationdiscoveryservice/endpoints.go index 6d513ca650b..244dcb3b83c 100644 --- a/service/applicationdiscoveryservice/endpoints.go +++ b/service/applicationdiscoveryservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationdiscoveryservice/generated.json b/service/applicationdiscoveryservice/generated.json index 3888c983989..06ad6bf4e63 100644 --- a/service/applicationdiscoveryservice/generated.json +++ b/service/applicationdiscoveryservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationdiscoveryservice/go.mod b/service/applicationdiscoveryservice/go.mod index e75f348fbdf..fe2d4f70aa7 100644 --- a/service/applicationdiscoveryservice/go.mod +++ b/service/applicationdiscoveryservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationdiscoveryservice/internal/endpoints/endpoints.go b/service/applicationdiscoveryservice/internal/endpoints/endpoints.go index 6da013b04a6..d86d105be7f 100644 --- a/service/applicationdiscoveryservice/internal/endpoints/endpoints.go +++ b/service/applicationdiscoveryservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Application Discovery Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "discovery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "discovery.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "discovery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/applicationinsights/api_client.go b/service/applicationinsights/api_client.go index 55992a08b7b..454e91330c2 100644 --- a/service/applicationinsights/api_client.go +++ b/service/applicationinsights/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/applicationinsights/endpoints.go b/service/applicationinsights/endpoints.go index 261adb88c46..73889ed2a32 100644 --- a/service/applicationinsights/endpoints.go +++ b/service/applicationinsights/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationinsights/generated.json b/service/applicationinsights/generated.json index fd66d09ac48..b9abb770bf4 100644 --- a/service/applicationinsights/generated.json +++ b/service/applicationinsights/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationinsights/go.mod b/service/applicationinsights/go.mod index d66e3e3f43b..4bc04fae0f5 100644 --- a/service/applicationinsights/go.mod +++ b/service/applicationinsights/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationinsights/internal/endpoints/endpoints.go b/service/applicationinsights/internal/endpoints/endpoints.go index e0b2f7bce8d..274b735fd72 100644 --- a/service/applicationinsights/internal/endpoints/endpoints.go +++ b/service/applicationinsights/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Application Insights endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,30 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "applicationinsights.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -92,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "applicationinsights.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -122,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "applicationinsights.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/appmesh/api_client.go b/service/appmesh/api_client.go index 6f9c79eb219..68444b2f805 100644 --- a/service/appmesh/api_client.go +++ b/service/appmesh/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/appmesh/endpoints.go b/service/appmesh/endpoints.go index e7161178e8c..a83fdbd2daf 100644 --- a/service/appmesh/endpoints.go +++ b/service/appmesh/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appmesh/generated.json b/service/appmesh/generated.json index 50e5c8918a1..baabacca5c1 100644 --- a/service/appmesh/generated.json +++ b/service/appmesh/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appmesh/go.mod b/service/appmesh/go.mod index f18f06016ab..0419075586b 100644 --- a/service/appmesh/go.mod +++ b/service/appmesh/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appmesh/internal/endpoints/endpoints.go b/service/appmesh/internal/endpoints/endpoints.go index 93ee60c76fb..03ec7a92e96 100644 --- a/service/appmesh/internal/endpoints/endpoints.go +++ b/service/appmesh/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver App Mesh endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appmesh.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -92,6 +119,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appmesh.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -122,6 +154,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appmesh.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/apprunner/api_client.go b/service/apprunner/api_client.go index 79b9e027f65..7cdfcf8dc78 100644 --- a/service/apprunner/api_client.go +++ b/service/apprunner/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/apprunner/endpoints.go b/service/apprunner/endpoints.go index 6d1ec024ec3..be915899551 100644 --- a/service/apprunner/endpoints.go +++ b/service/apprunner/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apprunner/generated.json b/service/apprunner/generated.json index 8444a344c49..ea9bd51368d 100644 --- a/service/apprunner/generated.json +++ b/service/apprunner/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apprunner/go.mod b/service/apprunner/go.mod index 46c49d49b28..ad51b30c75a 100644 --- a/service/apprunner/go.mod +++ b/service/apprunner/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apprunner/internal/endpoints/endpoints.go b/service/apprunner/internal/endpoints/endpoints.go index 79fd9da5930..01df83f9001 100644 --- a/service/apprunner/internal/endpoints/endpoints.go +++ b/service/apprunner/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AppRunner endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apprunner.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apprunner.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "apprunner.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/appstream/api_client.go b/service/appstream/api_client.go index 35e0e434ebd..563ce817970 100644 --- a/service/appstream/api_client.go +++ b/service/appstream/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/appstream/endpoints.go b/service/appstream/endpoints.go index 49c2d119b24..10ef67b087d 100644 --- a/service/appstream/endpoints.go +++ b/service/appstream/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appstream/generated.json b/service/appstream/generated.json index a0a010d57b3..dde3a34c10c 100644 --- a/service/appstream/generated.json +++ b/service/appstream/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/appstream/go.mod b/service/appstream/go.mod index 65b602c6c06..2c06796efe8 100644 --- a/service/appstream/go.mod +++ b/service/appstream/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appstream/internal/endpoints/endpoints.go b/service/appstream/internal/endpoints/endpoints.go index af0172f9102..f11eb93ba86 100644 --- a/service/appstream/internal/endpoints/endpoints.go +++ b/service/appstream/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AppStream endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "appstream", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appstream2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -90,6 +117,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appstream2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -123,6 +155,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "appstream", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appstream2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/appsync/api_client.go b/service/appsync/api_client.go index b75fdf510e0..6c29090ce61 100644 --- a/service/appsync/api_client.go +++ b/service/appsync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/appsync/endpoints.go b/service/appsync/endpoints.go index 67e2b4c691e..7d05c483d65 100644 --- a/service/appsync/endpoints.go +++ b/service/appsync/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appsync/generated.json b/service/appsync/generated.json index 7e1504bdb71..64bd6c13097 100644 --- a/service/appsync/generated.json +++ b/service/appsync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appsync/go.mod b/service/appsync/go.mod index 03efe71bc7f..afa49680e94 100644 --- a/service/appsync/go.mod +++ b/service/appsync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appsync/internal/endpoints/endpoints.go b/service/appsync/internal/endpoints/endpoints.go index 5096c541776..97009859779 100644 --- a/service/appsync/internal/endpoints/endpoints.go +++ b/service/appsync/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AppSync endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appsync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -91,6 +118,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appsync.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -125,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "appsync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/athena/api_client.go b/service/athena/api_client.go index cddd6a7edd5..51731fa4ba7 100644 --- a/service/athena/api_client.go +++ b/service/athena/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/athena/endpoints.go b/service/athena/endpoints.go index 2e52b449c4b..357af57e573 100644 --- a/service/athena/endpoints.go +++ b/service/athena/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/athena/generated.json b/service/athena/generated.json index d2ac1848565..423b75a8d83 100644 --- a/service/athena/generated.json +++ b/service/athena/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/athena/go.mod b/service/athena/go.mod index e0c4d69ddb9..87776f84302 100644 --- a/service/athena/go.mod +++ b/service/athena/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/athena/internal/endpoints/endpoints.go b/service/athena/internal/endpoints/endpoints.go index e80044ca747..7a6f0237161 100644 --- a/service/athena/internal/endpoints/endpoints.go +++ b/service/athena/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Athena endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "athena.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "athena.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -150,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "athena.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/auditmanager/api_client.go b/service/auditmanager/api_client.go index 38fd9954df5..3196f51cb95 100644 --- a/service/auditmanager/api_client.go +++ b/service/auditmanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/auditmanager/endpoints.go b/service/auditmanager/endpoints.go index 3b5616c33be..40876218b09 100644 --- a/service/auditmanager/endpoints.go +++ b/service/auditmanager/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/auditmanager/generated.json b/service/auditmanager/generated.json index 508c8f6ff16..82362c5076c 100644 --- a/service/auditmanager/generated.json +++ b/service/auditmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/auditmanager/go.mod b/service/auditmanager/go.mod index d87c59000ac..bc5262c2d90 100644 --- a/service/auditmanager/go.mod +++ b/service/auditmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/auditmanager/internal/endpoints/endpoints.go b/service/auditmanager/internal/endpoints/endpoints.go index 765d7686205..f903b92a5f7 100644 --- a/service/auditmanager/internal/endpoints/endpoints.go +++ b/service/auditmanager/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver AuditManager endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,20 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "auditmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -82,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "auditmanager.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "auditmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/autoscaling/api_client.go b/service/autoscaling/api_client.go index 1515160d254..e1c3328c5ba 100644 --- a/service/autoscaling/api_client.go +++ b/service/autoscaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/autoscaling/endpoints.go b/service/autoscaling/endpoints.go index ac12f425451..43409d0e272 100644 --- a/service/autoscaling/endpoints.go +++ b/service/autoscaling/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/autoscaling/generated.json b/service/autoscaling/generated.json index 99e692d4e87..76c17c7cce0 100644 --- a/service/autoscaling/generated.json +++ b/service/autoscaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/autoscaling/go.mod b/service/autoscaling/go.mod index efb2a039831..6665fc1cc6d 100644 --- a/service/autoscaling/go.mod +++ b/service/autoscaling/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/autoscaling/internal/endpoints/endpoints.go b/service/autoscaling/internal/endpoints/endpoints.go index f76d1bb2ab7..dc6a76ee5f0 100644 --- a/service/autoscaling/internal/endpoints/endpoints.go +++ b/service/autoscaling/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Auto Scaling endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -135,6 +167,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/autoscalingplans/api_client.go b/service/autoscalingplans/api_client.go index 8d97c4fbdbb..defe3691bc1 100644 --- a/service/autoscalingplans/api_client.go +++ b/service/autoscalingplans/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/autoscalingplans/endpoints.go b/service/autoscalingplans/endpoints.go index a8d6c5ea018..89906cdae86 100644 --- a/service/autoscalingplans/endpoints.go +++ b/service/autoscalingplans/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/autoscalingplans/generated.json b/service/autoscalingplans/generated.json index f1cde7f23ef..9fcb1f8ff1d 100644 --- a/service/autoscalingplans/generated.json +++ b/service/autoscalingplans/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/autoscalingplans/go.mod b/service/autoscalingplans/go.mod index d69fd567495..89907e54e40 100644 --- a/service/autoscalingplans/go.mod +++ b/service/autoscalingplans/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/autoscalingplans/internal/endpoints/endpoints.go b/service/autoscalingplans/internal/endpoints/endpoints.go index b05ee1f7b08..7dad8d29130 100644 --- a/service/autoscalingplans/internal/endpoints/endpoints.go +++ b/service/autoscalingplans/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Auto Scaling Plans endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling-plans.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -92,6 +119,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling-plans.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -126,6 +158,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "autoscaling-plans.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/backup/api_client.go b/service/backup/api_client.go index d4cd9c51c97..9a2f769a841 100644 --- a/service/backup/api_client.go +++ b/service/backup/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/backup/endpoints.go b/service/backup/endpoints.go index fa901f2cb08..67fa953c941 100644 --- a/service/backup/endpoints.go +++ b/service/backup/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/backup/generated.json b/service/backup/generated.json index 6b8eba961c2..ae26bb98572 100644 --- a/service/backup/generated.json +++ b/service/backup/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/backup/go.mod b/service/backup/go.mod index 6bab2049a4d..26cc18e8fc4 100644 --- a/service/backup/go.mod +++ b/service/backup/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/backup/internal/endpoints/endpoints.go b/service/backup/internal/endpoints/endpoints.go index 088393e1b3a..22afe2727e2 100644 --- a/service/backup/internal/endpoints/endpoints.go +++ b/service/backup/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Backup endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "backup.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "backup.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -127,6 +159,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "backup.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/batch/api_client.go b/service/batch/api_client.go index d802b524d25..876903c46b8 100644 --- a/service/batch/api_client.go +++ b/service/batch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/batch/endpoints.go b/service/batch/endpoints.go index 93d2f7c2ae5..57c3333c706 100644 --- a/service/batch/endpoints.go +++ b/service/batch/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/batch/generated.json b/service/batch/generated.json index f006b094c3f..e02bbc2c9f8 100644 --- a/service/batch/generated.json +++ b/service/batch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/batch/go.mod b/service/batch/go.mod index 9b76a4cdb98..baddf9dbe18 100644 --- a/service/batch/go.mod +++ b/service/batch/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/batch/internal/endpoints/endpoints.go b/service/batch/internal/endpoints/endpoints.go index e71d6732060..7b66b400934 100644 --- a/service/batch/internal/endpoints/endpoints.go +++ b/service/batch/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Batch endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "batch.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "batch.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,9 +183,26 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "batch.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + "fips-us-gov-east-1": endpoints.Endpoint{ + Hostname: "batch.us-gov-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-east-1", + }, + }, + "fips-us-gov-west-1": endpoints.Endpoint{ + Hostname: "batch.us-gov-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-west-1", + }, + }, "us-gov-east-1": endpoints.Endpoint{}, "us-gov-west-1": endpoints.Endpoint{}, }, diff --git a/service/braket/api_client.go b/service/braket/api_client.go index bf229327790..ce585691d23 100644 --- a/service/braket/api_client.go +++ b/service/braket/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/braket/endpoints.go b/service/braket/endpoints.go index da6650932eb..2446b9152d4 100644 --- a/service/braket/endpoints.go +++ b/service/braket/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/braket/generated.json b/service/braket/generated.json index 1a04d91c4cd..c9278a26dd1 100644 --- a/service/braket/generated.json +++ b/service/braket/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/braket/go.mod b/service/braket/go.mod index 50e059b6870..e3a337d1601 100644 --- a/service/braket/go.mod +++ b/service/braket/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/braket/internal/endpoints/endpoints.go b/service/braket/internal/endpoints/endpoints.go index 59e35fe9988..71129a25cac 100644 --- a/service/braket/internal/endpoints/endpoints.go +++ b/service/braket/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Braket endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,13 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "braket.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-east-1": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -75,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "braket.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -105,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "braket.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/budgets/api_client.go b/service/budgets/api_client.go index 2ed0fe68b54..00a165f94d7 100644 --- a/service/budgets/api_client.go +++ b/service/budgets/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/budgets/endpoints.go b/service/budgets/endpoints.go index 42e345ebdee..f39eb4cdb82 100644 --- a/service/budgets/endpoints.go +++ b/service/budgets/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/budgets/generated.json b/service/budgets/generated.json index 947494004ea..4c3667d7715 100644 --- a/service/budgets/generated.json +++ b/service/budgets/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/budgets/go.mod b/service/budgets/go.mod index 7e65c7b9f63..e8037e57bdf 100644 --- a/service/budgets/go.mod +++ b/service/budgets/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/budgets/internal/endpoints/endpoints.go b/service/budgets/internal/endpoints/endpoints.go index b703951419d..83265306e9d 100644 --- a/service/budgets/internal/endpoints/endpoints.go +++ b/service/budgets/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Budgets endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "budgets.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "budgets.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -118,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "budgets.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/chime/api_client.go b/service/chime/api_client.go index 21d0bdb4939..3939a22f52f 100644 --- a/service/chime/api_client.go +++ b/service/chime/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/chime/endpoints.go b/service/chime/endpoints.go index a60d6307cb1..1694fde1384 100644 --- a/service/chime/endpoints.go +++ b/service/chime/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/chime/generated.json b/service/chime/generated.json index 9a53d952620..c14f09b6535 100644 --- a/service/chime/generated.json +++ b/service/chime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/chime/go.mod b/service/chime/go.mod index e63f4a3b8ae..83416a83e16 100644 --- a/service/chime/go.mod +++ b/service/chime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/chime/internal/endpoints/endpoints.go b/service/chime/internal/endpoints/endpoints.go index 354c011c1f3..7565408969d 100644 --- a/service/chime/internal/endpoints/endpoints.go +++ b/service/chime/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Chime endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "chime.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -80,6 +107,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "chime.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "chime.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/cloud9/api_client.go b/service/cloud9/api_client.go index a43ada96757..37237bfc88b 100644 --- a/service/cloud9/api_client.go +++ b/service/cloud9/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloud9/endpoints.go b/service/cloud9/endpoints.go index e169fdabf54..708a13b7b84 100644 --- a/service/cloud9/endpoints.go +++ b/service/cloud9/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloud9/generated.json b/service/cloud9/generated.json index eb5bc43d685..321b2a6197c 100644 --- a/service/cloud9/generated.json +++ b/service/cloud9/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloud9/go.mod b/service/cloud9/go.mod index f0e8ce7f5f8..3c41ee8e149 100644 --- a/service/cloud9/go.mod +++ b/service/cloud9/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloud9/internal/endpoints/endpoints.go b/service/cloud9/internal/endpoints/endpoints.go index d61bbbc02d8..ed692c2c3f0 100644 --- a/service/cloud9/internal/endpoints/endpoints.go +++ b/service/cloud9/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cloud9 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloud9.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -91,6 +118,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloud9.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -121,6 +153,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloud9.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/clouddirectory/api_client.go b/service/clouddirectory/api_client.go index 44757ba60ca..286b3562d15 100644 --- a/service/clouddirectory/api_client.go +++ b/service/clouddirectory/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/clouddirectory/endpoints.go b/service/clouddirectory/endpoints.go index 6ae3e451054..087e14dde7d 100644 --- a/service/clouddirectory/endpoints.go +++ b/service/clouddirectory/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/clouddirectory/generated.json b/service/clouddirectory/generated.json index 90513542c45..869bcb2d8cd 100644 --- a/service/clouddirectory/generated.json +++ b/service/clouddirectory/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/clouddirectory/go.mod b/service/clouddirectory/go.mod index 4d2a4f8737e..e58fbee94f2 100644 --- a/service/clouddirectory/go.mod +++ b/service/clouddirectory/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/clouddirectory/internal/endpoints/endpoints.go b/service/clouddirectory/internal/endpoints/endpoints.go index 4baf5b24ad9..169b3d547fc 100644 --- a/service/clouddirectory/internal/endpoints/endpoints.go +++ b/service/clouddirectory/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudDirectory endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "clouddirectory.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "clouddirectory.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "clouddirectory.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudformation/api_client.go b/service/cloudformation/api_client.go index 6414ae8522d..7e1dbf3e1d7 100644 --- a/service/cloudformation/api_client.go +++ b/service/cloudformation/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/cloudformation/endpoints.go b/service/cloudformation/endpoints.go index b56969f7dac..9d2e89f9690 100644 --- a/service/cloudformation/endpoints.go +++ b/service/cloudformation/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudformation/generated.json b/service/cloudformation/generated.json index f799af4a1b6..ab65568fe92 100644 --- a/service/cloudformation/generated.json +++ b/service/cloudformation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudformation/go.mod b/service/cloudformation/go.mod index 053de65bfa0..9e20d8ddd95 100644 --- a/service/cloudformation/go.mod +++ b/service/cloudformation/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudformation/internal/endpoints/endpoints.go b/service/cloudformation/internal/endpoints/endpoints.go index 219d3c08410..bbd763b8ea2 100644 --- a/service/cloudformation/internal/endpoints/endpoints.go +++ b/service/cloudformation/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudFormation endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudformation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudformation.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudformation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudfront/api_client.go b/service/cloudfront/api_client.go index 2fc90879bee..0068f05289d 100644 --- a/service/cloudfront/api_client.go +++ b/service/cloudfront/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudfront/endpoints.go b/service/cloudfront/endpoints.go index c74950aec05..863be776a72 100644 --- a/service/cloudfront/endpoints.go +++ b/service/cloudfront/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudfront/generated.json b/service/cloudfront/generated.json index 2566ab6e439..eac182bb4e6 100644 --- a/service/cloudfront/generated.json +++ b/service/cloudfront/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudfront/go.mod b/service/cloudfront/go.mod index ea6378c5b12..00eabe32877 100644 --- a/service/cloudfront/go.mod +++ b/service/cloudfront/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudfront/internal/endpoints/endpoints.go b/service/cloudfront/internal/endpoints/endpoints.go index 0a6cf0f0e8d..16a8ef0f996 100644 --- a/service/cloudfront/internal/endpoints/endpoints.go +++ b/service/cloudfront/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudFront endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudfront.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -80,6 +107,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudfront.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -120,6 +152,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudfront.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/cloudhsm/api_client.go b/service/cloudhsm/api_client.go index 8b863866c6e..dc50c7ae733 100644 --- a/service/cloudhsm/api_client.go +++ b/service/cloudhsm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudhsm/endpoints.go b/service/cloudhsm/endpoints.go index 255efb6f81a..87a3d55761c 100644 --- a/service/cloudhsm/endpoints.go +++ b/service/cloudhsm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudhsm/generated.json b/service/cloudhsm/generated.json index 54d8891a900..93b60fbbe64 100644 --- a/service/cloudhsm/generated.json +++ b/service/cloudhsm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudhsm/go.mod b/service/cloudhsm/go.mod index 5c29f92d661..480c3c9b185 100644 --- a/service/cloudhsm/go.mod +++ b/service/cloudhsm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudhsm/internal/endpoints/endpoints.go b/service/cloudhsm/internal/endpoints/endpoints.go index 56b90bf2cab..a55b63c98bb 100644 --- a/service/cloudhsm/internal/endpoints/endpoints.go +++ b/service/cloudhsm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudHSM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudhsmv2/api_client.go b/service/cloudhsmv2/api_client.go index 95aa12e7326..9c72baa7e58 100644 --- a/service/cloudhsmv2/api_client.go +++ b/service/cloudhsmv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudhsmv2/endpoints.go b/service/cloudhsmv2/endpoints.go index bef2f0299db..07bc6f018b2 100644 --- a/service/cloudhsmv2/endpoints.go +++ b/service/cloudhsmv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudhsmv2/generated.json b/service/cloudhsmv2/generated.json index eba18fa4c76..3dc82e31979 100644 --- a/service/cloudhsmv2/generated.json +++ b/service/cloudhsmv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudhsmv2/go.mod b/service/cloudhsmv2/go.mod index f2569ef01fb..98f996ae360 100644 --- a/service/cloudhsmv2/go.mod +++ b/service/cloudhsmv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudhsmv2/internal/endpoints/endpoints.go b/service/cloudhsmv2/internal/endpoints/endpoints.go index abc838baf65..6372afc0dd3 100644 --- a/service/cloudhsmv2/internal/endpoints/endpoints.go +++ b/service/cloudhsmv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudHSM V2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "cloudhsm", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsmv2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -95,6 +122,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsmv2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -128,6 +160,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "cloudhsm", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudhsmv2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudsearch/api_client.go b/service/cloudsearch/api_client.go index 9855f3c0957..3fea5c43bd9 100644 --- a/service/cloudsearch/api_client.go +++ b/service/cloudsearch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudsearch/endpoints.go b/service/cloudsearch/endpoints.go index 8c213099b7b..7577e257f87 100644 --- a/service/cloudsearch/endpoints.go +++ b/service/cloudsearch/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudsearch/generated.json b/service/cloudsearch/generated.json index 244ab1ded26..6b9699cd1d9 100644 --- a/service/cloudsearch/generated.json +++ b/service/cloudsearch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudsearch/go.mod b/service/cloudsearch/go.mod index 21bd9346101..a29803d51a3 100644 --- a/service/cloudsearch/go.mod +++ b/service/cloudsearch/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudsearch/internal/endpoints/endpoints.go b/service/cloudsearch/internal/endpoints/endpoints.go index db302055ec8..16f7fda22ab 100644 --- a/service/cloudsearch/internal/endpoints/endpoints.go +++ b/service/cloudsearch/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudSearch endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearch.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearch.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearch.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/cloudsearchdomain/api_client.go b/service/cloudsearchdomain/api_client.go index d1a945f4804..61a9ca039aa 100644 --- a/service/cloudsearchdomain/api_client.go +++ b/service/cloudsearchdomain/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudsearchdomain/endpoints.go b/service/cloudsearchdomain/endpoints.go index 7244ae1b0d4..c8d2df475c6 100644 --- a/service/cloudsearchdomain/endpoints.go +++ b/service/cloudsearchdomain/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudsearchdomain/generated.json b/service/cloudsearchdomain/generated.json index 6fce1eae492..2372c462dfc 100644 --- a/service/cloudsearchdomain/generated.json +++ b/service/cloudsearchdomain/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudsearchdomain/go.mod b/service/cloudsearchdomain/go.mod index 51078a48f52..6dede6274df 100644 --- a/service/cloudsearchdomain/go.mod +++ b/service/cloudsearchdomain/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudsearchdomain/internal/endpoints/endpoints.go b/service/cloudsearchdomain/internal/endpoints/endpoints.go index 9c9c4ac6eb0..cb3a1914d35 100644 --- a/service/cloudsearchdomain/internal/endpoints/endpoints.go +++ b/service/cloudsearchdomain/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudSearch Domain endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearchdomain.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearchdomain.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudsearchdomain.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/cloudtrail/api_client.go b/service/cloudtrail/api_client.go index 8e2c6cac24e..a740c5fec3f 100644 --- a/service/cloudtrail/api_client.go +++ b/service/cloudtrail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudtrail/endpoints.go b/service/cloudtrail/endpoints.go index d30dbe20c4d..9c6fb8c4fdf 100644 --- a/service/cloudtrail/endpoints.go +++ b/service/cloudtrail/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudtrail/generated.json b/service/cloudtrail/generated.json index c7bbe93e42d..219ef69fee6 100644 --- a/service/cloudtrail/generated.json +++ b/service/cloudtrail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudtrail/go.mod b/service/cloudtrail/go.mod index d4610bbec3c..8796c216c76 100644 --- a/service/cloudtrail/go.mod +++ b/service/cloudtrail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudtrail/internal/endpoints/endpoints.go b/service/cloudtrail/internal/endpoints/endpoints.go index 85c542dcd6a..8f8b30e745b 100644 --- a/service/cloudtrail/internal/endpoints/endpoints.go +++ b/service/cloudtrail/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudTrail endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,8 +82,59 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudtrail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, + "ap-northeast-1": endpoints.Endpoint{}, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{}, + "ap-southeast-2": endpoints.Endpoint{}, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "fips-us-east-1": endpoints.Endpoint{ + Hostname: "cloudtrail-fips.us-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoints.Endpoint{ + Hostname: "cloudtrail-fips.us-east-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoints.Endpoint{ + Hostname: "cloudtrail-fips.us-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoints.Endpoint{ + Hostname: "cloudtrail-fips.us-west-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-2", + }, + }, + "me-south-1": endpoints.Endpoint{}, + "sa-east-1": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + "us-east-2": endpoints.Endpoint{}, + "us-west-1": endpoints.Endpoint{}, + "us-west-2": endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -70,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudtrail.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -110,6 +188,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cloudtrail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudwatch/api_client.go b/service/cloudwatch/api_client.go index ce2b21b6716..ed2bc2cf09f 100644 --- a/service/cloudwatch/api_client.go +++ b/service/cloudwatch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudwatch/endpoints.go b/service/cloudwatch/endpoints.go index ca67010d140..2c7c5da329a 100644 --- a/service/cloudwatch/endpoints.go +++ b/service/cloudwatch/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatch/generated.json b/service/cloudwatch/generated.json index 840046217b6..ba6c409a046 100644 --- a/service/cloudwatch/generated.json +++ b/service/cloudwatch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudwatch/go.mod b/service/cloudwatch/go.mod index a81e5a66a5b..5af1f521aeb 100644 --- a/service/cloudwatch/go.mod +++ b/service/cloudwatch/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatch/internal/endpoints/endpoints.go b/service/cloudwatch/internal/endpoints/endpoints.go index 71f2a46e039..20435bdef1a 100644 --- a/service/cloudwatch/internal/endpoints/endpoints.go +++ b/service/cloudwatch/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudWatch endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "monitoring.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "monitoring.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "monitoring.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudwatchevents/api_client.go b/service/cloudwatchevents/api_client.go index a69a3b2ba91..42197619654 100644 --- a/service/cloudwatchevents/api_client.go +++ b/service/cloudwatchevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudwatchevents/endpoints.go b/service/cloudwatchevents/endpoints.go index 25a0cfd89a2..f6fec9a9a84 100644 --- a/service/cloudwatchevents/endpoints.go +++ b/service/cloudwatchevents/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatchevents/generated.json b/service/cloudwatchevents/generated.json index 60acae12cb8..da802e43705 100644 --- a/service/cloudwatchevents/generated.json +++ b/service/cloudwatchevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudwatchevents/go.mod b/service/cloudwatchevents/go.mod index d0ec6f4f459..b470b2d1556 100644 --- a/service/cloudwatchevents/go.mod +++ b/service/cloudwatchevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatchevents/internal/endpoints/endpoints.go b/service/cloudwatchevents/internal/endpoints/endpoints.go index 6ae66cfe7d9..f1e76b95a96 100644 --- a/service/cloudwatchevents/internal/endpoints/endpoints.go +++ b/service/cloudwatchevents/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudWatch Events endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cloudwatchlogs/api_client.go b/service/cloudwatchlogs/api_client.go index ad1e1037feb..7ca8ea82a73 100644 --- a/service/cloudwatchlogs/api_client.go +++ b/service/cloudwatchlogs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cloudwatchlogs/endpoints.go b/service/cloudwatchlogs/endpoints.go index c78239bf20b..94a58b69801 100644 --- a/service/cloudwatchlogs/endpoints.go +++ b/service/cloudwatchlogs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatchlogs/generated.json b/service/cloudwatchlogs/generated.json index 287ac2d99a5..e933b1ceda2 100644 --- a/service/cloudwatchlogs/generated.json +++ b/service/cloudwatchlogs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudwatchlogs/go.mod b/service/cloudwatchlogs/go.mod index ca24aaab951..339d2fc8a0a 100644 --- a/service/cloudwatchlogs/go.mod +++ b/service/cloudwatchlogs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatchlogs/internal/endpoints/endpoints.go b/service/cloudwatchlogs/internal/endpoints/endpoints.go index e5656cc5352..db3a7624c69 100644 --- a/service/cloudwatchlogs/internal/endpoints/endpoints.go +++ b/service/cloudwatchlogs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CloudWatch Logs endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "logs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "logs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "logs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/codeartifact/api_client.go b/service/codeartifact/api_client.go index bf390eb8316..c7c8d21a645 100644 --- a/service/codeartifact/api_client.go +++ b/service/codeartifact/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codeartifact/endpoints.go b/service/codeartifact/endpoints.go index d58a8b89ff0..712313df9ac 100644 --- a/service/codeartifact/endpoints.go +++ b/service/codeartifact/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codeartifact/generated.json b/service/codeartifact/generated.json index 2d82f271963..6973558b51f 100644 --- a/service/codeartifact/generated.json +++ b/service/codeartifact/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codeartifact/go.mod b/service/codeartifact/go.mod index 0ac27b1b4d9..ed3580a0ea2 100644 --- a/service/codeartifact/go.mod +++ b/service/codeartifact/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codeartifact/internal/endpoints/endpoints.go b/service/codeartifact/internal/endpoints/endpoints.go index 2b3df152f79..78cccd1eaf5 100644 --- a/service/codeartifact/internal/endpoints/endpoints.go +++ b/service/codeartifact/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver codeartifact endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeartifact.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -69,7 +96,10 @@ var defaultPartitions = endpoints.Partitions{ "ap-southeast-2": endpoints.Endpoint{}, "eu-central-1": endpoints.Endpoint{}, "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, "eu-west-1": endpoints.Endpoint{}, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, "us-east-1": endpoints.Endpoint{}, "us-east-2": endpoints.Endpoint{}, "us-west-2": endpoints.Endpoint{}, @@ -82,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeartifact.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeartifact.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/codebuild/api_client.go b/service/codebuild/api_client.go index 8f8a2b79e64..e808c2fe282 100644 --- a/service/codebuild/api_client.go +++ b/service/codebuild/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codebuild/endpoints.go b/service/codebuild/endpoints.go index 1226eabbe8f..4d695ad1b80 100644 --- a/service/codebuild/endpoints.go +++ b/service/codebuild/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codebuild/generated.json b/service/codebuild/generated.json index 7460301b047..c2aadebc6e4 100644 --- a/service/codebuild/generated.json +++ b/service/codebuild/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codebuild/go.mod b/service/codebuild/go.mod index 1e28ba2a289..aee2798c5b6 100644 --- a/service/codebuild/go.mod +++ b/service/codebuild/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codebuild/internal/endpoints/endpoints.go b/service/codebuild/internal/endpoints/endpoints.go index 97c1dab3f07..2660c3b4eae 100644 --- a/service/codebuild/internal/endpoints/endpoints.go +++ b/service/codebuild/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeBuild endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codebuild.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codebuild.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -150,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codebuild.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/codecommit/api_client.go b/service/codecommit/api_client.go index cb212cb08ef..0b43d7095d2 100644 --- a/service/codecommit/api_client.go +++ b/service/codecommit/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/codecommit/endpoints.go b/service/codecommit/endpoints.go index 84cf579f930..947bbc29986 100644 --- a/service/codecommit/endpoints.go +++ b/service/codecommit/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codecommit/generated.json b/service/codecommit/generated.json index f3e87f0ea5c..f1afa114fa6 100644 --- a/service/codecommit/generated.json +++ b/service/codecommit/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codecommit/go.mod b/service/codecommit/go.mod index d2c70634add..b19efaddbad 100644 --- a/service/codecommit/go.mod +++ b/service/codecommit/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codecommit/internal/endpoints/endpoints.go b/service/codecommit/internal/endpoints/endpoints.go index 934fdb3c7f6..7059cd3b084 100644 --- a/service/codecommit/internal/endpoints/endpoints.go +++ b/service/codecommit/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeCommit endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,12 +82,18 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codecommit.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -97,6 +125,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codecommit.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -131,6 +164,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codecommit.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/codedeploy/api_client.go b/service/codedeploy/api_client.go index 3c6a437c378..ddf6bcebb29 100644 --- a/service/codedeploy/api_client.go +++ b/service/codedeploy/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codedeploy/endpoints.go b/service/codedeploy/endpoints.go index 467d90fbfd0..e79962a3e9f 100644 --- a/service/codedeploy/endpoints.go +++ b/service/codedeploy/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codedeploy/generated.json b/service/codedeploy/generated.json index 7408f67ad46..1674f7146a4 100644 --- a/service/codedeploy/generated.json +++ b/service/codedeploy/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/codedeploy/go.mod b/service/codedeploy/go.mod index b12016d8dc3..146a2628f72 100644 --- a/service/codedeploy/go.mod +++ b/service/codedeploy/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codedeploy/internal/endpoints/endpoints.go b/service/codedeploy/internal/endpoints/endpoints.go index 5a9237a04da..ed70c91a887 100644 --- a/service/codedeploy/internal/endpoints/endpoints.go +++ b/service/codedeploy/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeDeploy endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codedeploy.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codedeploy.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codedeploy.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/codeguruprofiler/api_client.go b/service/codeguruprofiler/api_client.go index 3bb97775975..836e62f01d7 100644 --- a/service/codeguruprofiler/api_client.go +++ b/service/codeguruprofiler/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codeguruprofiler/endpoints.go b/service/codeguruprofiler/endpoints.go index 94902cc440f..4e54c01cf98 100644 --- a/service/codeguruprofiler/endpoints.go +++ b/service/codeguruprofiler/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codeguruprofiler/generated.json b/service/codeguruprofiler/generated.json index 5bc52f1cb8d..328da329492 100644 --- a/service/codeguruprofiler/generated.json +++ b/service/codeguruprofiler/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codeguruprofiler/go.mod b/service/codeguruprofiler/go.mod index fd5824df8b0..de103990e4a 100644 --- a/service/codeguruprofiler/go.mod +++ b/service/codeguruprofiler/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codeguruprofiler/internal/endpoints/endpoints.go b/service/codeguruprofiler/internal/endpoints/endpoints.go index e16158b8bba..959b3e4151d 100644 --- a/service/codeguruprofiler/internal/endpoints/endpoints.go +++ b/service/codeguruprofiler/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeGuruProfiler endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,20 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-profiler.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -82,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-profiler.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-profiler.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/codegurureviewer/api_client.go b/service/codegurureviewer/api_client.go index a9171f5c9ce..3a67d958ce4 100644 --- a/service/codegurureviewer/api_client.go +++ b/service/codegurureviewer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/codegurureviewer/endpoints.go b/service/codegurureviewer/endpoints.go index 6d5e2d9f739..be0d0372681 100644 --- a/service/codegurureviewer/endpoints.go +++ b/service/codegurureviewer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codegurureviewer/generated.json b/service/codegurureviewer/generated.json index 1b22f1ed3fb..faec0ef5b1e 100644 --- a/service/codegurureviewer/generated.json +++ b/service/codegurureviewer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codegurureviewer/go.mod b/service/codegurureviewer/go.mod index 6fc209e31a2..498cc017fd2 100644 --- a/service/codegurureviewer/go.mod +++ b/service/codegurureviewer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codegurureviewer/internal/endpoints/endpoints.go b/service/codegurureviewer/internal/endpoints/endpoints.go index 015d20f2c5b..ea37fc49283 100644 --- a/service/codegurureviewer/internal/endpoints/endpoints.go +++ b/service/codegurureviewer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeGuru Reviewer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-reviewer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-reviewer.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codeguru-reviewer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/codepipeline/api_client.go b/service/codepipeline/api_client.go index 078d60ca3b5..642b9261836 100644 --- a/service/codepipeline/api_client.go +++ b/service/codepipeline/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/codepipeline/endpoints.go b/service/codepipeline/endpoints.go index d89121b58dc..2a4cc5b6398 100644 --- a/service/codepipeline/endpoints.go +++ b/service/codepipeline/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codepipeline/generated.json b/service/codepipeline/generated.json index 0d3578f9f25..fa43cf7f01f 100644 --- a/service/codepipeline/generated.json +++ b/service/codepipeline/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codepipeline/go.mod b/service/codepipeline/go.mod index 3b19fb08a3f..f689aa67b6a 100644 --- a/service/codepipeline/go.mod +++ b/service/codepipeline/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codepipeline/internal/endpoints/endpoints.go b/service/codepipeline/internal/endpoints/endpoints.go index ac052a6cc69..328abf91421 100644 --- a/service/codepipeline/internal/endpoints/endpoints.go +++ b/service/codepipeline/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodePipeline endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codepipeline.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -120,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codepipeline.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -150,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codepipeline.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/codestar/api_client.go b/service/codestar/api_client.go index 661cba4a622..f366da3d1ce 100644 --- a/service/codestar/api_client.go +++ b/service/codestar/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codestar/endpoints.go b/service/codestar/endpoints.go index 0c43ad4bf4b..1237cd9ed40 100644 --- a/service/codestar/endpoints.go +++ b/service/codestar/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestar/generated.json b/service/codestar/generated.json index afc939df783..fb90e8ac9de 100644 --- a/service/codestar/generated.json +++ b/service/codestar/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestar/go.mod b/service/codestar/go.mod index 2478f4dbd96..49e523b6b63 100644 --- a/service/codestar/go.mod +++ b/service/codestar/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestar/internal/endpoints/endpoints.go b/service/codestar/internal/endpoints/endpoints.go index 6b51a45195c..49feac2b5aa 100644 --- a/service/codestar/internal/endpoints/endpoints.go +++ b/service/codestar/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeStar endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/codestarconnections/api_client.go b/service/codestarconnections/api_client.go index ae5f03bc8f9..9cb5bd25c79 100644 --- a/service/codestarconnections/api_client.go +++ b/service/codestarconnections/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/codestarconnections/endpoints.go b/service/codestarconnections/endpoints.go index 601b004d480..e0eeab14e0c 100644 --- a/service/codestarconnections/endpoints.go +++ b/service/codestarconnections/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestarconnections/generated.json b/service/codestarconnections/generated.json index 85a193bec07..bffc8fb8983 100644 --- a/service/codestarconnections/generated.json +++ b/service/codestarconnections/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestarconnections/go.mod b/service/codestarconnections/go.mod index 150258e39c5..3d9823913cf 100644 --- a/service/codestarconnections/go.mod +++ b/service/codestarconnections/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestarconnections/internal/endpoints/endpoints.go b/service/codestarconnections/internal/endpoints/endpoints.go index f335bab68cc..7a820e6f223 100644 --- a/service/codestarconnections/internal/endpoints/endpoints.go +++ b/service/codestarconnections/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver CodeStar connections endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-connections.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -88,6 +115,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-connections.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -118,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-connections.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/codestarnotifications/api_client.go b/service/codestarnotifications/api_client.go index 1b4f3aed462..b61eb60ef34 100644 --- a/service/codestarnotifications/api_client.go +++ b/service/codestarnotifications/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/codestarnotifications/endpoints.go b/service/codestarnotifications/endpoints.go index 5059817d157..96458ad1e2b 100644 --- a/service/codestarnotifications/endpoints.go +++ b/service/codestarnotifications/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestarnotifications/generated.json b/service/codestarnotifications/generated.json index 572c6f9a13a..5d0d6fba77d 100644 --- a/service/codestarnotifications/generated.json +++ b/service/codestarnotifications/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestarnotifications/go.mod b/service/codestarnotifications/go.mod index a5362d8ee40..459d3222936 100644 --- a/service/codestarnotifications/go.mod +++ b/service/codestarnotifications/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestarnotifications/internal/endpoints/endpoints.go b/service/codestarnotifications/internal/endpoints/endpoints.go index cef3e8a42f3..b2f56bb5471 100644 --- a/service/codestarnotifications/internal/endpoints/endpoints.go +++ b/service/codestarnotifications/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver codestar notifications endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,28 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-notifications.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -90,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-notifications.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -120,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "codestar-notifications.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/cognitoidentity/api_client.go b/service/cognitoidentity/api_client.go index 4ed972e8c76..46086ba626c 100644 --- a/service/cognitoidentity/api_client.go +++ b/service/cognitoidentity/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cognitoidentity/endpoints.go b/service/cognitoidentity/endpoints.go index d9e0742a172..2ca9bd73bea 100644 --- a/service/cognitoidentity/endpoints.go +++ b/service/cognitoidentity/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitoidentity/generated.json b/service/cognitoidentity/generated.json index d522158734a..f2eb0e8c913 100644 --- a/service/cognitoidentity/generated.json +++ b/service/cognitoidentity/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitoidentity/go.mod b/service/cognitoidentity/go.mod index 15b8c5c49df..c1b4dbb3d56 100644 --- a/service/cognitoidentity/go.mod +++ b/service/cognitoidentity/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitoidentity/internal/endpoints/endpoints.go b/service/cognitoidentity/internal/endpoints/endpoints.go index 44d82c07be7..96b27718817 100644 --- a/service/cognitoidentity/internal/endpoints/endpoints.go +++ b/service/cognitoidentity/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cognito Identity endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-identity.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -106,6 +133,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-identity.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -139,6 +171,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-identity.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cognitoidentityprovider/api_client.go b/service/cognitoidentityprovider/api_client.go index 3f073766b0a..2397d89eeb1 100644 --- a/service/cognitoidentityprovider/api_client.go +++ b/service/cognitoidentityprovider/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cognitoidentityprovider/endpoints.go b/service/cognitoidentityprovider/endpoints.go index ce2ad6a1890..6f6217358e8 100644 --- a/service/cognitoidentityprovider/endpoints.go +++ b/service/cognitoidentityprovider/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitoidentityprovider/generated.json b/service/cognitoidentityprovider/generated.json index 5ae34cd8976..6261460f52f 100644 --- a/service/cognitoidentityprovider/generated.json +++ b/service/cognitoidentityprovider/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitoidentityprovider/go.mod b/service/cognitoidentityprovider/go.mod index e2eea70483a..efc735d8190 100644 --- a/service/cognitoidentityprovider/go.mod +++ b/service/cognitoidentityprovider/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitoidentityprovider/internal/endpoints/endpoints.go b/service/cognitoidentityprovider/internal/endpoints/endpoints.go index 6d26e1980d3..7eb0f492bbb 100644 --- a/service/cognitoidentityprovider/internal/endpoints/endpoints.go +++ b/service/cognitoidentityprovider/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cognito Identity Provider endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-idp.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -112,6 +139,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-idp.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -142,6 +174,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-idp.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/cognitosync/api_client.go b/service/cognitosync/api_client.go index 714f38a28dd..69554efa85b 100644 --- a/service/cognitosync/api_client.go +++ b/service/cognitosync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/cognitosync/endpoints.go b/service/cognitosync/endpoints.go index 4cfbe245d4a..53c8fa27a0f 100644 --- a/service/cognitosync/endpoints.go +++ b/service/cognitosync/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitosync/generated.json b/service/cognitosync/generated.json index 69e470c50de..b23fc1af6f5 100644 --- a/service/cognitosync/generated.json +++ b/service/cognitosync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitosync/go.mod b/service/cognitosync/go.mod index 04966d453b9..ed22c49e190 100644 --- a/service/cognitosync/go.mod +++ b/service/cognitosync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitosync/internal/endpoints/endpoints.go b/service/cognitosync/internal/endpoints/endpoints.go index 66418eb2a3e..546b9089ec2 100644 --- a/service/cognitosync/internal/endpoints/endpoints.go +++ b/service/cognitosync/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cognito Sync endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -113,6 +145,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/comprehend/api_client.go b/service/comprehend/api_client.go index 564ab679775..eb71071b865 100644 --- a/service/comprehend/api_client.go +++ b/service/comprehend/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/comprehend/endpoints.go b/service/comprehend/endpoints.go index 5b5dc0960e4..1213c017a5c 100644 --- a/service/comprehend/endpoints.go +++ b/service/comprehend/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/comprehend/generated.json b/service/comprehend/generated.json index 225192b6d0f..ddc43601cf2 100644 --- a/service/comprehend/generated.json +++ b/service/comprehend/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/comprehend/go.mod b/service/comprehend/go.mod index 52689925f63..39303882464 100644 --- a/service/comprehend/go.mod +++ b/service/comprehend/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/comprehend/internal/endpoints/endpoints.go b/service/comprehend/internal/endpoints/endpoints.go index f10e610913f..619f06f97ab 100644 --- a/service/comprehend/internal/endpoints/endpoints.go +++ b/service/comprehend/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Comprehend endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehend.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -102,6 +129,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehend.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -135,6 +167,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehend.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/comprehendmedical/api_client.go b/service/comprehendmedical/api_client.go index 9ff6639ea23..d44e02dd253 100644 --- a/service/comprehendmedical/api_client.go +++ b/service/comprehendmedical/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/comprehendmedical/endpoints.go b/service/comprehendmedical/endpoints.go index 0d9460f4383..cb833a0e2ad 100644 --- a/service/comprehendmedical/endpoints.go +++ b/service/comprehendmedical/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/comprehendmedical/generated.json b/service/comprehendmedical/generated.json index 4ace1874818..a8a8825584e 100644 --- a/service/comprehendmedical/generated.json +++ b/service/comprehendmedical/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/comprehendmedical/go.mod b/service/comprehendmedical/go.mod index 51f63c2026e..c9d1b28f3a1 100644 --- a/service/comprehendmedical/go.mod +++ b/service/comprehendmedical/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/comprehendmedical/internal/endpoints/endpoints.go b/service/comprehendmedical/internal/endpoints/endpoints.go index 378c4f4c843..dcab4c7a39e 100644 --- a/service/comprehendmedical/internal/endpoints/endpoints.go +++ b/service/comprehendmedical/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ComprehendMedical endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehendmedical.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -97,6 +124,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehendmedical.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -127,6 +159,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "comprehendmedical.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/computeoptimizer/api_client.go b/service/computeoptimizer/api_client.go index 08935812fbd..e128dbd5111 100644 --- a/service/computeoptimizer/api_client.go +++ b/service/computeoptimizer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/computeoptimizer/endpoints.go b/service/computeoptimizer/endpoints.go index 75691f640bc..9cb3b48fb7d 100644 --- a/service/computeoptimizer/endpoints.go +++ b/service/computeoptimizer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/computeoptimizer/generated.json b/service/computeoptimizer/generated.json index fd6e34f6bba..46f10eef869 100644 --- a/service/computeoptimizer/generated.json +++ b/service/computeoptimizer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/computeoptimizer/go.mod b/service/computeoptimizer/go.mod index cee66794dd0..48c67b5546a 100644 --- a/service/computeoptimizer/go.mod +++ b/service/computeoptimizer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/computeoptimizer/internal/endpoints/endpoints.go b/service/computeoptimizer/internal/endpoints/endpoints.go index 27311acaeed..868972d80ce 100644 --- a/service/computeoptimizer/internal/endpoints/endpoints.go +++ b/service/computeoptimizer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Compute Optimizer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,26 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "compute-optimizer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -88,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "compute-optimizer.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -118,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "compute-optimizer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/configservice/api_client.go b/service/configservice/api_client.go index d35948391b5..18fe2a85aed 100644 --- a/service/configservice/api_client.go +++ b/service/configservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/configservice/endpoints.go b/service/configservice/endpoints.go index a06debd5429..ea0546e470f 100644 --- a/service/configservice/endpoints.go +++ b/service/configservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/configservice/generated.json b/service/configservice/generated.json index b7e23312df4..34868153eb5 100644 --- a/service/configservice/generated.json +++ b/service/configservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/configservice/go.mod b/service/configservice/go.mod index 32971f7b00e..dfbeeb6747b 100644 --- a/service/configservice/go.mod +++ b/service/configservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/configservice/internal/endpoints/endpoints.go b/service/configservice/internal/endpoints/endpoints.go index c4e1b3f1c3e..9c99a08c598 100644 --- a/service/configservice/internal/endpoints/endpoints.go +++ b/service/configservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Config Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "config.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "config.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "config.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/connect/api_client.go b/service/connect/api_client.go index 7ef0fcea3e0..e4439e8ea1c 100644 --- a/service/connect/api_client.go +++ b/service/connect/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/connect/endpoints.go b/service/connect/endpoints.go index 15c6ef350e7..fc05f095013 100644 --- a/service/connect/endpoints.go +++ b/service/connect/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connect/generated.json b/service/connect/generated.json index 35c4a411e4b..79989a4fcbf 100644 --- a/service/connect/generated.json +++ b/service/connect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connect/go.mod b/service/connect/go.mod index f086b985446..dc8f9cb64b5 100644 --- a/service/connect/go.mod +++ b/service/connect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connect/internal/endpoints/endpoints.go b/service/connect/internal/endpoints/endpoints.go index 371f57361df..8de852c76b9 100644 --- a/service/connect/internal/endpoints/endpoints.go +++ b/service/connect/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Connect endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -80,6 +107,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "connect.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/connectcontactlens/api_client.go b/service/connectcontactlens/api_client.go index 0c4b65dc83a..06217828ab8 100644 --- a/service/connectcontactlens/api_client.go +++ b/service/connectcontactlens/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/connectcontactlens/endpoints.go b/service/connectcontactlens/endpoints.go index a654bf0efa3..003349a7a7f 100644 --- a/service/connectcontactlens/endpoints.go +++ b/service/connectcontactlens/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connectcontactlens/generated.json b/service/connectcontactlens/generated.json index 135dd6d07d8..3c9fcd0bb00 100644 --- a/service/connectcontactlens/generated.json +++ b/service/connectcontactlens/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connectcontactlens/go.mod b/service/connectcontactlens/go.mod index 93a73d0c251..8db9482d7ab 100644 --- a/service/connectcontactlens/go.mod +++ b/service/connectcontactlens/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connectcontactlens/internal/endpoints/endpoints.go b/service/connectcontactlens/internal/endpoints/endpoints.go index 84f2c8f9cf8..287fffe1c44 100644 --- a/service/connectcontactlens/internal/endpoints/endpoints.go +++ b/service/connectcontactlens/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Connect Contact Lens endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,11 +82,17 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "contact-lens.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, + "ca-central-1": endpoints.Endpoint{}, "eu-central-1": endpoints.Endpoint{}, "eu-west-2": endpoints.Endpoint{}, "us-east-1": endpoints.Endpoint{}, @@ -78,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "contact-lens.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "contact-lens.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/connectparticipant/api_client.go b/service/connectparticipant/api_client.go index e314b9c5233..62e6adbdabe 100644 --- a/service/connectparticipant/api_client.go +++ b/service/connectparticipant/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/connectparticipant/endpoints.go b/service/connectparticipant/endpoints.go index ed35d3f7d38..411f43ff128 100644 --- a/service/connectparticipant/endpoints.go +++ b/service/connectparticipant/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connectparticipant/generated.json b/service/connectparticipant/generated.json index 4208f5d102e..34b2ee70e09 100644 --- a/service/connectparticipant/generated.json +++ b/service/connectparticipant/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connectparticipant/go.mod b/service/connectparticipant/go.mod index a6e41051677..74a97f68f00 100644 --- a/service/connectparticipant/go.mod +++ b/service/connectparticipant/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connectparticipant/internal/endpoints/endpoints.go b/service/connectparticipant/internal/endpoints/endpoints.go index ed9a038e8e3..53b7cc0df4c 100644 --- a/service/connectparticipant/internal/endpoints/endpoints.go +++ b/service/connectparticipant/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ConnectParticipant endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "participant.connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "participant.connect.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "participant.connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/costandusagereportservice/api_client.go b/service/costandusagereportservice/api_client.go index de25dc1ed0a..af198fa123e 100644 --- a/service/costandusagereportservice/api_client.go +++ b/service/costandusagereportservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/costandusagereportservice/endpoints.go b/service/costandusagereportservice/endpoints.go index cebf0b01465..9a08ba94108 100644 --- a/service/costandusagereportservice/endpoints.go +++ b/service/costandusagereportservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/costandusagereportservice/generated.json b/service/costandusagereportservice/generated.json index fe03c60378b..512b80bd383 100644 --- a/service/costandusagereportservice/generated.json +++ b/service/costandusagereportservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/costandusagereportservice/go.mod b/service/costandusagereportservice/go.mod index 61bc7b26542..8fa7bbfef1e 100644 --- a/service/costandusagereportservice/go.mod +++ b/service/costandusagereportservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/costandusagereportservice/internal/endpoints/endpoints.go b/service/costandusagereportservice/internal/endpoints/endpoints.go index e4e9fb51af7..58a874ce09c 100644 --- a/service/costandusagereportservice/internal/endpoints/endpoints.go +++ b/service/costandusagereportservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cost and Usage Report Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cur.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cur.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -106,6 +138,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cur.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/costexplorer/api_client.go b/service/costexplorer/api_client.go index 80a54086aef..68c5cf98324 100644 --- a/service/costexplorer/api_client.go +++ b/service/costexplorer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/costexplorer/endpoints.go b/service/costexplorer/endpoints.go index 933b77f4c63..985b38761a4 100644 --- a/service/costexplorer/endpoints.go +++ b/service/costexplorer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/costexplorer/generated.json b/service/costexplorer/generated.json index b2bd04e8ce6..6105c4cca9b 100644 --- a/service/costexplorer/generated.json +++ b/service/costexplorer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/costexplorer/go.mod b/service/costexplorer/go.mod index cfb37918675..4567a5efb30 100644 --- a/service/costexplorer/go.mod +++ b/service/costexplorer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/costexplorer/internal/endpoints/endpoints.go b/service/costexplorer/internal/endpoints/endpoints.go index 4d6bb582d1f..8c0b89651a4 100644 --- a/service/costexplorer/internal/endpoints/endpoints.go +++ b/service/costexplorer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Cost Explorer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ce.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ce.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -118,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ce.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/customerprofiles/api_client.go b/service/customerprofiles/api_client.go index 5583db2a430..5faf6eae3a7 100644 --- a/service/customerprofiles/api_client.go +++ b/service/customerprofiles/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/customerprofiles/endpoints.go b/service/customerprofiles/endpoints.go index 145b76ac8ce..b92d88bcf5e 100644 --- a/service/customerprofiles/endpoints.go +++ b/service/customerprofiles/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/customerprofiles/generated.json b/service/customerprofiles/generated.json index 93d6381c679..9ef1ac5596b 100644 --- a/service/customerprofiles/generated.json +++ b/service/customerprofiles/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/customerprofiles/go.mod b/service/customerprofiles/go.mod index 04d8473be7c..04328c3946b 100644 --- a/service/customerprofiles/go.mod +++ b/service/customerprofiles/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/customerprofiles/internal/endpoints/endpoints.go b/service/customerprofiles/internal/endpoints/endpoints.go index cf1cb364644..fe8365ed763 100644 --- a/service/customerprofiles/internal/endpoints/endpoints.go +++ b/service/customerprofiles/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Customer Profiles endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "profile.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "profile.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "profile.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/databasemigrationservice/api_client.go b/service/databasemigrationservice/api_client.go index b830343476e..8c9ddce0d9f 100644 --- a/service/databasemigrationservice/api_client.go +++ b/service/databasemigrationservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/databasemigrationservice/endpoints.go b/service/databasemigrationservice/endpoints.go index 15f95373576..0358d63ea3c 100644 --- a/service/databasemigrationservice/endpoints.go +++ b/service/databasemigrationservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/databasemigrationservice/generated.json b/service/databasemigrationservice/generated.json index f0da7859ab8..92707c6e7cd 100644 --- a/service/databasemigrationservice/generated.json +++ b/service/databasemigrationservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/databasemigrationservice/go.mod b/service/databasemigrationservice/go.mod index e3837f7a69c..00f7e9193b4 100644 --- a/service/databasemigrationservice/go.mod +++ b/service/databasemigrationservice/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/databasemigrationservice/internal/endpoints/endpoints.go b/service/databasemigrationservice/internal/endpoints/endpoints.go index 6dd5ff8cb37..264c84e6465 100644 --- a/service/databasemigrationservice/internal/endpoints/endpoints.go +++ b/service/databasemigrationservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Database Migration Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,6 +126,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dms.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/databrew/api_client.go b/service/databrew/api_client.go index 1d0019124c4..e09e2737127 100644 --- a/service/databrew/api_client.go +++ b/service/databrew/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/databrew/endpoints.go b/service/databrew/endpoints.go index e0c17c84c06..5ea28ded0b0 100644 --- a/service/databrew/endpoints.go +++ b/service/databrew/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/databrew/generated.json b/service/databrew/generated.json index e5808d746bc..0a87068d220 100644 --- a/service/databrew/generated.json +++ b/service/databrew/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/databrew/go.mod b/service/databrew/go.mod index 94ba6044e4c..c0fa947b289 100644 --- a/service/databrew/go.mod +++ b/service/databrew/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/databrew/internal/endpoints/endpoints.go b/service/databrew/internal/endpoints/endpoints.go index c5e04d5b426..2d00a4e609f 100644 --- a/service/databrew/internal/endpoints/endpoints.go +++ b/service/databrew/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DataBrew endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "databrew.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "databrew.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "databrew.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/dataexchange/api_client.go b/service/dataexchange/api_client.go index dda2ed0fbf3..a883164eb37 100644 --- a/service/dataexchange/api_client.go +++ b/service/dataexchange/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/dataexchange/endpoints.go b/service/dataexchange/endpoints.go index b8914f51722..006f58e59eb 100644 --- a/service/dataexchange/endpoints.go +++ b/service/dataexchange/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dataexchange/generated.json b/service/dataexchange/generated.json index edb8d0e25ba..f27f800f3ca 100644 --- a/service/dataexchange/generated.json +++ b/service/dataexchange/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dataexchange/go.mod b/service/dataexchange/go.mod index e9c45979330..9adc28bd67c 100644 --- a/service/dataexchange/go.mod +++ b/service/dataexchange/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dataexchange/internal/endpoints/endpoints.go b/service/dataexchange/internal/endpoints/endpoints.go index d8bf505936a..e966498e595 100644 --- a/service/dataexchange/internal/endpoints/endpoints.go +++ b/service/dataexchange/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DataExchange endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dataexchange.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dataexchange.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -113,6 +145,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dataexchange.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/datapipeline/api_client.go b/service/datapipeline/api_client.go index fd86d077c41..a6e5d510034 100644 --- a/service/datapipeline/api_client.go +++ b/service/datapipeline/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/datapipeline/endpoints.go b/service/datapipeline/endpoints.go index 22d12f05bc7..49e45db968d 100644 --- a/service/datapipeline/endpoints.go +++ b/service/datapipeline/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/datapipeline/generated.json b/service/datapipeline/generated.json index 2cd6d13f467..0df15036569 100644 --- a/service/datapipeline/generated.json +++ b/service/datapipeline/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/datapipeline/go.mod b/service/datapipeline/go.mod index b85eaf17951..9daa5295fd0 100644 --- a/service/datapipeline/go.mod +++ b/service/datapipeline/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/datapipeline/internal/endpoints/endpoints.go b/service/datapipeline/internal/endpoints/endpoints.go index e6494bd00a8..d23e3c526e3 100644 --- a/service/datapipeline/internal/endpoints/endpoints.go +++ b/service/datapipeline/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Data Pipeline endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datapipeline.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -77,6 +104,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datapipeline.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datapipeline.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/datasync/api_client.go b/service/datasync/api_client.go index fba24f5323e..a6841ef76bc 100644 --- a/service/datasync/api_client.go +++ b/service/datasync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/datasync/endpoints.go b/service/datasync/endpoints.go index 4d2a442a9bd..ea11bb32475 100644 --- a/service/datasync/endpoints.go +++ b/service/datasync/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/datasync/generated.json b/service/datasync/generated.json index 16132dbea42..05b00f13993 100644 --- a/service/datasync/generated.json +++ b/service/datasync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/datasync/go.mod b/service/datasync/go.mod index 4af30ead0e0..a77aab47595 100644 --- a/service/datasync/go.mod +++ b/service/datasync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/datasync/internal/endpoints/endpoints.go b/service/datasync/internal/endpoints/endpoints.go index bb16024d794..b643df4d64a 100644 --- a/service/datasync/internal/endpoints/endpoints.go +++ b/service/datasync/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DataSync endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datasync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -122,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datasync.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -152,6 +184,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "datasync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/dax/api_client.go b/service/dax/api_client.go index ff0fb5bd69f..4f7a038c132 100644 --- a/service/dax/api_client.go +++ b/service/dax/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/dax/endpoints.go b/service/dax/endpoints.go index 088a46fcfe8..7c2c09bdfa2 100644 --- a/service/dax/endpoints.go +++ b/service/dax/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dax/generated.json b/service/dax/generated.json index 347c49af62e..00cdc4f041f 100644 --- a/service/dax/generated.json +++ b/service/dax/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dax/go.mod b/service/dax/go.mod index f5aeeb073eb..d361cf754fa 100644 --- a/service/dax/go.mod +++ b/service/dax/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dax/internal/endpoints/endpoints.go b/service/dax/internal/endpoints/endpoints.go index 9e39bc9fdad..622cd015d63 100644 --- a/service/dax/internal/endpoints/endpoints.go +++ b/service/dax/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DAX endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dax.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dax.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -118,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dax.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/detective/api_client.go b/service/detective/api_client.go index 5f191d37b2e..1a39ba4ff9b 100644 --- a/service/detective/api_client.go +++ b/service/detective/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/detective/endpoints.go b/service/detective/endpoints.go index 9af8e8e2877..adc397980c7 100644 --- a/service/detective/endpoints.go +++ b/service/detective/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/detective/generated.json b/service/detective/generated.json index f5facb79698..46e70299e8e 100644 --- a/service/detective/generated.json +++ b/service/detective/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/detective/go.mod b/service/detective/go.mod index f3f6c0fb193..52e3862e360 100644 --- a/service/detective/go.mod +++ b/service/detective/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/detective/internal/endpoints/endpoints.go b/service/detective/internal/endpoints/endpoints.go index 9fbd5ecf372..914bea5441a 100644 --- a/service/detective/internal/endpoints/endpoints.go +++ b/service/detective/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Detective endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.detective.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.detective.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -146,6 +178,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.detective.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/devicefarm/api_client.go b/service/devicefarm/api_client.go index cd5089eddfb..7aee022590a 100644 --- a/service/devicefarm/api_client.go +++ b/service/devicefarm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/devicefarm/endpoints.go b/service/devicefarm/endpoints.go index a8bba601a42..a51f360ba92 100644 --- a/service/devicefarm/endpoints.go +++ b/service/devicefarm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/devicefarm/generated.json b/service/devicefarm/generated.json index 24dc6ed9bf5..768627685a4 100644 --- a/service/devicefarm/generated.json +++ b/service/devicefarm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/devicefarm/go.mod b/service/devicefarm/go.mod index 8e45ba254af..310ecbfb932 100644 --- a/service/devicefarm/go.mod +++ b/service/devicefarm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/devicefarm/internal/endpoints/endpoints.go b/service/devicefarm/internal/endpoints/endpoints.go index 40073ae13fe..f3fe0d67eb2 100644 --- a/service/devicefarm/internal/endpoints/endpoints.go +++ b/service/devicefarm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Device Farm endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devicefarm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devicefarm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devicefarm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/devopsguru/api_client.go b/service/devopsguru/api_client.go index 82462e502d2..84cec98352b 100644 --- a/service/devopsguru/api_client.go +++ b/service/devopsguru/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/devopsguru/endpoints.go b/service/devopsguru/endpoints.go index 202b0b0da51..a5e8ba40bc4 100644 --- a/service/devopsguru/endpoints.go +++ b/service/devopsguru/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/devopsguru/generated.json b/service/devopsguru/generated.json index 89b4944cabb..19a7735a3e8 100644 --- a/service/devopsguru/generated.json +++ b/service/devopsguru/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/devopsguru/go.mod b/service/devopsguru/go.mod index 020c75945d8..5447c45cdb7 100644 --- a/service/devopsguru/go.mod +++ b/service/devopsguru/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/devopsguru/internal/endpoints/endpoints.go b/service/devopsguru/internal/endpoints/endpoints.go index f2e191cb49c..2483feda772 100644 --- a/service/devopsguru/internal/endpoints/endpoints.go +++ b/service/devopsguru/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DevOps Guru endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devops-guru.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devops-guru.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devops-guru.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/directconnect/api_client.go b/service/directconnect/api_client.go index 7742395dc0f..9e36b5a77eb 100644 --- a/service/directconnect/api_client.go +++ b/service/directconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/directconnect/endpoints.go b/service/directconnect/endpoints.go index f708a7ef3e7..85688cd6e7e 100644 --- a/service/directconnect/endpoints.go +++ b/service/directconnect/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/directconnect/generated.json b/service/directconnect/generated.json index baf64e95ab8..0cf810d17b7 100644 --- a/service/directconnect/generated.json +++ b/service/directconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/directconnect/go.mod b/service/directconnect/go.mod index 93c0e389c14..c07da97e462 100644 --- a/service/directconnect/go.mod +++ b/service/directconnect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/directconnect/internal/endpoints/endpoints.go b/service/directconnect/internal/endpoints/endpoints.go index 23242ed01cf..4708180301b 100644 --- a/service/directconnect/internal/endpoints/endpoints.go +++ b/service/directconnect/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Direct Connect endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "directconnect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "directconnect.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "directconnect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/directoryservice/api_client.go b/service/directoryservice/api_client.go index 5c54988ba71..28f1cafb2ef 100644 --- a/service/directoryservice/api_client.go +++ b/service/directoryservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/directoryservice/endpoints.go b/service/directoryservice/endpoints.go index c16be952cc0..db29b45d671 100644 --- a/service/directoryservice/endpoints.go +++ b/service/directoryservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/directoryservice/generated.json b/service/directoryservice/generated.json index 30ffa995826..19da8c9d69c 100644 --- a/service/directoryservice/generated.json +++ b/service/directoryservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/directoryservice/go.mod b/service/directoryservice/go.mod index 903cf45406a..55787f35282 100644 --- a/service/directoryservice/go.mod +++ b/service/directoryservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/directoryservice/internal/endpoints/endpoints.go b/service/directoryservice/internal/endpoints/endpoints.go index 75038511820..9f67176baef 100644 --- a/service/directoryservice/internal/endpoints/endpoints.go +++ b/service/directoryservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Directory Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -122,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ds.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -159,6 +191,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/dlm/api_client.go b/service/dlm/api_client.go index d86a5524a48..c2600fc96b3 100644 --- a/service/dlm/api_client.go +++ b/service/dlm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/dlm/endpoints.go b/service/dlm/endpoints.go index f6753694dd6..1219a4bc807 100644 --- a/service/dlm/endpoints.go +++ b/service/dlm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dlm/generated.json b/service/dlm/generated.json index 02fecf7da08..5538251bbff 100644 --- a/service/dlm/generated.json +++ b/service/dlm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dlm/go.mod b/service/dlm/go.mod index bd080769a95..550afa106b7 100644 --- a/service/dlm/go.mod +++ b/service/dlm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dlm/internal/endpoints/endpoints.go b/service/dlm/internal/endpoints/endpoints.go index e8763adcc88..3d02df2a7c0 100644 --- a/service/dlm/internal/endpoints/endpoints.go +++ b/service/dlm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DLM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,31 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dlm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-3": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -93,12 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dlm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - "cn-northwest-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -127,11 +132,12 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dlm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-gov-east-1": endpoints.Endpoint{}, - "us-gov-west-1": endpoints.Endpoint{}, - }, }, } diff --git a/service/docdb/api_client.go b/service/docdb/api_client.go index 80ebe0573c3..5c853ca0c17 100644 --- a/service/docdb/api_client.go +++ b/service/docdb/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/docdb/endpoints.go b/service/docdb/endpoints.go index 09c34db7832..4721973eff0 100644 --- a/service/docdb/endpoints.go +++ b/service/docdb/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/docdb/generated.json b/service/docdb/generated.json index bfd9f5afec1..e73ad02d847 100644 --- a/service/docdb/generated.json +++ b/service/docdb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/docdb/go.mod b/service/docdb/go.mod index 6a1627694ec..e2416bdd32b 100644 --- a/service/docdb/go.mod +++ b/service/docdb/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/docdb/internal/endpoints/endpoints.go b/service/docdb/internal/endpoints/endpoints.go index 5644a75810e..fb7b1d04161 100644 --- a/service/docdb/internal/endpoints/endpoints.go +++ b/service/docdb/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DocDB endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/dynamodb/api_client.go b/service/dynamodb/api_client.go index a500303bd5c..77d7917deae 100644 --- a/service/dynamodb/api_client.go +++ b/service/dynamodb/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" ddbcust "github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/customizations" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" smithy "github.com/aws/smithy-go" @@ -188,6 +189,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -265,6 +267,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/dynamodb/endpoints.go b/service/dynamodb/endpoints.go index a092fa13ab9..14a1bebac4a 100644 --- a/service/dynamodb/endpoints.go +++ b/service/dynamodb/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dynamodb/generated.json b/service/dynamodb/generated.json index c9ce02ba94c..66beb0d67c2 100644 --- a/service/dynamodb/generated.json +++ b/service/dynamodb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/dynamodb/go.mod b/service/dynamodb/go.mod index c82308d8a0d..d2e9f28fca3 100644 --- a/service/dynamodb/go.mod +++ b/service/dynamodb/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../service/internal/accept-encoding/ diff --git a/service/dynamodb/internal/endpoints/endpoints.go b/service/dynamodb/internal/endpoints/endpoints.go index 4775744b70c..831528f83ae 100644 --- a/service/dynamodb/internal/endpoints/endpoints.go +++ b/service/dynamodb/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DynamoDB endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dynamodb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -130,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dynamodb.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -172,6 +204,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "dynamodb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/dynamodbstreams/api_client.go b/service/dynamodbstreams/api_client.go index 4eda816769d..52c7241f125 100644 --- a/service/dynamodbstreams/api_client.go +++ b/service/dynamodbstreams/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/dynamodbstreams/endpoints.go b/service/dynamodbstreams/endpoints.go index ee013cad880..f474a98f59c 100644 --- a/service/dynamodbstreams/endpoints.go +++ b/service/dynamodbstreams/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dynamodbstreams/generated.json b/service/dynamodbstreams/generated.json index 03c95f60c5d..496d4a0931a 100644 --- a/service/dynamodbstreams/generated.json +++ b/service/dynamodbstreams/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dynamodbstreams/go.mod b/service/dynamodbstreams/go.mod index c01661c0f2a..cbca0cf3cda 100644 --- a/service/dynamodbstreams/go.mod +++ b/service/dynamodbstreams/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dynamodbstreams/internal/endpoints/endpoints.go b/service/dynamodbstreams/internal/endpoints/endpoints.go index 0055a5e504c..328fb18e912 100644 --- a/service/dynamodbstreams/internal/endpoints/endpoints.go +++ b/service/dynamodbstreams/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver DynamoDB Streams endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,30 +85,68 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "streams.dynamodb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, + "ca-central-1-fips": endpoints.Endpoint{ + Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "local": endpoints.Endpoint{ + Hostname: "localhost:8000", + Protocols: []string{"http"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "me-south-1": endpoints.Endpoint{}, + "sa-east-1": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + "us-east-1-fips": endpoints.Endpoint{ + Hostname: "dynamodb-fips.us-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoints.Endpoint{}, + "us-east-2-fips": endpoints.Endpoint{ + Hostname: "dynamodb-fips.us-east-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoints.Endpoint{}, + "us-west-1-fips": endpoints.Endpoint{ + Hostname: "dynamodb-fips.us-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoints.Endpoint{}, + "us-west-2-fips": endpoints.Endpoint{ + Hostname: "dynamodb-fips.us-west-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-2", + }, + }, }, }, { @@ -99,6 +159,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "streams.dynamodb.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -110,7 +175,7 @@ var defaultPartitions = endpoints.Partitions{ ID: "aws-iso", Defaults: endpoints.Endpoint{ Hostname: "streams.dynamodb.{region}.c2s.ic.gov", - Protocols: []string{"https"}, + Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, CredentialScope: endpoints.CredentialScope{ Service: "dynamodb", @@ -119,7 +184,9 @@ var defaultPartitions = endpoints.Partitions{ RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "us-iso-east-1": endpoints.Endpoint{}, + "us-iso-east-1": endpoints.Endpoint{ + Protocols: []string{"http", "https"}, + }, }, }, { @@ -148,19 +215,24 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "streams.dynamodb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, "us-gov-east-1-fips": endpoints.Endpoint{ - Hostname: "streams.dynamodb.us-gov-east-1.amazonaws.com", + Hostname: "dynamodb.us-gov-east-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-gov-east-1", }, }, "us-gov-west-1": endpoints.Endpoint{}, "us-gov-west-1-fips": endpoints.Endpoint{ - Hostname: "streams.dynamodb.us-gov-west-1.amazonaws.com", + Hostname: "dynamodb.us-gov-west-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-gov-west-1", }, diff --git a/service/ebs/api_client.go b/service/ebs/api_client.go index d369c096d32..6eba3db88d7 100644 --- a/service/ebs/api_client.go +++ b/service/ebs/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ebs/endpoints.go b/service/ebs/endpoints.go index 9fa930af503..f9b1e22e53e 100644 --- a/service/ebs/endpoints.go +++ b/service/ebs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ebs/generated.json b/service/ebs/generated.json index 4409d7c3bc5..78677a9fd0e 100644 --- a/service/ebs/generated.json +++ b/service/ebs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ebs/go.mod b/service/ebs/go.mod index 8c3d2357be7..dc5cbf0db66 100644 --- a/service/ebs/go.mod +++ b/service/ebs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ebs/internal/endpoints/endpoints.go b/service/ebs/internal/endpoints/endpoints.go index 927f2add75a..f09ea9755fd 100644 --- a/service/ebs/internal/endpoints/endpoints.go +++ b/service/ebs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EBS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ebs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ebs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ebs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ec2/api_client.go b/service/ec2/api_client.go index 88b377cc3f8..afe97c00280 100644 --- a/service/ec2/api_client.go +++ b/service/ec2/api_client.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -181,6 +182,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -258,6 +260,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ec2/endpoints.go b/service/ec2/endpoints.go index d26b615004d..76343d6006d 100644 --- a/service/ec2/endpoints.go +++ b/service/ec2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ec2/generated.json b/service/ec2/generated.json index 695b0f68eab..24d60fb93a0 100644 --- a/service/ec2/generated.json +++ b/service/ec2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/ec2/go.mod b/service/ec2/go.mod index 772f156e252..a14a80eb45b 100644 --- a/service/ec2/go.mod +++ b/service/ec2/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/ec2/internal/endpoints/endpoints.go b/service/ec2/internal/endpoints/endpoints.go index 662abcfe69a..1794f976017 100644 --- a/service/ec2/internal/endpoints/endpoints.go +++ b/service/ec2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EC2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ec2.{region}.aws", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -72,48 +99,12 @@ var defaultPartitions = endpoints.Partitions{ "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, "ca-central-1": endpoints.Endpoint{}, - "dualstack-ap-south-1": endpoints.Endpoint{ - Hostname: "api.ec2.ap-south-1.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "ap-south-1", - }, - }, - "dualstack-eu-west-1": endpoints.Endpoint{ - Hostname: "api.ec2.eu-west-1.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-1", - }, - }, - "dualstack-sa-east-1": endpoints.Endpoint{ - Hostname: "api.ec2.sa-east-1.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "sa-east-1", - }, - }, - "dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "api.ec2.us-east-1.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "api.ec2.us-east-2.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", - }, - }, - "dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "api.ec2.us-west-2.aws", - CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", - }, - }, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, "fips-ca-central-1": endpoints.Endpoint{ Hostname: "ec2-fips.ca-central-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ @@ -151,6 +142,44 @@ var defaultPartitions = endpoints.Partitions{ "us-west-1": endpoints.Endpoint{}, "us-west-2": endpoints.Endpoint{}, }, + DualStackEndpoints: endpoints.Endpoints{ + "ap-south-1": endpoints.Endpoint{ + Hostname: "api.ec2.ap-south-1.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "ap-south-1", + }, + }, + "eu-west-1": endpoints.Endpoint{ + Hostname: "api.ec2.eu-west-1.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "eu-west-1", + }, + }, + "sa-east-1": endpoints.Endpoint{ + Hostname: "api.ec2.sa-east-1.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "sa-east-1", + }, + }, + "us-east-1": endpoints.Endpoint{ + Hostname: "api.ec2.us-east-1.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoints.Endpoint{ + Hostname: "api.ec2.us-east-2.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoints.Endpoint{ + Hostname: "api.ec2.us-west-2.aws", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-2", + }, + }, + }, }, { ID: "aws-cn", @@ -159,6 +188,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ec2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -199,6 +233,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ec2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ec2instanceconnect/api_client.go b/service/ec2instanceconnect/api_client.go index bb0a5d27dbe..871167662b9 100644 --- a/service/ec2instanceconnect/api_client.go +++ b/service/ec2instanceconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ec2instanceconnect/endpoints.go b/service/ec2instanceconnect/endpoints.go index 341df16fc5a..7f2fbb422a1 100644 --- a/service/ec2instanceconnect/endpoints.go +++ b/service/ec2instanceconnect/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ec2instanceconnect/generated.json b/service/ec2instanceconnect/generated.json index b09db2451ae..8ffb4fc8748 100644 --- a/service/ec2instanceconnect/generated.json +++ b/service/ec2instanceconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ec2instanceconnect/go.mod b/service/ec2instanceconnect/go.mod index 147108ffe87..6f13214f25d 100644 --- a/service/ec2instanceconnect/go.mod +++ b/service/ec2instanceconnect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ec2instanceconnect/internal/endpoints/endpoints.go b/service/ec2instanceconnect/internal/endpoints/endpoints.go index 7f0f654966e..d74cd688a76 100644 --- a/service/ec2instanceconnect/internal/endpoints/endpoints.go +++ b/service/ec2instanceconnect/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EC2 Instance Connect endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ec2-instance-connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ec2-instance-connect.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ec2-instance-connect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ecr/api_client.go b/service/ecr/api_client.go index 7a21b360058..16817ff2496 100644 --- a/service/ecr/api_client.go +++ b/service/ecr/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ecr/endpoints.go b/service/ecr/endpoints.go index 6c3b7ef78b1..e822204317b 100644 --- a/service/ecr/endpoints.go +++ b/service/ecr/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecr/generated.json b/service/ecr/generated.json index 5c4d5aa642d..6204485ba28 100644 --- a/service/ecr/generated.json +++ b/service/ecr/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ecr/go.mod b/service/ecr/go.mod index fefd915d9e7..287f04faaad 100644 --- a/service/ecr/go.mod +++ b/service/ecr/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecr/internal/endpoints/endpoints.go b/service/ecr/internal/endpoints/endpoints.go index 2cdc06963b8..136f6b90688 100644 --- a/service/ecr/internal/endpoints/endpoints.go +++ b/service/ecr/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ECR endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -246,6 +273,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -306,6 +338,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ecrpublic/api_client.go b/service/ecrpublic/api_client.go index 76af339f679..4f2a51f848a 100644 --- a/service/ecrpublic/api_client.go +++ b/service/ecrpublic/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ecrpublic/endpoints.go b/service/ecrpublic/endpoints.go index 53564826349..ac25230a2fb 100644 --- a/service/ecrpublic/endpoints.go +++ b/service/ecrpublic/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecrpublic/generated.json b/service/ecrpublic/generated.json index b62a2747792..ae500454307 100644 --- a/service/ecrpublic/generated.json +++ b/service/ecrpublic/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ecrpublic/go.mod b/service/ecrpublic/go.mod index 1dbe8489202..2f7cb7db86d 100644 --- a/service/ecrpublic/go.mod +++ b/service/ecrpublic/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecrpublic/internal/endpoints/endpoints.go b/service/ecrpublic/internal/endpoints/endpoints.go index 35d866b09b9..12f1df59bfd 100644 --- a/service/ecrpublic/internal/endpoints/endpoints.go +++ b/service/ecrpublic/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ECR PUBLIC endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,16 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr-public.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-east-1": endpoints.Endpoint{ - Hostname: "api.ecr-public.us-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - }, }, { ID: "aws-cn", @@ -78,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr-public.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.ecr-public.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ecs/api_client.go b/service/ecs/api_client.go index f189cdff585..646c0d9c27e 100644 --- a/service/ecs/api_client.go +++ b/service/ecs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ecs/endpoints.go b/service/ecs/endpoints.go index 649ee874ae7..3d4356b5dd4 100644 --- a/service/ecs/endpoints.go +++ b/service/ecs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecs/generated.json b/service/ecs/generated.json index e893edbcfb0..aeb75fb8400 100644 --- a/service/ecs/generated.json +++ b/service/ecs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ecs/go.mod b/service/ecs/go.mod index 2f5e1775241..de1a1550ec0 100644 --- a/service/ecs/go.mod +++ b/service/ecs/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecs/internal/endpoints/endpoints.go b/service/ecs/internal/endpoints/endpoints.go index 41cfa9db7ed..55c3f0d66f6 100644 --- a/service/ecs/internal/endpoints/endpoints.go +++ b/service/ecs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ECS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ecs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ecs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ecs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/efs/api_client.go b/service/efs/api_client.go index e79a2b315aa..4a506470684 100644 --- a/service/efs/api_client.go +++ b/service/efs/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/efs/endpoints.go b/service/efs/endpoints.go index 29a1eb50719..10b8b3c96f1 100644 --- a/service/efs/endpoints.go +++ b/service/efs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/efs/generated.json b/service/efs/generated.json index ad802774bf9..c8c3f7cfd12 100644 --- a/service/efs/generated.json +++ b/service/efs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/efs/go.mod b/service/efs/go.mod index 88bf95a0202..317530595a2 100644 --- a/service/efs/go.mod +++ b/service/efs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/efs/internal/endpoints/endpoints.go b/service/efs/internal/endpoints/endpoints.go index 14686231323..8e6b635b342 100644 --- a/service/efs/internal/endpoints/endpoints.go +++ b/service/efs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EFS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticfilesystem.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -219,6 +246,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticfilesystem.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -265,6 +297,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticfilesystem.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/eks/api_client.go b/service/eks/api_client.go index 816c6e20ece..c130af48416 100644 --- a/service/eks/api_client.go +++ b/service/eks/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/eks/endpoints.go b/service/eks/endpoints.go index 5b5d879febc..4e76e7959f5 100644 --- a/service/eks/endpoints.go +++ b/service/eks/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/eks/generated.json b/service/eks/generated.json index 70dcc48430d..22c1dddc853 100644 --- a/service/eks/generated.json +++ b/service/eks/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/eks/go.mod b/service/eks/go.mod index 100b210f28b..cd4b9f37bcc 100644 --- a/service/eks/go.mod +++ b/service/eks/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/eks/internal/endpoints/endpoints.go b/service/eks/internal/endpoints/endpoints.go index 6ba0ee37d9f..86b18d9c4de 100644 --- a/service/eks/internal/endpoints/endpoints.go +++ b/service/eks/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EKS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "eks.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "eks.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "eks.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elasticache/api_client.go b/service/elasticache/api_client.go index 7701120d8d2..e84d6f2fa06 100644 --- a/service/elasticache/api_client.go +++ b/service/elasticache/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticache/endpoints.go b/service/elasticache/endpoints.go index feebf2532be..056d1f7e263 100644 --- a/service/elasticache/endpoints.go +++ b/service/elasticache/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticache/generated.json b/service/elasticache/generated.json index e7e6b1c6705..4411a1930f9 100644 --- a/service/elasticache/generated.json +++ b/service/elasticache/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticache/go.mod b/service/elasticache/go.mod index 05d5de63b24..1e75ac3372d 100644 --- a/service/elasticache/go.mod +++ b/service/elasticache/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticache/internal/endpoints/endpoints.go b/service/elasticache/internal/endpoints/endpoints.go index c6f6ac58c29..7c72a49ad6a 100644 --- a/service/elasticache/internal/endpoints/endpoints.go +++ b/service/elasticache/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ElastiCache endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticache.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,6 +126,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticache.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -139,6 +171,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticache.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elasticbeanstalk/api_client.go b/service/elasticbeanstalk/api_client.go index 16b32fafc58..8cbbc876215 100644 --- a/service/elasticbeanstalk/api_client.go +++ b/service/elasticbeanstalk/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticbeanstalk/endpoints.go b/service/elasticbeanstalk/endpoints.go index b36ef971e56..f4c2e3617fb 100644 --- a/service/elasticbeanstalk/endpoints.go +++ b/service/elasticbeanstalk/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticbeanstalk/generated.json b/service/elasticbeanstalk/generated.json index 70a46a1a3fb..d91e0498829 100644 --- a/service/elasticbeanstalk/generated.json +++ b/service/elasticbeanstalk/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticbeanstalk/go.mod b/service/elasticbeanstalk/go.mod index f0fc4bde743..04221025197 100644 --- a/service/elasticbeanstalk/go.mod +++ b/service/elasticbeanstalk/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticbeanstalk/internal/endpoints/endpoints.go b/service/elasticbeanstalk/internal/endpoints/endpoints.go index 1cba36fc02b..423937d106e 100644 --- a/service/elasticbeanstalk/internal/endpoints/endpoints.go +++ b/service/elasticbeanstalk/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elastic Beanstalk endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticbeanstalk.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticbeanstalk.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticbeanstalk.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elasticinference/api_client.go b/service/elasticinference/api_client.go index 4e7828b6436..2d68b6901be 100644 --- a/service/elasticinference/api_client.go +++ b/service/elasticinference/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticinference/endpoints.go b/service/elasticinference/endpoints.go index 2948f3dd560..f7613ce8f8a 100644 --- a/service/elasticinference/endpoints.go +++ b/service/elasticinference/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticinference/generated.json b/service/elasticinference/generated.json index c65c605f092..0295254bb15 100644 --- a/service/elasticinference/generated.json +++ b/service/elasticinference/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticinference/go.mod b/service/elasticinference/go.mod index e9b3dafab22..8797ff76d35 100644 --- a/service/elasticinference/go.mod +++ b/service/elasticinference/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticinference/internal/endpoints/endpoints.go b/service/elasticinference/internal/endpoints/endpoints.go index 7eb758057ed..1d1333e1c6f 100644 --- a/service/elasticinference/internal/endpoints/endpoints.go +++ b/service/elasticinference/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elastic Inference endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.elastic-inference.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -90,6 +117,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.elastic-inference.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -120,6 +152,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.elastic-inference.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/elasticloadbalancing/api_client.go b/service/elasticloadbalancing/api_client.go index c3efa9e9b1a..a5a4bed072e 100644 --- a/service/elasticloadbalancing/api_client.go +++ b/service/elasticloadbalancing/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticloadbalancing/endpoints.go b/service/elasticloadbalancing/endpoints.go index 5f892551ed7..498fb2bdb14 100644 --- a/service/elasticloadbalancing/endpoints.go +++ b/service/elasticloadbalancing/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticloadbalancing/generated.json b/service/elasticloadbalancing/generated.json index b51aa0195a1..3d0825504c0 100644 --- a/service/elasticloadbalancing/generated.json +++ b/service/elasticloadbalancing/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticloadbalancing/go.mod b/service/elasticloadbalancing/go.mod index e2bface1677..d97be9ab814 100644 --- a/service/elasticloadbalancing/go.mod +++ b/service/elasticloadbalancing/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticloadbalancing/internal/endpoints/endpoints.go b/service/elasticloadbalancing/internal/endpoints/endpoints.go index 8d48240d18d..bdde64f50cd 100644 --- a/service/elasticloadbalancing/internal/endpoints/endpoints.go +++ b/service/elasticloadbalancing/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elastic Load Balancing endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -161,6 +193,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elasticloadbalancingv2/api_client.go b/service/elasticloadbalancingv2/api_client.go index ecf5795f4a0..74ea63f7c92 100644 --- a/service/elasticloadbalancingv2/api_client.go +++ b/service/elasticloadbalancingv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticloadbalancingv2/endpoints.go b/service/elasticloadbalancingv2/endpoints.go index 96700286bd8..2d85a50f6af 100644 --- a/service/elasticloadbalancingv2/endpoints.go +++ b/service/elasticloadbalancingv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticloadbalancingv2/generated.json b/service/elasticloadbalancingv2/generated.json index 411ceb1c549..46331460c43 100644 --- a/service/elasticloadbalancingv2/generated.json +++ b/service/elasticloadbalancingv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticloadbalancingv2/go.mod b/service/elasticloadbalancingv2/go.mod index 32ed9b9f5cf..210579bb568 100644 --- a/service/elasticloadbalancingv2/go.mod +++ b/service/elasticloadbalancingv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticloadbalancingv2/internal/endpoints/endpoints.go b/service/elasticloadbalancingv2/internal/endpoints/endpoints.go index 75b3938cd28..bc0bc9b4e94 100644 --- a/service/elasticloadbalancingv2/internal/endpoints/endpoints.go +++ b/service/elasticloadbalancingv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elastic Load Balancing v2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -161,6 +193,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticloadbalancing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elasticsearchservice/api_client.go b/service/elasticsearchservice/api_client.go index 02fc451b42e..db910086d19 100644 --- a/service/elasticsearchservice/api_client.go +++ b/service/elasticsearchservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elasticsearchservice/endpoints.go b/service/elasticsearchservice/endpoints.go index b3aca46dd5c..9527acdd495 100644 --- a/service/elasticsearchservice/endpoints.go +++ b/service/elasticsearchservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticsearchservice/generated.json b/service/elasticsearchservice/generated.json index 3034bc0c95f..dfab0347ca0 100644 --- a/service/elasticsearchservice/generated.json +++ b/service/elasticsearchservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticsearchservice/go.mod b/service/elasticsearchservice/go.mod index eb2e2499657..25b80791411 100644 --- a/service/elasticsearchservice/go.mod +++ b/service/elasticsearchservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticsearchservice/internal/endpoints/endpoints.go b/service/elasticsearchservice/internal/endpoints/endpoints.go index 7899165ffd8..cb75308e2d4 100644 --- a/service/elasticsearchservice/internal/endpoints/endpoints.go +++ b/service/elasticsearchservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elasticsearch Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "es.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,6 +126,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "es.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -139,6 +171,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "es.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/elastictranscoder/api_client.go b/service/elastictranscoder/api_client.go index 0a43be4d5f3..c1422164f5c 100644 --- a/service/elastictranscoder/api_client.go +++ b/service/elastictranscoder/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/elastictranscoder/endpoints.go b/service/elastictranscoder/endpoints.go index c4f74ab5f86..dd1459123f9 100644 --- a/service/elastictranscoder/endpoints.go +++ b/service/elastictranscoder/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elastictranscoder/generated.json b/service/elastictranscoder/generated.json index b5215913e23..f5418a696b6 100644 --- a/service/elastictranscoder/generated.json +++ b/service/elastictranscoder/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elastictranscoder/go.mod b/service/elastictranscoder/go.mod index a2d293366f8..d415f5e4a09 100644 --- a/service/elastictranscoder/go.mod +++ b/service/elastictranscoder/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elastictranscoder/internal/endpoints/endpoints.go b/service/elastictranscoder/internal/endpoints/endpoints.go index f3f8500a3d8..fb92e63807a 100644 --- a/service/elastictranscoder/internal/endpoints/endpoints.go +++ b/service/elastictranscoder/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Elastic Transcoder endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elastictranscoder.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -80,6 +107,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elastictranscoder.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elastictranscoder.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/emr/api_client.go b/service/emr/api_client.go index d0749fdc75a..86f8ae722ad 100644 --- a/service/emr/api_client.go +++ b/service/emr/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/emr/endpoints.go b/service/emr/endpoints.go index 245109c6f46..6b1203dccb9 100644 --- a/service/emr/endpoints.go +++ b/service/emr/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/emr/generated.json b/service/emr/generated.json index 0bbc313259f..8dc05a8111b 100644 --- a/service/emr/generated.json +++ b/service/emr/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/emr/go.mod b/service/emr/go.mod index e14f6c7c431..e3c8a190a75 100644 --- a/service/emr/go.mod +++ b/service/emr/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/emr/internal/endpoints/endpoints.go b/service/emr/internal/endpoints/endpoints.go index 81141593b53..761512785f4 100644 --- a/service/emr/internal/endpoints/endpoints.go +++ b/service/emr/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EMR endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticmapreduce.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticmapreduce.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -165,6 +197,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "elasticmapreduce.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/emrcontainers/api_client.go b/service/emrcontainers/api_client.go index 82d8409c735..259e097e575 100644 --- a/service/emrcontainers/api_client.go +++ b/service/emrcontainers/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/emrcontainers/endpoints.go b/service/emrcontainers/endpoints.go index 0d988bb423c..74c103b6540 100644 --- a/service/emrcontainers/endpoints.go +++ b/service/emrcontainers/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/emrcontainers/generated.json b/service/emrcontainers/generated.json index 715e8ab45ae..9174e042826 100644 --- a/service/emrcontainers/generated.json +++ b/service/emrcontainers/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/emrcontainers/go.mod b/service/emrcontainers/go.mod index 3d2aec325b2..6ccf6ffcbf0 100644 --- a/service/emrcontainers/go.mod +++ b/service/emrcontainers/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/emrcontainers/internal/endpoints/endpoints.go b/service/emrcontainers/internal/endpoints/endpoints.go index 7fcc744fdd4..1111f043dbe 100644 --- a/service/emrcontainers/internal/endpoints/endpoints.go +++ b/service/emrcontainers/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EMR containers endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "emr-containers.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "emr-containers.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "emr-containers.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/eventbridge/api_client.go b/service/eventbridge/api_client.go index 253f620d915..f67d610e433 100644 --- a/service/eventbridge/api_client.go +++ b/service/eventbridge/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/eventbridge/endpoints.go b/service/eventbridge/endpoints.go index fd44a02e4e3..c5f22a9bef7 100644 --- a/service/eventbridge/endpoints.go +++ b/service/eventbridge/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/eventbridge/generated.json b/service/eventbridge/generated.json index dde8d327c48..b5f9f235660 100644 --- a/service/eventbridge/generated.json +++ b/service/eventbridge/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/eventbridge/go.mod b/service/eventbridge/go.mod index ccbc3e6ceba..065ff6862f3 100644 --- a/service/eventbridge/go.mod +++ b/service/eventbridge/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/eventbridge/internal/endpoints/endpoints.go b/service/eventbridge/internal/endpoints/endpoints.go index aa3949eb443..8c54ab5d5fe 100644 --- a/service/eventbridge/internal/endpoints/endpoints.go +++ b/service/eventbridge/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver EventBridge endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/finspace/api_client.go b/service/finspace/api_client.go index fe5b6b03d1e..346c206dd7c 100644 --- a/service/finspace/api_client.go +++ b/service/finspace/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + type customizeRestJsonContentType struct { } diff --git a/service/finspace/endpoints.go b/service/finspace/endpoints.go index fdba9b27cbb..4a7cf2b13bc 100644 --- a/service/finspace/endpoints.go +++ b/service/finspace/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/finspace/generated.json b/service/finspace/generated.json index 2fd8f1b0ce3..07e19021310 100644 --- a/service/finspace/generated.json +++ b/service/finspace/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/finspace/go.mod b/service/finspace/go.mod index b0b41e4e658..8efabb75a6f 100644 --- a/service/finspace/go.mod +++ b/service/finspace/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/finspace/internal/endpoints/endpoints.go b/service/finspace/internal/endpoints/endpoints.go index 2b17ed5db17..576ac82e62b 100644 --- a/service/finspace/internal/endpoints/endpoints.go +++ b/service/finspace/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver finspace endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,8 +82,20 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "ca-central-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + "us-east-2": endpoints.Endpoint{}, + "us-west-2": endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -70,6 +104,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +139,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/finspacedata/api_client.go b/service/finspacedata/api_client.go index 482d0924617..88375c9921d 100644 --- a/service/finspacedata/api_client.go +++ b/service/finspacedata/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + type customizeRestJsonContentType struct { } diff --git a/service/finspacedata/endpoints.go b/service/finspacedata/endpoints.go index 713b3b5324f..14615b6235d 100644 --- a/service/finspacedata/endpoints.go +++ b/service/finspacedata/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/finspacedata/generated.json b/service/finspacedata/generated.json index 8633315d9b5..8db2054d0da 100644 --- a/service/finspacedata/generated.json +++ b/service/finspacedata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/finspacedata/go.mod b/service/finspacedata/go.mod index d0666c27f33..d471c20f263 100644 --- a/service/finspacedata/go.mod +++ b/service/finspacedata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/finspacedata/internal/endpoints/endpoints.go b/service/finspacedata/internal/endpoints/endpoints.go index 88ed180d996..b8ae70b638e 100644 --- a/service/finspacedata/internal/endpoints/endpoints.go +++ b/service/finspacedata/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver finspace data endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,8 +82,20 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace-api.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "ca-central-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + "us-east-2": endpoints.Endpoint{}, + "us-west-2": endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -70,6 +104,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace-api.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +139,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "finspace-api.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/firehose/api_client.go b/service/firehose/api_client.go index c75f60ed935..f0f5fcda555 100644 --- a/service/firehose/api_client.go +++ b/service/firehose/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/firehose/endpoints.go b/service/firehose/endpoints.go index 392d0106733..6baa203b18d 100644 --- a/service/firehose/endpoints.go +++ b/service/firehose/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/firehose/generated.json b/service/firehose/generated.json index c76257f824a..983dcc39085 100644 --- a/service/firehose/generated.json +++ b/service/firehose/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/firehose/go.mod b/service/firehose/go.mod index 1936fc94e07..c7a47623093 100644 --- a/service/firehose/go.mod +++ b/service/firehose/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/firehose/internal/endpoints/endpoints.go b/service/firehose/internal/endpoints/endpoints.go index 54d67917f09..fb7e5f1d456 100644 --- a/service/firehose/internal/endpoints/endpoints.go +++ b/service/firehose/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Firehose endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "firehose.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "firehose.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -133,6 +165,9 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "us-iso-east-1": endpoints.Endpoint{}, + }, }, { ID: "aws-iso-b", @@ -151,6 +186,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "firehose.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/fis/api_client.go b/service/fis/api_client.go index 5a8c8cfd7c5..8fea469d3d4 100644 --- a/service/fis/api_client.go +++ b/service/fis/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/fis/endpoints.go b/service/fis/endpoints.go index 422cfa1d676..703a762f587 100644 --- a/service/fis/endpoints.go +++ b/service/fis/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fis/generated.json b/service/fis/generated.json index 2259f9fcda3..00e1ac98b94 100644 --- a/service/fis/generated.json +++ b/service/fis/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fis/go.mod b/service/fis/go.mod index be3e98f341f..ed0b5cb4a66 100644 --- a/service/fis/go.mod +++ b/service/fis/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fis/internal/endpoints/endpoints.go b/service/fis/internal/endpoints/endpoints.go index 65127706ea1..9b3dd5fb59b 100644 --- a/service/fis/internal/endpoints/endpoints.go +++ b/service/fis/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver fis endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fis.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fis.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fis.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/fms/api_client.go b/service/fms/api_client.go index 1a191e326b7..8f66c93d61a 100644 --- a/service/fms/api_client.go +++ b/service/fms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/fms/endpoints.go b/service/fms/endpoints.go index a92eee8f7bc..ee0a720c6d3 100644 --- a/service/fms/endpoints.go +++ b/service/fms/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fms/generated.json b/service/fms/generated.json index a0879eed409..08f6826b7b8 100644 --- a/service/fms/generated.json +++ b/service/fms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fms/go.mod b/service/fms/go.mod index 0e027f3a7ed..b639ace5586 100644 --- a/service/fms/go.mod +++ b/service/fms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fms/internal/endpoints/endpoints.go b/service/fms/internal/endpoints/endpoints.go index 15230a5d756..b0dafe6a9ac 100644 --- a/service/fms/internal/endpoints/endpoints.go +++ b/service/fms/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver FMS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -206,6 +233,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fms.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -236,7 +268,28 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "fips-us-gov-east-1": endpoints.Endpoint{ + Hostname: "fms-fips.us-gov-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-east-1", + }, + }, + "fips-us-gov-west-1": endpoints.Endpoint{ + Hostname: "fms-fips.us-gov-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoints.Endpoint{}, + "us-gov-west-1": endpoints.Endpoint{}, + }, }, } diff --git a/service/forecast/api_client.go b/service/forecast/api_client.go index 06b10ee243c..6ec2e161d7f 100644 --- a/service/forecast/api_client.go +++ b/service/forecast/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/forecast/endpoints.go b/service/forecast/endpoints.go index a3a920a0403..1fb342f43b1 100644 --- a/service/forecast/endpoints.go +++ b/service/forecast/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/forecast/generated.json b/service/forecast/generated.json index 1bd8c9ad6ac..7ba793e893b 100644 --- a/service/forecast/generated.json +++ b/service/forecast/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/forecast/go.mod b/service/forecast/go.mod index 398a9a5cc12..c839e1e6b57 100644 --- a/service/forecast/go.mod +++ b/service/forecast/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/forecast/internal/endpoints/endpoints.go b/service/forecast/internal/endpoints/endpoints.go index 93fe94a5c2e..1a4c92fb7c7 100644 --- a/service/forecast/internal/endpoints/endpoints.go +++ b/service/forecast/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver forecast endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/forecastquery/api_client.go b/service/forecastquery/api_client.go index 0f9d662fbcf..57c1d4065ec 100644 --- a/service/forecastquery/api_client.go +++ b/service/forecastquery/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/forecastquery/endpoints.go b/service/forecastquery/endpoints.go index 90a375a3d97..775f250b9cd 100644 --- a/service/forecastquery/endpoints.go +++ b/service/forecastquery/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/forecastquery/generated.json b/service/forecastquery/generated.json index 850fe6b541f..ce54b2d6eb5 100644 --- a/service/forecastquery/generated.json +++ b/service/forecastquery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/forecastquery/go.mod b/service/forecastquery/go.mod index 3b5d6790d63..2a066996060 100644 --- a/service/forecastquery/go.mod +++ b/service/forecastquery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/forecastquery/internal/endpoints/endpoints.go b/service/forecastquery/internal/endpoints/endpoints.go index 537f74b2ec0..c77974e6ed5 100644 --- a/service/forecastquery/internal/endpoints/endpoints.go +++ b/service/forecastquery/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver forecastquery endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "forecast.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/frauddetector/api_client.go b/service/frauddetector/api_client.go index ba25b5af9ab..818a41191a0 100644 --- a/service/frauddetector/api_client.go +++ b/service/frauddetector/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/frauddetector/endpoints.go b/service/frauddetector/endpoints.go index d4c6d4b9a4f..d80e7e4e205 100644 --- a/service/frauddetector/endpoints.go +++ b/service/frauddetector/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/frauddetector/generated.json b/service/frauddetector/generated.json index e4d8181b2fc..890f3bec1ab 100644 --- a/service/frauddetector/generated.json +++ b/service/frauddetector/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/frauddetector/go.mod b/service/frauddetector/go.mod index fcd69584a4f..7e15ed6f26a 100644 --- a/service/frauddetector/go.mod +++ b/service/frauddetector/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/frauddetector/internal/endpoints/endpoints.go b/service/frauddetector/internal/endpoints/endpoints.go index 15064bd22f7..5120b160f1d 100644 --- a/service/frauddetector/internal/endpoints/endpoints.go +++ b/service/frauddetector/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver FraudDetector endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,16 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "frauddetector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -78,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "frauddetector.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "frauddetector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/fsx/api_client.go b/service/fsx/api_client.go index dfb3508e415..7228d1f20cf 100644 --- a/service/fsx/api_client.go +++ b/service/fsx/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/fsx/endpoints.go b/service/fsx/endpoints.go index 4d833d2e67e..d2b1d5be592 100644 --- a/service/fsx/endpoints.go +++ b/service/fsx/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fsx/generated.json b/service/fsx/generated.json index fb5258c96b3..826ea8b57b4 100644 --- a/service/fsx/generated.json +++ b/service/fsx/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fsx/go.mod b/service/fsx/go.mod index f45eee0f70d..d59f27f41b8 100644 --- a/service/fsx/go.mod +++ b/service/fsx/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fsx/internal/endpoints/endpoints.go b/service/fsx/internal/endpoints/endpoints.go index f65d7846aa4..11188d26094 100644 --- a/service/fsx/internal/endpoints/endpoints.go +++ b/service/fsx/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver FSx endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fsx.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -122,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fsx.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -156,6 +188,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "fsx.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/gamelift/api_client.go b/service/gamelift/api_client.go index 51a2f7c69f4..f7f654c13ff 100644 --- a/service/gamelift/api_client.go +++ b/service/gamelift/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/gamelift/endpoints.go b/service/gamelift/endpoints.go index 65ac8cca0c6..39eb95dff14 100644 --- a/service/gamelift/endpoints.go +++ b/service/gamelift/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/gamelift/generated.json b/service/gamelift/generated.json index 442b5faa537..f7c5aa73c4a 100644 --- a/service/gamelift/generated.json +++ b/service/gamelift/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/gamelift/go.mod b/service/gamelift/go.mod index 2c7ee40386b..2ddd3ffb7f5 100644 --- a/service/gamelift/go.mod +++ b/service/gamelift/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/gamelift/internal/endpoints/endpoints.go b/service/gamelift/internal/endpoints/endpoints.go index 119284ceef7..788b90711cb 100644 --- a/service/gamelift/internal/endpoints/endpoints.go +++ b/service/gamelift/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver GameLift endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,9 +82,16 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "gamelift.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, @@ -70,8 +99,12 @@ var defaultPartitions = endpoints.Partitions{ "ap-southeast-2": endpoints.Endpoint{}, "ca-central-1": endpoints.Endpoint{}, "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, "eu-west-1": endpoints.Endpoint{}, "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "me-south-1": endpoints.Endpoint{}, "sa-east-1": endpoints.Endpoint{}, "us-east-1": endpoints.Endpoint{}, "us-east-2": endpoints.Endpoint{}, @@ -86,6 +119,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "gamelift.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -119,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "gamelift.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/glacier/api_client.go b/service/glacier/api_client.go index 78dd6d41baa..37771a916df 100644 --- a/service/glacier/api_client.go +++ b/service/glacier/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/glacier/endpoints.go b/service/glacier/endpoints.go index 11ac8ef9dbf..b0ea5335f6e 100644 --- a/service/glacier/endpoints.go +++ b/service/glacier/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/glacier/generated.json b/service/glacier/generated.json index cf5b32b159a..c9fe7118b07 100644 --- a/service/glacier/generated.json +++ b/service/glacier/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/glacier/go.mod b/service/glacier/go.mod index 00737a1fc10..16f0883e025 100644 --- a/service/glacier/go.mod +++ b/service/glacier/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/glacier/internal/endpoints/endpoints.go b/service/glacier/internal/endpoints/endpoints.go index 464ba7b2a8a..719b02df598 100644 --- a/service/glacier/internal/endpoints/endpoints.go +++ b/service/glacier/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Glacier endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glacier.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glacier.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -165,6 +197,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glacier.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/globalaccelerator/api_client.go b/service/globalaccelerator/api_client.go index 8ffec656d07..7b284a1c4a4 100644 --- a/service/globalaccelerator/api_client.go +++ b/service/globalaccelerator/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/globalaccelerator/endpoints.go b/service/globalaccelerator/endpoints.go index 5939ce1b6f2..7200a85e8fa 100644 --- a/service/globalaccelerator/endpoints.go +++ b/service/globalaccelerator/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/globalaccelerator/generated.json b/service/globalaccelerator/generated.json index cf3353f06f0..d540d94bf10 100644 --- a/service/globalaccelerator/generated.json +++ b/service/globalaccelerator/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/globalaccelerator/go.mod b/service/globalaccelerator/go.mod index 1d7f8713ff9..48ee12c3fc9 100644 --- a/service/globalaccelerator/go.mod +++ b/service/globalaccelerator/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/globalaccelerator/internal/endpoints/endpoints.go b/service/globalaccelerator/internal/endpoints/endpoints.go index af477d74ca9..ccda2c42a76 100644 --- a/service/globalaccelerator/internal/endpoints/endpoints.go +++ b/service/globalaccelerator/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Global Accelerator endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "globalaccelerator.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "globalaccelerator.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "globalaccelerator.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/glue/api_client.go b/service/glue/api_client.go index 31897124039..54221579d75 100644 --- a/service/glue/api_client.go +++ b/service/glue/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/glue/endpoints.go b/service/glue/endpoints.go index 831c4641a37..c2d85975f78 100644 --- a/service/glue/endpoints.go +++ b/service/glue/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/glue/generated.json b/service/glue/generated.json index 005b9533271..c67e6881eb2 100644 --- a/service/glue/generated.json +++ b/service/glue/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/glue/go.mod b/service/glue/go.mod index e521be411a6..3449fddf65a 100644 --- a/service/glue/go.mod +++ b/service/glue/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/glue/internal/endpoints/endpoints.go b/service/glue/internal/endpoints/endpoints.go index 8087602acbf..865da44f88c 100644 --- a/service/glue/internal/endpoints/endpoints.go +++ b/service/glue/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Glue endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glue.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glue.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "glue.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/greengrass/api_client.go b/service/greengrass/api_client.go index f3e8ccc7b7c..cfab9a0f775 100644 --- a/service/greengrass/api_client.go +++ b/service/greengrass/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/greengrass/endpoints.go b/service/greengrass/endpoints.go index 7dbc4929044..69df076c49f 100644 --- a/service/greengrass/endpoints.go +++ b/service/greengrass/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/greengrass/generated.json b/service/greengrass/generated.json index da06b23ef0d..dbe08f01aae 100644 --- a/service/greengrass/generated.json +++ b/service/greengrass/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/greengrass/go.mod b/service/greengrass/go.mod index 4fbba4c123e..db83be09faa 100644 --- a/service/greengrass/go.mod +++ b/service/greengrass/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/greengrass/internal/endpoints/endpoints.go b/service/greengrass/internal/endpoints/endpoints.go index e8f20ad2f75..d0d769e6899 100644 --- a/service/greengrass/internal/endpoints/endpoints.go +++ b/service/greengrass/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Greengrass endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +148,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/greengrassv2/api_client.go b/service/greengrassv2/api_client.go index 798520b38ee..92413c211a6 100644 --- a/service/greengrassv2/api_client.go +++ b/service/greengrassv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/greengrassv2/endpoints.go b/service/greengrassv2/endpoints.go index 97daaa2124c..942b9a21803 100644 --- a/service/greengrassv2/endpoints.go +++ b/service/greengrassv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/greengrassv2/generated.json b/service/greengrassv2/generated.json index 51ab3303ad7..3d00e5e30d9 100644 --- a/service/greengrassv2/generated.json +++ b/service/greengrassv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/greengrassv2/go.mod b/service/greengrassv2/go.mod index cd38835e02f..f4d4e9b63cb 100644 --- a/service/greengrassv2/go.mod +++ b/service/greengrassv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/greengrassv2/internal/endpoints/endpoints.go b/service/greengrassv2/internal/endpoints/endpoints.go index 15b34cb3e73..e9e83236d0a 100644 --- a/service/greengrassv2/internal/endpoints/endpoints.go +++ b/service/greengrassv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver GreengrassV2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +148,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "greengrass.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/groundstation/api_client.go b/service/groundstation/api_client.go index eb0e09011f7..2af40d42355 100644 --- a/service/groundstation/api_client.go +++ b/service/groundstation/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/groundstation/endpoints.go b/service/groundstation/endpoints.go index b4814f68fae..3956557a663 100644 --- a/service/groundstation/endpoints.go +++ b/service/groundstation/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/groundstation/generated.json b/service/groundstation/generated.json index 9d7a6da591e..0f8ac4d1230 100644 --- a/service/groundstation/generated.json +++ b/service/groundstation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/groundstation/go.mod b/service/groundstation/go.mod index ae6dc143b89..1a17f7aff15 100644 --- a/service/groundstation/go.mod +++ b/service/groundstation/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/groundstation/internal/endpoints/endpoints.go b/service/groundstation/internal/endpoints/endpoints.go index c932a500060..c653ab2f9e9 100644 --- a/service/groundstation/internal/endpoints/endpoints.go +++ b/service/groundstation/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver GroundStation endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "groundstation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,6 +126,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "groundstation.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -129,6 +161,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "groundstation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/guardduty/api_client.go b/service/guardduty/api_client.go index daa62c8b2ba..8f4755ef9e4 100644 --- a/service/guardduty/api_client.go +++ b/service/guardduty/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/guardduty/endpoints.go b/service/guardduty/endpoints.go index 68b9de78a12..516d588c053 100644 --- a/service/guardduty/endpoints.go +++ b/service/guardduty/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/guardduty/generated.json b/service/guardduty/generated.json index ed34ee9e746..c626519e24d 100644 --- a/service/guardduty/generated.json +++ b/service/guardduty/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/guardduty/go.mod b/service/guardduty/go.mod index aedddf97352..72a3287046a 100644 --- a/service/guardduty/go.mod +++ b/service/guardduty/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/guardduty/internal/endpoints/endpoints.go b/service/guardduty/internal/endpoints/endpoints.go index e6dccdade4d..47240315c31 100644 --- a/service/guardduty/internal/endpoints/endpoints.go +++ b/service/guardduty/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver GuardDuty endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "guardduty.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -67,6 +94,7 @@ var defaultPartitions = endpoints.Partitions{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -116,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "guardduty.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -150,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "guardduty.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/health/api_client.go b/service/health/api_client.go index b9e7fc47caf..174fb106274 100644 --- a/service/health/api_client.go +++ b/service/health/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/health/endpoints.go b/service/health/endpoints.go index ea562902b95..b4a5ca96d1a 100644 --- a/service/health/endpoints.go +++ b/service/health/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/health/generated.json b/service/health/generated.json index bef4b99d5a3..ddaa4e3bc14 100644 --- a/service/health/generated.json +++ b/service/health/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/health/go.mod b/service/health/go.mod index 7b9401e984e..c6b946076ab 100644 --- a/service/health/go.mod +++ b/service/health/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/health/internal/endpoints/endpoints.go b/service/health/internal/endpoints/endpoints.go index 22b5bcbf18f..562ab9b800a 100644 --- a/service/health/internal/endpoints/endpoints.go +++ b/service/health/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Health endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "health.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,8 +105,17 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "health.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, }, { ID: "aws-iso", @@ -90,6 +126,9 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "us-iso-east-1": endpoints.Endpoint{}, + }, }, { ID: "aws-iso-b", @@ -100,6 +139,9 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "us-isob-east-1": endpoints.Endpoint{}, + }, }, { ID: "aws-us-gov", @@ -108,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "health.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/healthlake/api_client.go b/service/healthlake/api_client.go index c4fa9a277ea..1fe45c6aec5 100644 --- a/service/healthlake/api_client.go +++ b/service/healthlake/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/healthlake/endpoints.go b/service/healthlake/endpoints.go index 21f8959fd6a..3518774d7b6 100644 --- a/service/healthlake/endpoints.go +++ b/service/healthlake/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/healthlake/generated.json b/service/healthlake/generated.json index 2e38506da96..2248ed3ee0e 100644 --- a/service/healthlake/generated.json +++ b/service/healthlake/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/healthlake/go.mod b/service/healthlake/go.mod index 0bd430315eb..d8a6e330f63 100644 --- a/service/healthlake/go.mod +++ b/service/healthlake/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/healthlake/internal/endpoints/endpoints.go b/service/healthlake/internal/endpoints/endpoints.go index b71767b9b8e..b6157485615 100644 --- a/service/healthlake/internal/endpoints/endpoints.go +++ b/service/healthlake/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver HealthLake endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "healthlake.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "healthlake.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "healthlake.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/honeycode/api_client.go b/service/honeycode/api_client.go index 6b5b476ee8d..0b105aeebe1 100644 --- a/service/honeycode/api_client.go +++ b/service/honeycode/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/honeycode/endpoints.go b/service/honeycode/endpoints.go index 5112ecb07dd..1e2d79d21d5 100644 --- a/service/honeycode/endpoints.go +++ b/service/honeycode/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/honeycode/generated.json b/service/honeycode/generated.json index 90ac648d0c5..81b882f14aa 100644 --- a/service/honeycode/generated.json +++ b/service/honeycode/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/honeycode/go.mod b/service/honeycode/go.mod index 2ce82eae2c8..fec96f9b280 100644 --- a/service/honeycode/go.mod +++ b/service/honeycode/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/honeycode/internal/endpoints/endpoints.go b/service/honeycode/internal/endpoints/endpoints.go index 3301bdd0ea0..6609f367cc1 100644 --- a/service/honeycode/internal/endpoints/endpoints.go +++ b/service/honeycode/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Honeycode endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "honeycode.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "honeycode.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "honeycode.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iam/api_client.go b/service/iam/api_client.go index 35ef82f849f..5d11dba9093 100644 --- a/service/iam/api_client.go +++ b/service/iam/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iam/endpoints.go b/service/iam/endpoints.go index a453cbe76ca..e8721f45769 100644 --- a/service/iam/endpoints.go +++ b/service/iam/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iam/generated.json b/service/iam/generated.json index b982aa97fe6..0a14b6dde1c 100644 --- a/service/iam/generated.json +++ b/service/iam/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iam/go.mod b/service/iam/go.mod index d00f6effd17..a371b288f4f 100644 --- a/service/iam/go.mod +++ b/service/iam/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iam/internal/endpoints/endpoints.go b/service/iam/internal/endpoints/endpoints.go index feacfef9e17..542a28489eb 100644 --- a/service/iam/internal/endpoints/endpoints.go +++ b/service/iam/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IAM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iam.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iam.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -142,6 +174,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iam.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", diff --git a/service/identitystore/api_client.go b/service/identitystore/api_client.go index 87274ced85e..0c9d23aafc0 100644 --- a/service/identitystore/api_client.go +++ b/service/identitystore/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/identitystore/endpoints.go b/service/identitystore/endpoints.go index c65fa920fd3..2a73d7c78d5 100644 --- a/service/identitystore/endpoints.go +++ b/service/identitystore/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/identitystore/generated.json b/service/identitystore/generated.json index 3252efa1895..5137f2d00e0 100644 --- a/service/identitystore/generated.json +++ b/service/identitystore/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/identitystore/go.mod b/service/identitystore/go.mod index 47fc7c00d99..0cc736ddb13 100644 --- a/service/identitystore/go.mod +++ b/service/identitystore/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/identitystore/internal/endpoints/endpoints.go b/service/identitystore/internal/endpoints/endpoints.go index 9a5366f36de..d4e5528c8ed 100644 --- a/service/identitystore/internal/endpoints/endpoints.go +++ b/service/identitystore/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver identitystore endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "identitystore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "identitystore.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "identitystore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/imagebuilder/api_client.go b/service/imagebuilder/api_client.go index 3e441df72e6..a6966e834b7 100644 --- a/service/imagebuilder/api_client.go +++ b/service/imagebuilder/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/imagebuilder/endpoints.go b/service/imagebuilder/endpoints.go index 1223a18a221..a2f3e8fe4dc 100644 --- a/service/imagebuilder/endpoints.go +++ b/service/imagebuilder/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/imagebuilder/generated.json b/service/imagebuilder/generated.json index 028cd21bf69..2f5bc776dd1 100644 --- a/service/imagebuilder/generated.json +++ b/service/imagebuilder/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/imagebuilder/go.mod b/service/imagebuilder/go.mod index f8fa4debaa6..aa25f9cb1bc 100644 --- a/service/imagebuilder/go.mod +++ b/service/imagebuilder/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/imagebuilder/internal/endpoints/endpoints.go b/service/imagebuilder/internal/endpoints/endpoints.go index 8f748643cf0..867663ddd05 100644 --- a/service/imagebuilder/internal/endpoints/endpoints.go +++ b/service/imagebuilder/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver imagebuilder endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "imagebuilder.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "imagebuilder.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "imagebuilder.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/inspector/api_client.go b/service/inspector/api_client.go index 03ff02cb5c5..5fc4a58f00c 100644 --- a/service/inspector/api_client.go +++ b/service/inspector/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/inspector/endpoints.go b/service/inspector/endpoints.go index 7a0aa716cce..4f6f7949272 100644 --- a/service/inspector/endpoints.go +++ b/service/inspector/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/inspector/generated.json b/service/inspector/generated.json index 1153e8d29bf..202541592e0 100644 --- a/service/inspector/generated.json +++ b/service/inspector/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/inspector/go.mod b/service/inspector/go.mod index a5081b91d17..31616c2d2d3 100644 --- a/service/inspector/go.mod +++ b/service/inspector/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/inspector/internal/endpoints/endpoints.go b/service/inspector/internal/endpoints/endpoints.go index 9dcbe617859..19d90d7e021 100644 --- a/service/inspector/internal/endpoints/endpoints.go +++ b/service/inspector/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Inspector endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -108,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -138,6 +170,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/internal/benchmark/go.mod b/service/internal/benchmark/go.mod index 4f24de58c36..15ac8baac74 100644 --- a/service/internal/benchmark/go.mod +++ b/service/internal/benchmark/go.mod @@ -12,6 +12,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../service/internal/accept-encoding/ diff --git a/service/internal/integrationtest/go.mod b/service/internal/integrationtest/go.mod index 929e85e7f3e..7046804c022 100644 --- a/service/internal/integrationtest/go.mod +++ b/service/internal/integrationtest/go.mod @@ -98,6 +98,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/acm => ../../../service/acm/ diff --git a/service/iot/api_client.go b/service/iot/api_client.go index c7fb40ea0c9..4f53781c037 100644 --- a/service/iot/api_client.go +++ b/service/iot/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/iot/endpoints.go b/service/iot/endpoints.go index 94f8732e168..d7ebb43def8 100644 --- a/service/iot/endpoints.go +++ b/service/iot/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot/generated.json b/service/iot/generated.json index 2b25154c46a..de8d66b76af 100644 --- a/service/iot/generated.json +++ b/service/iot/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot/go.mod b/service/iot/go.mod index d75ea2c356d..55a9d923575 100644 --- a/service/iot/go.mod +++ b/service/iot/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot/internal/endpoints/endpoints.go b/service/iot/internal/endpoints/endpoints.go index e3e7a8fdb6b..35ee7ddddd4 100644 --- a/service/iot/internal/endpoints/endpoints.go +++ b/service/iot/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -96,6 +123,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iot.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -133,6 +165,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/iot1clickdevicesservice/api_client.go b/service/iot1clickdevicesservice/api_client.go index 98adb9dbabd..725bc53e44f 100644 --- a/service/iot1clickdevicesservice/api_client.go +++ b/service/iot1clickdevicesservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iot1clickdevicesservice/endpoints.go b/service/iot1clickdevicesservice/endpoints.go index 755b8280943..a4578caa65b 100644 --- a/service/iot1clickdevicesservice/endpoints.go +++ b/service/iot1clickdevicesservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot1clickdevicesservice/generated.json b/service/iot1clickdevicesservice/generated.json index 4436eb6d804..8fcf111ae9b 100644 --- a/service/iot1clickdevicesservice/generated.json +++ b/service/iot1clickdevicesservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot1clickdevicesservice/go.mod b/service/iot1clickdevicesservice/go.mod index 06707016102..4ab17aef7e6 100644 --- a/service/iot1clickdevicesservice/go.mod +++ b/service/iot1clickdevicesservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot1clickdevicesservice/internal/endpoints/endpoints.go b/service/iot1clickdevicesservice/internal/endpoints/endpoints.go index fc324bd7f57..985d9140c16 100644 --- a/service/iot1clickdevicesservice/internal/endpoints/endpoints.go +++ b/service/iot1clickdevicesservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT 1Click Devices Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,11 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devices.iot1click.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -73,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devices.iot1click.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "devices.iot1click.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iot1clickprojects/api_client.go b/service/iot1clickprojects/api_client.go index 81aa2079c70..14c4339d572 100644 --- a/service/iot1clickprojects/api_client.go +++ b/service/iot1clickprojects/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iot1clickprojects/endpoints.go b/service/iot1clickprojects/endpoints.go index 9c04110dc12..a98c6e863dd 100644 --- a/service/iot1clickprojects/endpoints.go +++ b/service/iot1clickprojects/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot1clickprojects/generated.json b/service/iot1clickprojects/generated.json index 9680e1955c0..f2c68b7f399 100644 --- a/service/iot1clickprojects/generated.json +++ b/service/iot1clickprojects/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot1clickprojects/go.mod b/service/iot1clickprojects/go.mod index 30de797ed66..0d25f8ec792 100644 --- a/service/iot1clickprojects/go.mod +++ b/service/iot1clickprojects/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot1clickprojects/internal/endpoints/endpoints.go b/service/iot1clickprojects/internal/endpoints/endpoints.go index dc31a8d8f53..f29430bfa4c 100644 --- a/service/iot1clickprojects/internal/endpoints/endpoints.go +++ b/service/iot1clickprojects/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT 1Click Projects endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "projects.iot1click.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "projects.iot1click.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "projects.iot1click.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotanalytics/api_client.go b/service/iotanalytics/api_client.go index c72320780ef..5d847d9fe2b 100644 --- a/service/iotanalytics/api_client.go +++ b/service/iotanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotanalytics/endpoints.go b/service/iotanalytics/endpoints.go index 2c075463a19..570f4a6ba73 100644 --- a/service/iotanalytics/endpoints.go +++ b/service/iotanalytics/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotanalytics/generated.json b/service/iotanalytics/generated.json index 3f324c3985c..b07f16111e7 100644 --- a/service/iotanalytics/generated.json +++ b/service/iotanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotanalytics/go.mod b/service/iotanalytics/go.mod index aea9e897766..67a7b9d3d45 100644 --- a/service/iotanalytics/go.mod +++ b/service/iotanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotanalytics/internal/endpoints/endpoints.go b/service/iotanalytics/internal/endpoints/endpoints.go index 66b3ce80052..7fd23652ae5 100644 --- a/service/iotanalytics/internal/endpoints/endpoints.go +++ b/service/iotanalytics/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoTAnalytics endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotanalytics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -112,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotdataplane/api_client.go b/service/iotdataplane/api_client.go index b08a6ebda39..38476fbcffa 100644 --- a/service/iotdataplane/api_client.go +++ b/service/iotdataplane/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotdataplane/endpoints.go b/service/iotdataplane/endpoints.go index b1c7c36f845..e825098d905 100644 --- a/service/iotdataplane/endpoints.go +++ b/service/iotdataplane/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotdataplane/generated.json b/service/iotdataplane/generated.json index 788763c4648..30f762713f9 100644 --- a/service/iotdataplane/generated.json +++ b/service/iotdataplane/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotdataplane/go.mod b/service/iotdataplane/go.mod index bda8d521bff..e9f105cda72 100644 --- a/service/iotdataplane/go.mod +++ b/service/iotdataplane/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotdataplane/internal/endpoints/endpoints.go b/service/iotdataplane/internal/endpoints/endpoints.go index fc5aed39f9b..6c456d34049 100644 --- a/service/iotdataplane/internal/endpoints/endpoints.go +++ b/service/iotdataplane/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT Data Plane endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -96,6 +123,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iot.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -133,6 +165,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/iotdeviceadvisor/api_client.go b/service/iotdeviceadvisor/api_client.go index 37b9890fa50..893264370dd 100644 --- a/service/iotdeviceadvisor/api_client.go +++ b/service/iotdeviceadvisor/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotdeviceadvisor/endpoints.go b/service/iotdeviceadvisor/endpoints.go index 15c177ad0d2..2652edd3832 100644 --- a/service/iotdeviceadvisor/endpoints.go +++ b/service/iotdeviceadvisor/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotdeviceadvisor/generated.json b/service/iotdeviceadvisor/generated.json index 437302ae6f2..5f4b9b0362c 100644 --- a/service/iotdeviceadvisor/generated.json +++ b/service/iotdeviceadvisor/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotdeviceadvisor/go.mod b/service/iotdeviceadvisor/go.mod index 513f78aa2fc..77187a172d5 100644 --- a/service/iotdeviceadvisor/go.mod +++ b/service/iotdeviceadvisor/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotdeviceadvisor/internal/endpoints/endpoints.go b/service/iotdeviceadvisor/internal/endpoints/endpoints.go index 1dba70617a3..963ed2bf074 100644 --- a/service/iotdeviceadvisor/internal/endpoints/endpoints.go +++ b/service/iotdeviceadvisor/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IotDeviceAdvisor endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotdeviceadvisor.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotdeviceadvisor.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotdeviceadvisor.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotevents/api_client.go b/service/iotevents/api_client.go index b0289f8d903..3896855c548 100644 --- a/service/iotevents/api_client.go +++ b/service/iotevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotevents/endpoints.go b/service/iotevents/endpoints.go index 0f8a9e17658..503b251ea8e 100644 --- a/service/iotevents/endpoints.go +++ b/service/iotevents/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotevents/generated.json b/service/iotevents/generated.json index 03b63cda66f..cd2f14de8a2 100644 --- a/service/iotevents/generated.json +++ b/service/iotevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotevents/go.mod b/service/iotevents/go.mod index baa39b5aa33..9a657746fd7 100644 --- a/service/iotevents/go.mod +++ b/service/iotevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotevents/internal/endpoints/endpoints.go b/service/iotevents/internal/endpoints/endpoints.go index e88731d6714..8950379ebc4 100644 --- a/service/iotevents/internal/endpoints/endpoints.go +++ b/service/iotevents/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT Events endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotevents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -82,6 +109,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotevents.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotevents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ioteventsdata/api_client.go b/service/ioteventsdata/api_client.go index 6ada03dcca5..18d95fe5c77 100644 --- a/service/ioteventsdata/api_client.go +++ b/service/ioteventsdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ioteventsdata/endpoints.go b/service/ioteventsdata/endpoints.go index a0bf84159d0..3f3efc2b3a9 100644 --- a/service/ioteventsdata/endpoints.go +++ b/service/ioteventsdata/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ioteventsdata/generated.json b/service/ioteventsdata/generated.json index fbeed01403e..e6745ab7fae 100644 --- a/service/ioteventsdata/generated.json +++ b/service/ioteventsdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ioteventsdata/go.mod b/service/ioteventsdata/go.mod index d68c52c2071..56257a197b4 100644 --- a/service/ioteventsdata/go.mod +++ b/service/ioteventsdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ioteventsdata/internal/endpoints/endpoints.go b/service/ioteventsdata/internal/endpoints/endpoints.go index ad53cf92baa..7d7cc2821c7 100644 --- a/service/ioteventsdata/internal/endpoints/endpoints.go +++ b/service/ioteventsdata/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT Events Data endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iotevents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iotevents.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.iotevents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotfleethub/api_client.go b/service/iotfleethub/api_client.go index dc6dfcaa83c..094f016ce0c 100644 --- a/service/iotfleethub/api_client.go +++ b/service/iotfleethub/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/iotfleethub/endpoints.go b/service/iotfleethub/endpoints.go index 3ff88c18b5a..2d64f1fb760 100644 --- a/service/iotfleethub/endpoints.go +++ b/service/iotfleethub/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotfleethub/generated.json b/service/iotfleethub/generated.json index 60815ad1266..df22ae60de1 100644 --- a/service/iotfleethub/generated.json +++ b/service/iotfleethub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotfleethub/go.mod b/service/iotfleethub/go.mod index 2fac20a2297..d97c722cd83 100644 --- a/service/iotfleethub/go.mod +++ b/service/iotfleethub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotfleethub/internal/endpoints/endpoints.go b/service/iotfleethub/internal/endpoints/endpoints.go index 26ea45900f1..217d64f1a55 100644 --- a/service/iotfleethub/internal/endpoints/endpoints.go +++ b/service/iotfleethub/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoTFleetHub endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.fleethub.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.fleethub.iot.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.fleethub.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotjobsdataplane/api_client.go b/service/iotjobsdataplane/api_client.go index 645c5b5e003..4a1a5fcff9a 100644 --- a/service/iotjobsdataplane/api_client.go +++ b/service/iotjobsdataplane/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotjobsdataplane/endpoints.go b/service/iotjobsdataplane/endpoints.go index 05f725f51d6..1b995587668 100644 --- a/service/iotjobsdataplane/endpoints.go +++ b/service/iotjobsdataplane/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotjobsdataplane/generated.json b/service/iotjobsdataplane/generated.json index 9eb71ea9377..5a698431729 100644 --- a/service/iotjobsdataplane/generated.json +++ b/service/iotjobsdataplane/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotjobsdataplane/go.mod b/service/iotjobsdataplane/go.mod index 145a53ab0a7..1563709f806 100644 --- a/service/iotjobsdataplane/go.mod +++ b/service/iotjobsdataplane/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotjobsdataplane/internal/endpoints/endpoints.go b/service/iotjobsdataplane/internal/endpoints/endpoints.go index 24a2db37bae..d3617bec4ff 100644 --- a/service/iotjobsdataplane/internal/endpoints/endpoints.go +++ b/service/iotjobsdataplane/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT Jobs Data Plane endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.jobs.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.jobs.iot.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.jobs.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotsecuretunneling/api_client.go b/service/iotsecuretunneling/api_client.go index 9fcb78301ac..6d89ecb8eb6 100644 --- a/service/iotsecuretunneling/api_client.go +++ b/service/iotsecuretunneling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotsecuretunneling/endpoints.go b/service/iotsecuretunneling/endpoints.go index 003ac046fd4..5884046eea0 100644 --- a/service/iotsecuretunneling/endpoints.go +++ b/service/iotsecuretunneling/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotsecuretunneling/generated.json b/service/iotsecuretunneling/generated.json index 8b2e89285c2..d58a7b75698 100644 --- a/service/iotsecuretunneling/generated.json +++ b/service/iotsecuretunneling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotsecuretunneling/go.mod b/service/iotsecuretunneling/go.mod index 5e9fa182b91..2010cfd24b9 100644 --- a/service/iotsecuretunneling/go.mod +++ b/service/iotsecuretunneling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotsecuretunneling/internal/endpoints/endpoints.go b/service/iotsecuretunneling/internal/endpoints/endpoints.go index 212fe083de8..360bafd59d1 100644 --- a/service/iotsecuretunneling/internal/endpoints/endpoints.go +++ b/service/iotsecuretunneling/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoTSecureTunneling endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.tunneling.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.tunneling.iot.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.tunneling.iot.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotsitewise/api_client.go b/service/iotsitewise/api_client.go index 70ed3d055bf..4246f83e033 100644 --- a/service/iotsitewise/api_client.go +++ b/service/iotsitewise/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/iotsitewise/endpoints.go b/service/iotsitewise/endpoints.go index b8304031b29..f67e554df0d 100644 --- a/service/iotsitewise/endpoints.go +++ b/service/iotsitewise/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotsitewise/generated.json b/service/iotsitewise/generated.json index 5d778194d94..e6c38a02abe 100644 --- a/service/iotsitewise/generated.json +++ b/service/iotsitewise/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/iotsitewise/go.mod b/service/iotsitewise/go.mod index bd2a3d79f38..d70f0d96d8d 100644 --- a/service/iotsitewise/go.mod +++ b/service/iotsitewise/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotsitewise/internal/endpoints/endpoints.go b/service/iotsitewise/internal/endpoints/endpoints.go index 128bfefbf5b..eb6d5848ac3 100644 --- a/service/iotsitewise/internal/endpoints/endpoints.go +++ b/service/iotsitewise/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoTSiteWise endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotsitewise.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,11 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotsitewise.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -103,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotsitewise.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotthingsgraph/api_client.go b/service/iotthingsgraph/api_client.go index 5dbfdeef5e7..d9d9417950c 100644 --- a/service/iotthingsgraph/api_client.go +++ b/service/iotthingsgraph/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/iotthingsgraph/endpoints.go b/service/iotthingsgraph/endpoints.go index 2aa81f7302c..006f140eb4a 100644 --- a/service/iotthingsgraph/endpoints.go +++ b/service/iotthingsgraph/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotthingsgraph/generated.json b/service/iotthingsgraph/generated.json index 4cd5331580f..6c2ae6579b4 100644 --- a/service/iotthingsgraph/generated.json +++ b/service/iotthingsgraph/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotthingsgraph/go.mod b/service/iotthingsgraph/go.mod index 99b64070532..c4413d55687 100644 --- a/service/iotthingsgraph/go.mod +++ b/service/iotthingsgraph/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotthingsgraph/internal/endpoints/endpoints.go b/service/iotthingsgraph/internal/endpoints/endpoints.go index 3a3132cc83f..b7856a1189e 100644 --- a/service/iotthingsgraph/internal/endpoints/endpoints.go +++ b/service/iotthingsgraph/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoTThingsGraph endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotthingsgraph", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotthingsgraph.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotthingsgraph.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "iotthingsgraph.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/iotwireless/api_client.go b/service/iotwireless/api_client.go index c01e0129689..3b3f35c1f8b 100644 --- a/service/iotwireless/api_client.go +++ b/service/iotwireless/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/iotwireless/endpoints.go b/service/iotwireless/endpoints.go index be577502889..3c61bba8d61 100644 --- a/service/iotwireless/endpoints.go +++ b/service/iotwireless/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotwireless/generated.json b/service/iotwireless/generated.json index 98f8f624da8..2c11b6b2646 100644 --- a/service/iotwireless/generated.json +++ b/service/iotwireless/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotwireless/go.mod b/service/iotwireless/go.mod index 732ae59e9d0..10589a8971c 100644 --- a/service/iotwireless/go.mod +++ b/service/iotwireless/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotwireless/internal/endpoints/endpoints.go b/service/iotwireless/internal/endpoints/endpoints.go index 715993c60e6..f9270651ae0 100644 --- a/service/iotwireless/internal/endpoints/endpoints.go +++ b/service/iotwireless/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver IoT Wireless endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotwireless.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotwireless.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.iotwireless.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ivs/api_client.go b/service/ivs/api_client.go index d0a2a061846..5ae6d843c30 100644 --- a/service/ivs/api_client.go +++ b/service/ivs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ivs/endpoints.go b/service/ivs/endpoints.go index bcef4b0c08a..07947d6ec52 100644 --- a/service/ivs/endpoints.go +++ b/service/ivs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ivs/generated.json b/service/ivs/generated.json index 333c51a7f18..d256d68b6ff 100644 --- a/service/ivs/generated.json +++ b/service/ivs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ivs/go.mod b/service/ivs/go.mod index c7e454ef4ab..aa9a7662ade 100644 --- a/service/ivs/go.mod +++ b/service/ivs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ivs/internal/endpoints/endpoints.go b/service/ivs/internal/endpoints/endpoints.go index e17ecb83889..6c5a381fa48 100644 --- a/service/ivs/internal/endpoints/endpoints.go +++ b/service/ivs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ivs endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,13 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ivs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -75,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ivs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -105,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ivs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kafka/api_client.go b/service/kafka/api_client.go index 56e009674a4..75fb85e1bc9 100644 --- a/service/kafka/api_client.go +++ b/service/kafka/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kafka/endpoints.go b/service/kafka/endpoints.go index 2ddb6310b73..a8781617d77 100644 --- a/service/kafka/endpoints.go +++ b/service/kafka/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kafka/generated.json b/service/kafka/generated.json index 5104342af3a..dcb86e920cd 100644 --- a/service/kafka/generated.json +++ b/service/kafka/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kafka/go.mod b/service/kafka/go.mod index 809f2c8f160..53b5ff8a661 100644 --- a/service/kafka/go.mod +++ b/service/kafka/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kafka/internal/endpoints/endpoints.go b/service/kafka/internal/endpoints/endpoints.go index 10228a91db0..13c6573a225 100644 --- a/service/kafka/internal/endpoints/endpoints.go +++ b/service/kafka/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kafka endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kafka.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -91,6 +118,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kafka.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -125,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kafka.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/kendra/api_client.go b/service/kendra/api_client.go index 9064e4d0f1c..c6bd74e0258 100644 --- a/service/kendra/api_client.go +++ b/service/kendra/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/kendra/endpoints.go b/service/kendra/endpoints.go index a3eb8dd4cc4..e0c60641360 100644 --- a/service/kendra/endpoints.go +++ b/service/kendra/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kendra/generated.json b/service/kendra/generated.json index 0d35a222878..11891845a20 100644 --- a/service/kendra/generated.json +++ b/service/kendra/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kendra/go.mod b/service/kendra/go.mod index 42145e1d31c..297f62ec27d 100644 --- a/service/kendra/go.mod +++ b/service/kendra/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kendra/internal/endpoints/endpoints.go b/service/kendra/internal/endpoints/endpoints.go index baf3bceb07b..88537eafbb0 100644 --- a/service/kendra/internal/endpoints/endpoints.go +++ b/service/kendra/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver kendra endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kendra.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kendra.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kendra.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kinesis/api_client.go b/service/kinesis/api_client.go index 46eb4fcecb5..b4b51f77d64 100644 --- a/service/kinesis/api_client.go +++ b/service/kinesis/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesis/endpoints.go b/service/kinesis/endpoints.go index 8a471997657..0f73e980cda 100644 --- a/service/kinesis/endpoints.go +++ b/service/kinesis/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesis/generated.json b/service/kinesis/generated.json index 71a27e4d77a..d0d214240f3 100644 --- a/service/kinesis/generated.json +++ b/service/kinesis/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/kinesis/go.mod b/service/kinesis/go.mod index 025aa387ac2..0c952ac4726 100644 --- a/service/kinesis/go.mod +++ b/service/kinesis/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesis/internal/endpoints/endpoints.go b/service/kinesis/internal/endpoints/endpoints.go index 6184560ad33..2cd09fd1d99 100644 --- a/service/kinesis/internal/endpoints/endpoints.go +++ b/service/kinesis/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesis.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesis.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesis.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/kinesisanalytics/api_client.go b/service/kinesisanalytics/api_client.go index b34527a0e05..a7f49794961 100644 --- a/service/kinesisanalytics/api_client.go +++ b/service/kinesisanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisanalytics/endpoints.go b/service/kinesisanalytics/endpoints.go index 4d0678579fc..722081952ad 100644 --- a/service/kinesisanalytics/endpoints.go +++ b/service/kinesisanalytics/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisanalytics/generated.json b/service/kinesisanalytics/generated.json index d426125a1d2..049f85a9370 100644 --- a/service/kinesisanalytics/generated.json +++ b/service/kinesisanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisanalytics/go.mod b/service/kinesisanalytics/go.mod index fb42ea5664c..bf379d69847 100644 --- a/service/kinesisanalytics/go.mod +++ b/service/kinesisanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisanalytics/internal/endpoints/endpoints.go b/service/kinesisanalytics/internal/endpoints/endpoints.go index 170b8c03d1d..880d888f25c 100644 --- a/service/kinesisanalytics/internal/endpoints/endpoints.go +++ b/service/kinesisanalytics/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Analytics endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -91,6 +118,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -125,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/kinesisanalyticsv2/api_client.go b/service/kinesisanalyticsv2/api_client.go index 3f24535c8e5..7f1241aec01 100644 --- a/service/kinesisanalyticsv2/api_client.go +++ b/service/kinesisanalyticsv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisanalyticsv2/endpoints.go b/service/kinesisanalyticsv2/endpoints.go index 2e88c5e977f..66c15a4b620 100644 --- a/service/kinesisanalyticsv2/endpoints.go +++ b/service/kinesisanalyticsv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisanalyticsv2/generated.json b/service/kinesisanalyticsv2/generated.json index 57ef12abb8f..70e00a6b9f3 100644 --- a/service/kinesisanalyticsv2/generated.json +++ b/service/kinesisanalyticsv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisanalyticsv2/go.mod b/service/kinesisanalyticsv2/go.mod index 027b1b5e9a4..cd48b33e0b5 100644 --- a/service/kinesisanalyticsv2/go.mod +++ b/service/kinesisanalyticsv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisanalyticsv2/internal/endpoints/endpoints.go b/service/kinesisanalyticsv2/internal/endpoints/endpoints.go index c6ebdb2a6c4..fd63850aae1 100644 --- a/service/kinesisanalyticsv2/internal/endpoints/endpoints.go +++ b/service/kinesisanalyticsv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Analytics V2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -91,6 +118,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -125,6 +157,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/kinesisvideo/api_client.go b/service/kinesisvideo/api_client.go index 923d7b4e233..7e9928b9535 100644 --- a/service/kinesisvideo/api_client.go +++ b/service/kinesisvideo/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisvideo/endpoints.go b/service/kinesisvideo/endpoints.go index 04714f9e3d6..fb020691d3d 100644 --- a/service/kinesisvideo/endpoints.go +++ b/service/kinesisvideo/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideo/generated.json b/service/kinesisvideo/generated.json index 54ec220ae37..638b3d879ff 100644 --- a/service/kinesisvideo/generated.json +++ b/service/kinesisvideo/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideo/go.mod b/service/kinesisvideo/go.mod index 850179ef005..220a80a2476 100644 --- a/service/kinesisvideo/go.mod +++ b/service/kinesisvideo/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideo/internal/endpoints/endpoints.go b/service/kinesisvideo/internal/endpoints/endpoints.go index 9df52df279b..5fe4d8478ab 100644 --- a/service/kinesisvideo/internal/endpoints/endpoints.go +++ b/service/kinesisvideo/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Video endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kinesisvideoarchivedmedia/api_client.go b/service/kinesisvideoarchivedmedia/api_client.go index aa4c5aade43..a6ff8e9f282 100644 --- a/service/kinesisvideoarchivedmedia/api_client.go +++ b/service/kinesisvideoarchivedmedia/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisvideoarchivedmedia/endpoints.go b/service/kinesisvideoarchivedmedia/endpoints.go index 7a1494d88dd..729695fc391 100644 --- a/service/kinesisvideoarchivedmedia/endpoints.go +++ b/service/kinesisvideoarchivedmedia/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideoarchivedmedia/generated.json b/service/kinesisvideoarchivedmedia/generated.json index dd044a24024..44d65614401 100644 --- a/service/kinesisvideoarchivedmedia/generated.json +++ b/service/kinesisvideoarchivedmedia/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideoarchivedmedia/go.mod b/service/kinesisvideoarchivedmedia/go.mod index 17e393d4d35..c6173c91f77 100644 --- a/service/kinesisvideoarchivedmedia/go.mod +++ b/service/kinesisvideoarchivedmedia/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go b/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go index 9eb7eeae9dc..d5d260a0101 100644 --- a/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go +++ b/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Video Archived Media endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kinesisvideomedia/api_client.go b/service/kinesisvideomedia/api_client.go index 398b31adb5c..0baa133bff0 100644 --- a/service/kinesisvideomedia/api_client.go +++ b/service/kinesisvideomedia/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisvideomedia/endpoints.go b/service/kinesisvideomedia/endpoints.go index f03c4469c91..6e247a7261b 100644 --- a/service/kinesisvideomedia/endpoints.go +++ b/service/kinesisvideomedia/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideomedia/generated.json b/service/kinesisvideomedia/generated.json index 2b7aefa7bd1..eda633f6484 100644 --- a/service/kinesisvideomedia/generated.json +++ b/service/kinesisvideomedia/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideomedia/go.mod b/service/kinesisvideomedia/go.mod index 5fc18522d42..a17825cf5b9 100644 --- a/service/kinesisvideomedia/go.mod +++ b/service/kinesisvideomedia/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideomedia/internal/endpoints/endpoints.go b/service/kinesisvideomedia/internal/endpoints/endpoints.go index 6dbbc9b7793..a2e504e4288 100644 --- a/service/kinesisvideomedia/internal/endpoints/endpoints.go +++ b/service/kinesisvideomedia/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Video Media endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kinesisvideosignaling/api_client.go b/service/kinesisvideosignaling/api_client.go index 8f1159ef08e..6bd45c40ad2 100644 --- a/service/kinesisvideosignaling/api_client.go +++ b/service/kinesisvideosignaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kinesisvideosignaling/endpoints.go b/service/kinesisvideosignaling/endpoints.go index 2e421dae252..2b266a1a142 100644 --- a/service/kinesisvideosignaling/endpoints.go +++ b/service/kinesisvideosignaling/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideosignaling/generated.json b/service/kinesisvideosignaling/generated.json index 372c4159155..2999ce9d64c 100644 --- a/service/kinesisvideosignaling/generated.json +++ b/service/kinesisvideosignaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideosignaling/go.mod b/service/kinesisvideosignaling/go.mod index 381e2163ad2..688a78cfe99 100644 --- a/service/kinesisvideosignaling/go.mod +++ b/service/kinesisvideosignaling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideosignaling/internal/endpoints/endpoints.go b/service/kinesisvideosignaling/internal/endpoints/endpoints.go index 1ae7f41b3c3..2a36fdb5c22 100644 --- a/service/kinesisvideosignaling/internal/endpoints/endpoints.go +++ b/service/kinesisvideosignaling/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Kinesis Video Signaling endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kinesisvideo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/kms/api_client.go b/service/kms/api_client.go index cf96615de17..2628fa0a8b5 100644 --- a/service/kms/api_client.go +++ b/service/kms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/kms/endpoints.go b/service/kms/endpoints.go index b8bce7e926b..c381eb833da 100644 --- a/service/kms/endpoints.go +++ b/service/kms/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kms/generated.json b/service/kms/generated.json index 1a0d3d80bab..9b831b3622e 100644 --- a/service/kms/generated.json +++ b/service/kms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kms/go.mod b/service/kms/go.mod index fd25ecfd068..8f200f9fd54 100644 --- a/service/kms/go.mod +++ b/service/kms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kms/internal/endpoints/endpoints.go b/service/kms/internal/endpoints/endpoints.go index b1d1af3ae9f..95e9aea699c 100644 --- a/service/kms/internal/endpoints/endpoints.go +++ b/service/kms/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver KMS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kms.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -145,6 +177,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "kms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lakeformation/api_client.go b/service/lakeformation/api_client.go index c5c51285a5e..6d840642a45 100644 --- a/service/lakeformation/api_client.go +++ b/service/lakeformation/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lakeformation/endpoints.go b/service/lakeformation/endpoints.go index 10efeb2a916..0a9e3d4ad11 100644 --- a/service/lakeformation/endpoints.go +++ b/service/lakeformation/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lakeformation/generated.json b/service/lakeformation/generated.json index 94c5e8a54f8..a286f2f3d3a 100644 --- a/service/lakeformation/generated.json +++ b/service/lakeformation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lakeformation/go.mod b/service/lakeformation/go.mod index 87b68fa0709..6d50a1050c1 100644 --- a/service/lakeformation/go.mod +++ b/service/lakeformation/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lakeformation/internal/endpoints/endpoints.go b/service/lakeformation/internal/endpoints/endpoints.go index 4e6caac539e..8aa85aca96a 100644 --- a/service/lakeformation/internal/endpoints/endpoints.go +++ b/service/lakeformation/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver LakeFormation endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,9 +82,15 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lakeformation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + "af-south-1": endpoints.Endpoint{}, "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, @@ -115,10 +143,16 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lakeformation.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, }, }, { @@ -148,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lakeformation.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lambda/api_client.go b/service/lambda/api_client.go index c2839cc7d3f..d3154f8cf79 100644 --- a/service/lambda/api_client.go +++ b/service/lambda/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lambda/endpoints.go b/service/lambda/endpoints.go index b76161a0353..beb0ce9d6b2 100644 --- a/service/lambda/endpoints.go +++ b/service/lambda/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lambda/generated.json b/service/lambda/generated.json index 277a058dbe8..8e443136c79 100644 --- a/service/lambda/generated.json +++ b/service/lambda/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/lambda/go.mod b/service/lambda/go.mod index 468d94346fa..9a187924fca 100644 --- a/service/lambda/go.mod +++ b/service/lambda/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lambda/internal/endpoints/endpoints.go b/service/lambda/internal/endpoints/endpoints.go index 96f259791f3..674874bde62 100644 --- a/service/lambda/internal/endpoints/endpoints.go +++ b/service/lambda/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lambda endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lambda.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lambda.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lambda.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lexmodelbuildingservice/api_client.go b/service/lexmodelbuildingservice/api_client.go index 62363b647b5..2d7a31bebbe 100644 --- a/service/lexmodelbuildingservice/api_client.go +++ b/service/lexmodelbuildingservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lexmodelbuildingservice/endpoints.go b/service/lexmodelbuildingservice/endpoints.go index dc5e8915199..c20fa637ad2 100644 --- a/service/lexmodelbuildingservice/endpoints.go +++ b/service/lexmodelbuildingservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexmodelbuildingservice/generated.json b/service/lexmodelbuildingservice/generated.json index b19eceb3814..ae63ccb5a37 100644 --- a/service/lexmodelbuildingservice/generated.json +++ b/service/lexmodelbuildingservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexmodelbuildingservice/go.mod b/service/lexmodelbuildingservice/go.mod index bfdcfe73dba..c6ccdcba764 100644 --- a/service/lexmodelbuildingservice/go.mod +++ b/service/lexmodelbuildingservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexmodelbuildingservice/internal/endpoints/endpoints.go b/service/lexmodelbuildingservice/internal/endpoints/endpoints.go index 2082eaa0c6e..c414bfb5584 100644 --- a/service/lexmodelbuildingservice/internal/endpoints/endpoints.go +++ b/service/lexmodelbuildingservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lex Model Building Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models.lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -95,6 +122,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models.lex.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -128,6 +160,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models.lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lexmodelsv2/api_client.go b/service/lexmodelsv2/api_client.go index d81fc48a655..26e85f90b16 100644 --- a/service/lexmodelsv2/api_client.go +++ b/service/lexmodelsv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lexmodelsv2/endpoints.go b/service/lexmodelsv2/endpoints.go index e350165ce1e..8b83e2383a4 100644 --- a/service/lexmodelsv2/endpoints.go +++ b/service/lexmodelsv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexmodelsv2/generated.json b/service/lexmodelsv2/generated.json index 65dbf90d6a7..44c97652c08 100644 --- a/service/lexmodelsv2/generated.json +++ b/service/lexmodelsv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexmodelsv2/go.mod b/service/lexmodelsv2/go.mod index ddb8dee5f76..7bd5d969216 100644 --- a/service/lexmodelsv2/go.mod +++ b/service/lexmodelsv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexmodelsv2/internal/endpoints/endpoints.go b/service/lexmodelsv2/internal/endpoints/endpoints.go index 4d3739e44db..1c6da0b7c97 100644 --- a/service/lexmodelsv2/internal/endpoints/endpoints.go +++ b/service/lexmodelsv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lex Models V2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,18 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models-v2-lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -80,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models-v2-lex.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "models-v2-lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/lexruntimeservice/api_client.go b/service/lexruntimeservice/api_client.go index 558cc1ed513..68d49f65072 100644 --- a/service/lexruntimeservice/api_client.go +++ b/service/lexruntimeservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lexruntimeservice/endpoints.go b/service/lexruntimeservice/endpoints.go index 942a3d670db..caf15c79861 100644 --- a/service/lexruntimeservice/endpoints.go +++ b/service/lexruntimeservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexruntimeservice/generated.json b/service/lexruntimeservice/generated.json index 298b50456e2..343418b925e 100644 --- a/service/lexruntimeservice/generated.json +++ b/service/lexruntimeservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexruntimeservice/go.mod b/service/lexruntimeservice/go.mod index e88469a5ba8..2c8478a69ac 100644 --- a/service/lexruntimeservice/go.mod +++ b/service/lexruntimeservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexruntimeservice/internal/endpoints/endpoints.go b/service/lexruntimeservice/internal/endpoints/endpoints.go index 15a55ffffdf..ad471243cac 100644 --- a/service/lexruntimeservice/internal/endpoints/endpoints.go +++ b/service/lexruntimeservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lex Runtime Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -95,6 +122,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.lex.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -128,6 +160,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lexruntimev2/api_client.go b/service/lexruntimev2/api_client.go index 4de52f55f7c..4fb6265b529 100644 --- a/service/lexruntimev2/api_client.go +++ b/service/lexruntimev2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lexruntimev2/endpoints.go b/service/lexruntimev2/endpoints.go index 967ff488afa..6ad97884234 100644 --- a/service/lexruntimev2/endpoints.go +++ b/service/lexruntimev2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexruntimev2/generated.json b/service/lexruntimev2/generated.json index 74c19945835..b5866332450 100644 --- a/service/lexruntimev2/generated.json +++ b/service/lexruntimev2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexruntimev2/go.mod b/service/lexruntimev2/go.mod index 0351400deb5..41ceebc7b6e 100644 --- a/service/lexruntimev2/go.mod +++ b/service/lexruntimev2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexruntimev2/internal/endpoints/endpoints.go b/service/lexruntimev2/internal/endpoints/endpoints.go index b930e3dfdcf..39c30cb3dca 100644 --- a/service/lexruntimev2/internal/endpoints/endpoints.go +++ b/service/lexruntimev2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lex Runtime V2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,18 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime-v2-lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -80,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime-v2-lex.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime-v2-lex.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/licensemanager/api_client.go b/service/licensemanager/api_client.go index 1f5c4eecc48..0e1c0038f7e 100644 --- a/service/licensemanager/api_client.go +++ b/service/licensemanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/licensemanager/endpoints.go b/service/licensemanager/endpoints.go index f577230d86b..a6f7c0d6ccd 100644 --- a/service/licensemanager/endpoints.go +++ b/service/licensemanager/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/licensemanager/generated.json b/service/licensemanager/generated.json index 7dff800cb4f..c9bde428b64 100644 --- a/service/licensemanager/generated.json +++ b/service/licensemanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/licensemanager/go.mod b/service/licensemanager/go.mod index 8ad209d30ac..f43b27d484a 100644 --- a/service/licensemanager/go.mod +++ b/service/licensemanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/licensemanager/internal/endpoints/endpoints.go b/service/licensemanager/internal/endpoints/endpoints.go index 895b71d2009..46b2bbc23b0 100644 --- a/service/licensemanager/internal/endpoints/endpoints.go +++ b/service/licensemanager/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver License Manager endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "license-manager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -67,6 +94,7 @@ var defaultPartitions = endpoints.Partitions{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -116,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "license-manager.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -153,6 +186,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "license-manager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/lightsail/api_client.go b/service/lightsail/api_client.go index 026d76d0f00..a85c001ddc4 100644 --- a/service/lightsail/api_client.go +++ b/service/lightsail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lightsail/endpoints.go b/service/lightsail/endpoints.go index 77542217ad8..e093409e4fc 100644 --- a/service/lightsail/endpoints.go +++ b/service/lightsail/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lightsail/generated.json b/service/lightsail/generated.json index 0c59627cbef..4a3267f2fb2 100644 --- a/service/lightsail/generated.json +++ b/service/lightsail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lightsail/go.mod b/service/lightsail/go.mod index 59eadde8aec..17a1985669e 100644 --- a/service/lightsail/go.mod +++ b/service/lightsail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lightsail/internal/endpoints/endpoints.go b/service/lightsail/internal/endpoints/endpoints.go index 010c5e44540..6979fe4816a 100644 --- a/service/lightsail/internal/endpoints/endpoints.go +++ b/service/lightsail/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Lightsail endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lightsail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lightsail.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lightsail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/location/api_client.go b/service/location/api_client.go index 7a953f85c8d..d6d818453d5 100644 --- a/service/location/api_client.go +++ b/service/location/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/location/endpoints.go b/service/location/endpoints.go index f75f80c824e..1e21bb3688b 100644 --- a/service/location/endpoints.go +++ b/service/location/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/location/generated.json b/service/location/generated.json index b32b5495c13..0b2e397e379 100644 --- a/service/location/generated.json +++ b/service/location/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/location/go.mod b/service/location/go.mod index ac747d45d01..56e3d535b3f 100644 --- a/service/location/go.mod +++ b/service/location/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/location/internal/endpoints/endpoints.go b/service/location/internal/endpoints/endpoints.go index 81ac632797e..eb9c4142e61 100644 --- a/service/location/internal/endpoints/endpoints.go +++ b/service/location/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Location endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "geo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "geo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "geo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/lookoutequipment/api_client.go b/service/lookoutequipment/api_client.go index d4e3ee8e228..d4da7bc4e30 100644 --- a/service/lookoutequipment/api_client.go +++ b/service/lookoutequipment/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/lookoutequipment/endpoints.go b/service/lookoutequipment/endpoints.go index 3116d8e84df..b9c19755a18 100644 --- a/service/lookoutequipment/endpoints.go +++ b/service/lookoutequipment/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutequipment/generated.json b/service/lookoutequipment/generated.json index 2a6b4245343..c1526a70dc8 100644 --- a/service/lookoutequipment/generated.json +++ b/service/lookoutequipment/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutequipment/go.mod b/service/lookoutequipment/go.mod index e735a7719d9..79dc805e8b9 100644 --- a/service/lookoutequipment/go.mod +++ b/service/lookoutequipment/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutequipment/internal/endpoints/endpoints.go b/service/lookoutequipment/internal/endpoints/endpoints.go index 6595ece909b..91f50296a89 100644 --- a/service/lookoutequipment/internal/endpoints/endpoints.go +++ b/service/lookoutequipment/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver LookoutEquipment endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,8 +82,18 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutequipment.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "ap-northeast-2": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{}, + "us-east-1": endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -70,6 +102,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutequipment.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +137,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutequipment.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/lookoutmetrics/api_client.go b/service/lookoutmetrics/api_client.go index ba92391445e..59d64f09583 100644 --- a/service/lookoutmetrics/api_client.go +++ b/service/lookoutmetrics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/lookoutmetrics/endpoints.go b/service/lookoutmetrics/endpoints.go index 756f78d1bac..73ff7cf1018 100644 --- a/service/lookoutmetrics/endpoints.go +++ b/service/lookoutmetrics/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutmetrics/generated.json b/service/lookoutmetrics/generated.json index a89de82639d..980cff2a3f1 100644 --- a/service/lookoutmetrics/generated.json +++ b/service/lookoutmetrics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutmetrics/go.mod b/service/lookoutmetrics/go.mod index ea3184ee6a9..de8b50e41a1 100644 --- a/service/lookoutmetrics/go.mod +++ b/service/lookoutmetrics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutmetrics/internal/endpoints/endpoints.go b/service/lookoutmetrics/internal/endpoints/endpoints.go index 53fc0cbf118..bd7450b8ed5 100644 --- a/service/lookoutmetrics/internal/endpoints/endpoints.go +++ b/service/lookoutmetrics/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver LookoutMetrics endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,19 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutmetrics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -81,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutmetrics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutmetrics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/lookoutvision/api_client.go b/service/lookoutvision/api_client.go index fd7e3762540..85617e923b0 100644 --- a/service/lookoutvision/api_client.go +++ b/service/lookoutvision/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/lookoutvision/endpoints.go b/service/lookoutvision/endpoints.go index acdb5feba77..0b222973f45 100644 --- a/service/lookoutvision/endpoints.go +++ b/service/lookoutvision/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutvision/generated.json b/service/lookoutvision/generated.json index c4288f27725..285c3b4bf30 100644 --- a/service/lookoutvision/generated.json +++ b/service/lookoutvision/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutvision/go.mod b/service/lookoutvision/go.mod index d872abe7e63..f657dbb1186 100644 --- a/service/lookoutvision/go.mod +++ b/service/lookoutvision/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutvision/internal/endpoints/endpoints.go b/service/lookoutvision/internal/endpoints/endpoints.go index f3df5b518df..656be46f3fe 100644 --- a/service/lookoutvision/internal/endpoints/endpoints.go +++ b/service/lookoutvision/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver LookoutVision endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutvision.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutvision.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "lookoutvision.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/machinelearning/api_client.go b/service/machinelearning/api_client.go index 48dd27ae0ae..2537d61c63f 100644 --- a/service/machinelearning/api_client.go +++ b/service/machinelearning/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/machinelearning/endpoints.go b/service/machinelearning/endpoints.go index dd51a6f5c2a..5c4fad0c5ee 100644 --- a/service/machinelearning/endpoints.go +++ b/service/machinelearning/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/machinelearning/generated.json b/service/machinelearning/generated.json index a22823af703..64abe043ac5 100644 --- a/service/machinelearning/generated.json +++ b/service/machinelearning/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/machinelearning/go.mod b/service/machinelearning/go.mod index f059818c131..59ed1c753ce 100644 --- a/service/machinelearning/go.mod +++ b/service/machinelearning/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/machinelearning/internal/endpoints/endpoints.go b/service/machinelearning/internal/endpoints/endpoints.go index 7dfc51e9d2d..5a6b357413c 100644 --- a/service/machinelearning/internal/endpoints/endpoints.go +++ b/service/machinelearning/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Machine Learning endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "machinelearning.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -74,6 +101,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "machinelearning.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -104,6 +136,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "machinelearning.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/macie/api_client.go b/service/macie/api_client.go index b428c82f69d..0f94cfbf610 100644 --- a/service/macie/api_client.go +++ b/service/macie/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/macie/endpoints.go b/service/macie/endpoints.go index 6d99ba2d1fd..4da5b616308 100644 --- a/service/macie/endpoints.go +++ b/service/macie/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/macie/generated.json b/service/macie/generated.json index ec36319474e..6570c47e3b6 100644 --- a/service/macie/generated.json +++ b/service/macie/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/macie/go.mod b/service/macie/go.mod index 404dff345da..2ad648f809c 100644 --- a/service/macie/go.mod +++ b/service/macie/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/macie/internal/endpoints/endpoints.go b/service/macie/internal/endpoints/endpoints.go index 89d8390f0b2..00a8cd6020f 100644 --- a/service/macie/internal/endpoints/endpoints.go +++ b/service/macie/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Macie endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -86,6 +113,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -116,6 +148,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/macie2/api_client.go b/service/macie2/api_client.go index 776415b15fd..c9c998f4db0 100644 --- a/service/macie2/api_client.go +++ b/service/macie2/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/macie2/endpoints.go b/service/macie2/endpoints.go index 50d92d76582..474a8643e98 100644 --- a/service/macie2/endpoints.go +++ b/service/macie2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/macie2/generated.json b/service/macie2/generated.json index c88b52f8b83..8ddbc31c34c 100644 --- a/service/macie2/generated.json +++ b/service/macie2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/macie2/go.mod b/service/macie2/go.mod index dc7cd36ad88..42cdf1bf8b1 100644 --- a/service/macie2/go.mod +++ b/service/macie2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/macie2/internal/endpoints/endpoints.go b/service/macie2/internal/endpoints/endpoints.go index 553553e3edd..00cf7e135c8 100644 --- a/service/macie2/internal/endpoints/endpoints.go +++ b/service/macie2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Macie2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -67,6 +94,7 @@ var defaultPartitions = endpoints.Partitions{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -116,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -146,6 +179,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "macie2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/managedblockchain/api_client.go b/service/managedblockchain/api_client.go index 1456a2704c0..b6c8cd430a5 100644 --- a/service/managedblockchain/api_client.go +++ b/service/managedblockchain/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/managedblockchain/endpoints.go b/service/managedblockchain/endpoints.go index 5a303e4bb23..92204518469 100644 --- a/service/managedblockchain/endpoints.go +++ b/service/managedblockchain/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/managedblockchain/generated.json b/service/managedblockchain/generated.json index 417e0bac934..8e08dc5f804 100644 --- a/service/managedblockchain/generated.json +++ b/service/managedblockchain/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/managedblockchain/go.mod b/service/managedblockchain/go.mod index 7ab4eafd6ae..e5d69ecb7ef 100644 --- a/service/managedblockchain/go.mod +++ b/service/managedblockchain/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/managedblockchain/internal/endpoints/endpoints.go b/service/managedblockchain/internal/endpoints/endpoints.go index 9216f883677..f9971b0cc2c 100644 --- a/service/managedblockchain/internal/endpoints/endpoints.go +++ b/service/managedblockchain/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ManagedBlockchain endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "managedblockchain.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,6 +105,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "managedblockchain.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +140,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "managedblockchain.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/marketplacecatalog/api_client.go b/service/marketplacecatalog/api_client.go index 68c8cd54347..c83b18f54fb 100644 --- a/service/marketplacecatalog/api_client.go +++ b/service/marketplacecatalog/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/marketplacecatalog/endpoints.go b/service/marketplacecatalog/endpoints.go index f38716d94a2..468684f86d7 100644 --- a/service/marketplacecatalog/endpoints.go +++ b/service/marketplacecatalog/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacecatalog/generated.json b/service/marketplacecatalog/generated.json index a8d56693521..aac77d886c8 100644 --- a/service/marketplacecatalog/generated.json +++ b/service/marketplacecatalog/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacecatalog/go.mod b/service/marketplacecatalog/go.mod index ff0e68913e0..5342f6e92be 100644 --- a/service/marketplacecatalog/go.mod +++ b/service/marketplacecatalog/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacecatalog/internal/endpoints/endpoints.go b/service/marketplacecatalog/internal/endpoints/endpoints.go index 8d51a4eaee9..4122744271f 100644 --- a/service/marketplacecatalog/internal/endpoints/endpoints.go +++ b/service/marketplacecatalog/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Marketplace Catalog endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "catalog.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "catalog.marketplace.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "catalog.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/marketplacecommerceanalytics/api_client.go b/service/marketplacecommerceanalytics/api_client.go index 1b5b79f9dcf..af1ba08532c 100644 --- a/service/marketplacecommerceanalytics/api_client.go +++ b/service/marketplacecommerceanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/marketplacecommerceanalytics/endpoints.go b/service/marketplacecommerceanalytics/endpoints.go index 36499106d4e..4d9a36382b1 100644 --- a/service/marketplacecommerceanalytics/endpoints.go +++ b/service/marketplacecommerceanalytics/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacecommerceanalytics/generated.json b/service/marketplacecommerceanalytics/generated.json index b0945e72809..3fb534e20b9 100644 --- a/service/marketplacecommerceanalytics/generated.json +++ b/service/marketplacecommerceanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacecommerceanalytics/go.mod b/service/marketplacecommerceanalytics/go.mod index 27e0a827c86..64e4b0cd3ec 100644 --- a/service/marketplacecommerceanalytics/go.mod +++ b/service/marketplacecommerceanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go b/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go index 8fffb4814dd..406b7f0357f 100644 --- a/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go +++ b/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Marketplace Commerce Analytics endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "marketplacecommerceanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "marketplacecommerceanalytics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "marketplacecommerceanalytics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/marketplaceentitlementservice/api_client.go b/service/marketplaceentitlementservice/api_client.go index 89abad81e8e..cad623385d1 100644 --- a/service/marketplaceentitlementservice/api_client.go +++ b/service/marketplaceentitlementservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/marketplaceentitlementservice/endpoints.go b/service/marketplaceentitlementservice/endpoints.go index c620de159df..e450fb275af 100644 --- a/service/marketplaceentitlementservice/endpoints.go +++ b/service/marketplaceentitlementservice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplaceentitlementservice/generated.json b/service/marketplaceentitlementservice/generated.json index 15028f5089d..7edcd9d4e0d 100644 --- a/service/marketplaceentitlementservice/generated.json +++ b/service/marketplaceentitlementservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplaceentitlementservice/go.mod b/service/marketplaceentitlementservice/go.mod index ac6b0650b25..c272cc5d8de 100644 --- a/service/marketplaceentitlementservice/go.mod +++ b/service/marketplaceentitlementservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplaceentitlementservice/internal/endpoints/endpoints.go b/service/marketplaceentitlementservice/internal/endpoints/endpoints.go index 007da1b6d0d..3bc2191fad9 100644 --- a/service/marketplaceentitlementservice/internal/endpoints/endpoints.go +++ b/service/marketplaceentitlementservice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Marketplace Entitlement Service endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "entitlement.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -76,6 +103,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "entitlement.marketplace.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -106,6 +138,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "entitlement.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/marketplacemetering/api_client.go b/service/marketplacemetering/api_client.go index b9b04281f3b..97de4a27d10 100644 --- a/service/marketplacemetering/api_client.go +++ b/service/marketplacemetering/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/marketplacemetering/endpoints.go b/service/marketplacemetering/endpoints.go index 647085eff1d..ca8978b2972 100644 --- a/service/marketplacemetering/endpoints.go +++ b/service/marketplacemetering/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacemetering/generated.json b/service/marketplacemetering/generated.json index 565573a4f91..6eac8ea9727 100644 --- a/service/marketplacemetering/generated.json +++ b/service/marketplacemetering/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacemetering/go.mod b/service/marketplacemetering/go.mod index 41622b20035..06a30cfd79d 100644 --- a/service/marketplacemetering/go.mod +++ b/service/marketplacemetering/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacemetering/internal/endpoints/endpoints.go b/service/marketplacemetering/internal/endpoints/endpoints.go index 5df4103fe5b..0d32cd39912 100644 --- a/service/marketplacemetering/internal/endpoints/endpoints.go +++ b/service/marketplacemetering/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Marketplace Metering endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "metering.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -96,6 +123,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "metering.marketplace.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -129,6 +161,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "metering.marketplace.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/mediaconnect/api_client.go b/service/mediaconnect/api_client.go index e1434ed562a..7ee67d2e8e7 100644 --- a/service/mediaconnect/api_client.go +++ b/service/mediaconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediaconnect/endpoints.go b/service/mediaconnect/endpoints.go index 14c4325577d..836bd5be9ae 100644 --- a/service/mediaconnect/endpoints.go +++ b/service/mediaconnect/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediaconnect/generated.json b/service/mediaconnect/generated.json index 90ad1b7bcb0..c1b4677db1d 100644 --- a/service/mediaconnect/generated.json +++ b/service/mediaconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/mediaconnect/go.mod b/service/mediaconnect/go.mod index a17695ae19d..4c34f4d08f2 100644 --- a/service/mediaconnect/go.mod +++ b/service/mediaconnect/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediaconnect/internal/endpoints/endpoints.go b/service/mediaconnect/internal/endpoints/endpoints.go index 296ecb97daa..8fe21112b04 100644 --- a/service/mediaconnect/internal/endpoints/endpoints.go +++ b/service/mediaconnect/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaConnect endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconnect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -88,6 +115,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconnect.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -118,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconnect.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediaconvert/api_client.go b/service/mediaconvert/api_client.go index ccd3be29949..d3466f1fa4c 100644 --- a/service/mediaconvert/api_client.go +++ b/service/mediaconvert/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/mediaconvert/endpoints.go b/service/mediaconvert/endpoints.go index 0fe377f73c3..55409d4492b 100644 --- a/service/mediaconvert/endpoints.go +++ b/service/mediaconvert/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediaconvert/generated.json b/service/mediaconvert/generated.json index f1494109352..6265cf4ffd4 100644 --- a/service/mediaconvert/generated.json +++ b/service/mediaconvert/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediaconvert/go.mod b/service/mediaconvert/go.mod index 5533354e220..4c39da5f607 100644 --- a/service/mediaconvert/go.mod +++ b/service/mediaconvert/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediaconvert/internal/endpoints/endpoints.go b/service/mediaconvert/internal/endpoints/endpoints.go index 18e7a53eb87..d5da1b85187 100644 --- a/service/mediaconvert/internal/endpoints/endpoints.go +++ b/service/mediaconvert/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaConvert endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconvert.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -118,6 +145,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconvert.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -156,6 +188,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediaconvert.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/medialive/api_client.go b/service/medialive/api_client.go index 90d4e86037d..ca2dcfe575c 100644 --- a/service/medialive/api_client.go +++ b/service/medialive/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/medialive/endpoints.go b/service/medialive/endpoints.go index 5b48f66c4d1..5bd0bd88603 100644 --- a/service/medialive/endpoints.go +++ b/service/medialive/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/medialive/generated.json b/service/medialive/generated.json index 93a735dfe01..3acc21a0b06 100644 --- a/service/medialive/generated.json +++ b/service/medialive/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/medialive/go.mod b/service/medialive/go.mod index b510dedbab1..ab35a7d2cd4 100644 --- a/service/medialive/go.mod +++ b/service/medialive/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/medialive/internal/endpoints/endpoints.go b/service/medialive/internal/endpoints/endpoints.go index a0ac5f8dd3d..d529a9354bc 100644 --- a/service/medialive/internal/endpoints/endpoints.go +++ b/service/medialive/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaLive endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "medialive.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -104,6 +131,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "medialive.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -137,6 +169,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "medialive.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediapackage/api_client.go b/service/mediapackage/api_client.go index 67b70f8e12a..c5b62e9eb04 100644 --- a/service/mediapackage/api_client.go +++ b/service/mediapackage/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediapackage/endpoints.go b/service/mediapackage/endpoints.go index 83640ec249f..e79cded0e3f 100644 --- a/service/mediapackage/endpoints.go +++ b/service/mediapackage/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediapackage/generated.json b/service/mediapackage/generated.json index 5c27ee70ede..37c504844af 100644 --- a/service/mediapackage/generated.json +++ b/service/mediapackage/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediapackage/go.mod b/service/mediapackage/go.mod index 995e82c0cd9..619537a877b 100644 --- a/service/mediapackage/go.mod +++ b/service/mediapackage/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediapackage/internal/endpoints/endpoints.go b/service/mediapackage/internal/endpoints/endpoints.go index ca323280777..9d0f86dd283 100644 --- a/service/mediapackage/internal/endpoints/endpoints.go +++ b/service/mediapackage/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaPackage endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -86,6 +113,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -119,6 +151,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediapackagevod/api_client.go b/service/mediapackagevod/api_client.go index a267880f91a..0e868622169 100644 --- a/service/mediapackagevod/api_client.go +++ b/service/mediapackagevod/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediapackagevod/endpoints.go b/service/mediapackagevod/endpoints.go index 5d232c8e0ac..96a84e145bb 100644 --- a/service/mediapackagevod/endpoints.go +++ b/service/mediapackagevod/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediapackagevod/generated.json b/service/mediapackagevod/generated.json index 442b95d2117..c065078455d 100644 --- a/service/mediapackagevod/generated.json +++ b/service/mediapackagevod/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediapackagevod/go.mod b/service/mediapackagevod/go.mod index dabd3f4d91b..5fd58b27e9d 100644 --- a/service/mediapackagevod/go.mod +++ b/service/mediapackagevod/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediapackagevod/internal/endpoints/endpoints.go b/service/mediapackagevod/internal/endpoints/endpoints.go index fb116621932..b50347a272d 100644 --- a/service/mediapackagevod/internal/endpoints/endpoints.go +++ b/service/mediapackagevod/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaPackage Vod endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,24 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage-vod.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -86,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage-vod.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -116,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediapackage-vod.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediastore/api_client.go b/service/mediastore/api_client.go index 34459e88f32..05ecde25242 100644 --- a/service/mediastore/api_client.go +++ b/service/mediastore/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediastore/endpoints.go b/service/mediastore/endpoints.go index ee86f149aaa..1a3a9a160e9 100644 --- a/service/mediastore/endpoints.go +++ b/service/mediastore/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediastore/generated.json b/service/mediastore/generated.json index 618df3401fb..4c31deca49a 100644 --- a/service/mediastore/generated.json +++ b/service/mediastore/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediastore/go.mod b/service/mediastore/go.mod index b7d69729bde..f532a375139 100644 --- a/service/mediastore/go.mod +++ b/service/mediastore/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediastore/internal/endpoints/endpoints.go b/service/mediastore/internal/endpoints/endpoints.go index f4fb203ee37..52044dfea6e 100644 --- a/service/mediastore/internal/endpoints/endpoints.go +++ b/service/mediastore/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaStore endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediastore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediastore.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mediastore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediastoredata/api_client.go b/service/mediastoredata/api_client.go index 0fd3d515039..7ad1fef4da0 100644 --- a/service/mediastoredata/api_client.go +++ b/service/mediastoredata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediastoredata/endpoints.go b/service/mediastoredata/endpoints.go index 97c30f0268e..45573ebdc61 100644 --- a/service/mediastoredata/endpoints.go +++ b/service/mediastoredata/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediastoredata/generated.json b/service/mediastoredata/generated.json index f5e9af55316..da20ac64c4c 100644 --- a/service/mediastoredata/generated.json +++ b/service/mediastoredata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediastoredata/go.mod b/service/mediastoredata/go.mod index 616caaf35ea..b2f1b762e04 100644 --- a/service/mediastoredata/go.mod +++ b/service/mediastoredata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediastoredata/internal/endpoints/endpoints.go b/service/mediastoredata/internal/endpoints/endpoints.go index 83b5502f3bf..e040a77bdf7 100644 --- a/service/mediastoredata/internal/endpoints/endpoints.go +++ b/service/mediastoredata/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaStore Data endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.mediastore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.mediastore.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "data.mediastore.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mediatailor/api_client.go b/service/mediatailor/api_client.go index 4ef683e6bbf..0d0884800eb 100644 --- a/service/mediatailor/api_client.go +++ b/service/mediatailor/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mediatailor/endpoints.go b/service/mediatailor/endpoints.go index eef136742bd..0716d46c351 100644 --- a/service/mediatailor/endpoints.go +++ b/service/mediatailor/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediatailor/generated.json b/service/mediatailor/generated.json index 27dc0fdce1e..651d32fb441 100644 --- a/service/mediatailor/generated.json +++ b/service/mediatailor/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediatailor/go.mod b/service/mediatailor/go.mod index d3d8d9e2524..c5968fcd659 100644 --- a/service/mediatailor/go.mod +++ b/service/mediatailor/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediatailor/internal/endpoints/endpoints.go b/service/mediatailor/internal/endpoints/endpoints.go index e6c6fe689b1..7555fe78b96 100644 --- a/service/mediatailor/internal/endpoints/endpoints.go +++ b/service/mediatailor/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MediaTailor endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.mediatailor.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.mediatailor.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.mediatailor.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mgn/api_client.go b/service/mgn/api_client.go index 66e2783a25b..70e81015d93 100644 --- a/service/mgn/api_client.go +++ b/service/mgn/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mgn/endpoints.go b/service/mgn/endpoints.go index e28d94d5ac0..91ed69c732a 100644 --- a/service/mgn/endpoints.go +++ b/service/mgn/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mgn/generated.json b/service/mgn/generated.json index aad2ee7f800..0bc3fd249f2 100644 --- a/service/mgn/generated.json +++ b/service/mgn/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mgn/go.mod b/service/mgn/go.mod index 7f9813cc410..4d12e6bde3e 100644 --- a/service/mgn/go.mod +++ b/service/mgn/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mgn/internal/endpoints/endpoints.go b/service/mgn/internal/endpoints/endpoints.go index bc32865c8f0..e18df10f7ed 100644 --- a/service/mgn/internal/endpoints/endpoints.go +++ b/service/mgn/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver mgn endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgn.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgn.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgn.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/migrationhub/api_client.go b/service/migrationhub/api_client.go index 0f3a254120b..93bc651ad2c 100644 --- a/service/migrationhub/api_client.go +++ b/service/migrationhub/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/migrationhub/endpoints.go b/service/migrationhub/endpoints.go index 523b7f164e9..5975479b3ad 100644 --- a/service/migrationhub/endpoints.go +++ b/service/migrationhub/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/migrationhub/generated.json b/service/migrationhub/generated.json index a33ec8648a4..21bb1ef4ae6 100644 --- a/service/migrationhub/generated.json +++ b/service/migrationhub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/migrationhub/go.mod b/service/migrationhub/go.mod index e63066ef9fa..a7fe15dfd73 100644 --- a/service/migrationhub/go.mod +++ b/service/migrationhub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/migrationhub/internal/endpoints/endpoints.go b/service/migrationhub/internal/endpoints/endpoints.go index d2534d4783f..19b9cdd5f2b 100644 --- a/service/migrationhub/internal/endpoints/endpoints.go +++ b/service/migrationhub/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Migration Hub endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgh.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgh.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mgh.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/migrationhubconfig/api_client.go b/service/migrationhubconfig/api_client.go index 41cb04e4a9c..5047ea97be3 100644 --- a/service/migrationhubconfig/api_client.go +++ b/service/migrationhubconfig/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/migrationhubconfig/endpoints.go b/service/migrationhubconfig/endpoints.go index e0d5df49c97..3c881066c85 100644 --- a/service/migrationhubconfig/endpoints.go +++ b/service/migrationhubconfig/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/migrationhubconfig/generated.json b/service/migrationhubconfig/generated.json index 59af0235b68..910d7834ba8 100644 --- a/service/migrationhubconfig/generated.json +++ b/service/migrationhubconfig/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/migrationhubconfig/go.mod b/service/migrationhubconfig/go.mod index 2ead4bdcc0d..815368f58ea 100644 --- a/service/migrationhubconfig/go.mod +++ b/service/migrationhubconfig/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/migrationhubconfig/internal/endpoints/endpoints.go b/service/migrationhubconfig/internal/endpoints/endpoints.go index 9bcc85bf5bb..a4bc62ee374 100644 --- a/service/migrationhubconfig/internal/endpoints/endpoints.go +++ b/service/migrationhubconfig/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MigrationHub Config endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "migrationhub-config.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "migrationhub-config.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "migrationhub-config.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mobile/api_client.go b/service/mobile/api_client.go index 82e0d214060..fe0b792b9d8 100644 --- a/service/mobile/api_client.go +++ b/service/mobile/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mobile/endpoints.go b/service/mobile/endpoints.go index 880d821ee05..ab8007783e6 100644 --- a/service/mobile/endpoints.go +++ b/service/mobile/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mobile/generated.json b/service/mobile/generated.json index f6de86f03f1..9a47f92d0c3 100644 --- a/service/mobile/generated.json +++ b/service/mobile/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mobile/go.mod b/service/mobile/go.mod index 8ff2ab12305..02487d0ed5e 100644 --- a/service/mobile/go.mod +++ b/service/mobile/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mobile/internal/endpoints/endpoints.go b/service/mobile/internal/endpoints/endpoints.go index 5fbf4b81c0a..aa229099f6f 100644 --- a/service/mobile/internal/endpoints/endpoints.go +++ b/service/mobile/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Mobile endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mobile.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mobile.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mobile.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mq/api_client.go b/service/mq/api_client.go index 2ffdc2eb198..19cc0d60708 100644 --- a/service/mq/api_client.go +++ b/service/mq/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/mq/endpoints.go b/service/mq/endpoints.go index 61a203ea956..878e9be1387 100644 --- a/service/mq/endpoints.go +++ b/service/mq/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mq/generated.json b/service/mq/generated.json index e795b918034..2f7837e4e6c 100644 --- a/service/mq/generated.json +++ b/service/mq/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mq/go.mod b/service/mq/go.mod index ce2a6b3d699..3da12351f33 100644 --- a/service/mq/go.mod +++ b/service/mq/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mq/internal/endpoints/endpoints.go b/service/mq/internal/endpoints/endpoints.go index a1e0f7df4d7..d674f9a5836 100644 --- a/service/mq/internal/endpoints/endpoints.go +++ b/service/mq/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver mq endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mq.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,8 +143,17 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mq.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, }, { ID: "aws-iso", @@ -146,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mq.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mturk/api_client.go b/service/mturk/api_client.go index 42f51781388..cdeb2835149 100644 --- a/service/mturk/api_client.go +++ b/service/mturk/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mturk/endpoints.go b/service/mturk/endpoints.go index 510594188aa..ec477abe8d9 100644 --- a/service/mturk/endpoints.go +++ b/service/mturk/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mturk/generated.json b/service/mturk/generated.json index d23e3faaaa3..c64556f0728 100644 --- a/service/mturk/generated.json +++ b/service/mturk/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mturk/go.mod b/service/mturk/go.mod index 2e48748b773..07bcb2393f6 100644 --- a/service/mturk/go.mod +++ b/service/mturk/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mturk/internal/endpoints/endpoints.go b/service/mturk/internal/endpoints/endpoints.go index 4b84852bbac..95c59b95396 100644 --- a/service/mturk/internal/endpoints/endpoints.go +++ b/service/mturk/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MTurk endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mturk-requester.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -76,6 +103,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mturk-requester.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -106,6 +138,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "mturk-requester.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/mwaa/api_client.go b/service/mwaa/api_client.go index 987a9f748a0..c123b8fdc94 100644 --- a/service/mwaa/api_client.go +++ b/service/mwaa/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/mwaa/endpoints.go b/service/mwaa/endpoints.go index d1ee46e9126..8a5af0e50dd 100644 --- a/service/mwaa/endpoints.go +++ b/service/mwaa/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mwaa/generated.json b/service/mwaa/generated.json index e5dde20fa31..d97f6e8f5ab 100644 --- a/service/mwaa/generated.json +++ b/service/mwaa/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mwaa/go.mod b/service/mwaa/go.mod index f127a79f63c..8e9c7d69ab3 100644 --- a/service/mwaa/go.mod +++ b/service/mwaa/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mwaa/internal/endpoints/endpoints.go b/service/mwaa/internal/endpoints/endpoints.go index efa4b598a31..c225b6aaac9 100644 --- a/service/mwaa/internal/endpoints/endpoints.go +++ b/service/mwaa/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver MWAA endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "airflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "airflow.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "airflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/neptune/api_client.go b/service/neptune/api_client.go index 061cb4b521c..f50d7189aea 100644 --- a/service/neptune/api_client.go +++ b/service/neptune/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/neptune/endpoints.go b/service/neptune/endpoints.go index b6476a55854..d12c3d82347 100644 --- a/service/neptune/endpoints.go +++ b/service/neptune/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/neptune/generated.json b/service/neptune/generated.json index 06aa894495e..63808f79be3 100644 --- a/service/neptune/generated.json +++ b/service/neptune/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/neptune/go.mod b/service/neptune/go.mod index 1b402c7f482..f508563cf46 100644 --- a/service/neptune/go.mod +++ b/service/neptune/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/neptune/internal/endpoints/endpoints.go b/service/neptune/internal/endpoints/endpoints.go index 251990fe9c6..6fefa928584 100644 --- a/service/neptune/internal/endpoints/endpoints.go +++ b/service/neptune/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Neptune endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/networkfirewall/api_client.go b/service/networkfirewall/api_client.go index 1d9be599d21..39a33a19f09 100644 --- a/service/networkfirewall/api_client.go +++ b/service/networkfirewall/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/networkfirewall/endpoints.go b/service/networkfirewall/endpoints.go index d7c961672fd..6aae5342457 100644 --- a/service/networkfirewall/endpoints.go +++ b/service/networkfirewall/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/networkfirewall/generated.json b/service/networkfirewall/generated.json index 1f0588e82a9..d98e74f6047 100644 --- a/service/networkfirewall/generated.json +++ b/service/networkfirewall/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/networkfirewall/go.mod b/service/networkfirewall/go.mod index 1bef4e591ff..ebf7cca579b 100644 --- a/service/networkfirewall/go.mod +++ b/service/networkfirewall/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/networkfirewall/internal/endpoints/endpoints.go b/service/networkfirewall/internal/endpoints/endpoints.go index 035752752f9..8f242ec96b1 100644 --- a/service/networkfirewall/internal/endpoints/endpoints.go +++ b/service/networkfirewall/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Network Firewall endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,18 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "network-firewall.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -80,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "network-firewall.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -110,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "network-firewall.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/networkmanager/api_client.go b/service/networkmanager/api_client.go index 804d1587904..3aefb2201dd 100644 --- a/service/networkmanager/api_client.go +++ b/service/networkmanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/networkmanager/endpoints.go b/service/networkmanager/endpoints.go index ba55b2ff05a..77912d0f8fc 100644 --- a/service/networkmanager/endpoints.go +++ b/service/networkmanager/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/networkmanager/generated.json b/service/networkmanager/generated.json index dc387c1c24f..71ebccdcf5f 100644 --- a/service/networkmanager/generated.json +++ b/service/networkmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/networkmanager/go.mod b/service/networkmanager/go.mod index d9fae654e08..30b80c053e0 100644 --- a/service/networkmanager/go.mod +++ b/service/networkmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/networkmanager/internal/endpoints/endpoints.go b/service/networkmanager/internal/endpoints/endpoints.go index 8adc41a8e6e..94353956b22 100644 --- a/service/networkmanager/internal/endpoints/endpoints.go +++ b/service/networkmanager/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver NetworkManager endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "networkmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "networkmanager.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "networkmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/nimble/api_client.go b/service/nimble/api_client.go index 009e5d9face..746d398815e 100644 --- a/service/nimble/api_client.go +++ b/service/nimble/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/nimble/endpoints.go b/service/nimble/endpoints.go index 3b792ee5199..d77d6c434c4 100644 --- a/service/nimble/endpoints.go +++ b/service/nimble/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/nimble/generated.json b/service/nimble/generated.json index aa92859ca8d..c050f461176 100644 --- a/service/nimble/generated.json +++ b/service/nimble/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/nimble/go.mod b/service/nimble/go.mod index c95307f0ddc..257bcacfe0c 100644 --- a/service/nimble/go.mod +++ b/service/nimble/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/nimble/internal/endpoints/endpoints.go b/service/nimble/internal/endpoints/endpoints.go index 5dc378146ae..5f59132da5c 100644 --- a/service/nimble/internal/endpoints/endpoints.go +++ b/service/nimble/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver nimble endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "nimble.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "nimble.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "nimble.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/opsworks/api_client.go b/service/opsworks/api_client.go index 02796b35448..80b65a6bba0 100644 --- a/service/opsworks/api_client.go +++ b/service/opsworks/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/opsworks/endpoints.go b/service/opsworks/endpoints.go index f0eff09733b..252e6f65e48 100644 --- a/service/opsworks/endpoints.go +++ b/service/opsworks/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/opsworks/generated.json b/service/opsworks/generated.json index 10792b619ff..e0eef6121d4 100644 --- a/service/opsworks/generated.json +++ b/service/opsworks/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/opsworks/go.mod b/service/opsworks/go.mod index 37892a9fe42..455bbeb7357 100644 --- a/service/opsworks/go.mod +++ b/service/opsworks/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/opsworks/internal/endpoints/endpoints.go b/service/opsworks/internal/endpoints/endpoints.go index e691e2787c6..6e706ce2cc9 100644 --- a/service/opsworks/internal/endpoints/endpoints.go +++ b/service/opsworks/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver OpsWorks endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -87,6 +114,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -117,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/opsworkscm/api_client.go b/service/opsworkscm/api_client.go index 70690dff8ae..8edfe7f4f3a 100644 --- a/service/opsworkscm/api_client.go +++ b/service/opsworkscm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/opsworkscm/endpoints.go b/service/opsworkscm/endpoints.go index 1f52ec57d24..b45a5b5ff0e 100644 --- a/service/opsworkscm/endpoints.go +++ b/service/opsworkscm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/opsworkscm/generated.json b/service/opsworkscm/generated.json index bb85c88fc95..d7ac7d06946 100644 --- a/service/opsworkscm/generated.json +++ b/service/opsworkscm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/opsworkscm/go.mod b/service/opsworkscm/go.mod index 1416191f00d..c9ba586c04f 100644 --- a/service/opsworkscm/go.mod +++ b/service/opsworkscm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/opsworkscm/internal/endpoints/endpoints.go b/service/opsworkscm/internal/endpoints/endpoints.go index 1b4a51b68db..af3afa352e4 100644 --- a/service/opsworkscm/internal/endpoints/endpoints.go +++ b/service/opsworkscm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver OpsWorksCM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks-cm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks-cm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "opsworks-cm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/organizations/api_client.go b/service/organizations/api_client.go index c09d3beee80..c59dda14447 100644 --- a/service/organizations/api_client.go +++ b/service/organizations/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/organizations/endpoints.go b/service/organizations/endpoints.go index d59711f1fc2..5a48c433903 100644 --- a/service/organizations/endpoints.go +++ b/service/organizations/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/organizations/generated.json b/service/organizations/generated.json index 96a9fb47154..f891ac7b051 100644 --- a/service/organizations/generated.json +++ b/service/organizations/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/organizations/go.mod b/service/organizations/go.mod index b982e8019ee..244ba78505c 100644 --- a/service/organizations/go.mod +++ b/service/organizations/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/organizations/internal/endpoints/endpoints.go b/service/organizations/internal/endpoints/endpoints.go index 67d95f95858..10ba39cbe48 100644 --- a/service/organizations/internal/endpoints/endpoints.go +++ b/service/organizations/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Organizations endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "organizations.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "organizations.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -124,6 +156,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "organizations.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", diff --git a/service/outposts/api_client.go b/service/outposts/api_client.go index 8e19349022c..c11fdc3d87f 100644 --- a/service/outposts/api_client.go +++ b/service/outposts/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/outposts/endpoints.go b/service/outposts/endpoints.go index 3ceba084772..2c07a22276c 100644 --- a/service/outposts/endpoints.go +++ b/service/outposts/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/outposts/generated.json b/service/outposts/generated.json index 67234c62956..11a7d474f65 100644 --- a/service/outposts/generated.json +++ b/service/outposts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/outposts/go.mod b/service/outposts/go.mod index 952c75ecec9..f51ae9f0c7e 100644 --- a/service/outposts/go.mod +++ b/service/outposts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/outposts/internal/endpoints/endpoints.go b/service/outposts/internal/endpoints/endpoints.go index ad2b8ea5753..666a4e0b6e6 100644 --- a/service/outposts/internal/endpoints/endpoints.go +++ b/service/outposts/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Outposts endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "outposts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -122,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "outposts.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -155,6 +187,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "outposts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/personalize/api_client.go b/service/personalize/api_client.go index a244def5f26..c5b3ab8ec1c 100644 --- a/service/personalize/api_client.go +++ b/service/personalize/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/personalize/endpoints.go b/service/personalize/endpoints.go index da5ce7552af..62643caa60f 100644 --- a/service/personalize/endpoints.go +++ b/service/personalize/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalize/generated.json b/service/personalize/generated.json index c4b7c898221..d7ab014307f 100644 --- a/service/personalize/generated.json +++ b/service/personalize/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalize/go.mod b/service/personalize/go.mod index 769c6b3a446..a819a21f909 100644 --- a/service/personalize/go.mod +++ b/service/personalize/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalize/internal/endpoints/endpoints.go b/service/personalize/internal/endpoints/endpoints.go index f30f1b6b6fc..4234c492fe8 100644 --- a/service/personalize/internal/endpoints/endpoints.go +++ b/service/personalize/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Personalize endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +148,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/personalizeevents/api_client.go b/service/personalizeevents/api_client.go index e95676b7524..baafb03cc49 100644 --- a/service/personalizeevents/api_client.go +++ b/service/personalizeevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/personalizeevents/endpoints.go b/service/personalizeevents/endpoints.go index a97e5ad2d40..c27cc760ae7 100644 --- a/service/personalizeevents/endpoints.go +++ b/service/personalizeevents/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalizeevents/generated.json b/service/personalizeevents/generated.json index dfc17aaf2fb..1a9d80bbeef 100644 --- a/service/personalizeevents/generated.json +++ b/service/personalizeevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalizeevents/go.mod b/service/personalizeevents/go.mod index 4d8982c7fe0..4f5329875a6 100644 --- a/service/personalizeevents/go.mod +++ b/service/personalizeevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalizeevents/internal/endpoints/endpoints.go b/service/personalizeevents/internal/endpoints/endpoints.go index 08b014f3c73..f5434d0091b 100644 --- a/service/personalizeevents/internal/endpoints/endpoints.go +++ b/service/personalizeevents/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Personalize Events endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-events.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-events.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/personalizeruntime/api_client.go b/service/personalizeruntime/api_client.go index a36df83a963..176db9f9903 100644 --- a/service/personalizeruntime/api_client.go +++ b/service/personalizeruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/personalizeruntime/endpoints.go b/service/personalizeruntime/endpoints.go index b072368a750..3bbac92a456 100644 --- a/service/personalizeruntime/endpoints.go +++ b/service/personalizeruntime/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalizeruntime/generated.json b/service/personalizeruntime/generated.json index 7e813ddf821..7622bfcfc7a 100644 --- a/service/personalizeruntime/generated.json +++ b/service/personalizeruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalizeruntime/go.mod b/service/personalizeruntime/go.mod index 0eb9cfcd5af..f5c69634877 100644 --- a/service/personalizeruntime/go.mod +++ b/service/personalizeruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalizeruntime/internal/endpoints/endpoints.go b/service/personalizeruntime/internal/endpoints/endpoints.go index 9dac71df149..bcf0b81d2b9 100644 --- a/service/personalizeruntime/internal/endpoints/endpoints.go +++ b/service/personalizeruntime/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Personalize Runtime endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-runtime.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-runtime.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "personalize-runtime.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/pi/api_client.go b/service/pi/api_client.go index fd447a03fee..db00d310037 100644 --- a/service/pi/api_client.go +++ b/service/pi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/pi/endpoints.go b/service/pi/endpoints.go index 1726089bca0..5764e64ac94 100644 --- a/service/pi/endpoints.go +++ b/service/pi/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pi/generated.json b/service/pi/generated.json index 7b7ad72e373..fa34d3c97f5 100644 --- a/service/pi/generated.json +++ b/service/pi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pi/go.mod b/service/pi/go.mod index 39654e7c9a1..9cd51db930d 100644 --- a/service/pi/go.mod +++ b/service/pi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pi/internal/endpoints/endpoints.go b/service/pi/internal/endpoints/endpoints.go index a593cee0e50..d935a5dfc30 100644 --- a/service/pi/internal/endpoints/endpoints.go +++ b/service/pi/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver PI endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,27 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pi.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -89,12 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pi.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - "cn-northwest-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -123,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pi.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/pinpoint/api_client.go b/service/pinpoint/api_client.go index bf1af39cf7c..2875b79b36b 100644 --- a/service/pinpoint/api_client.go +++ b/service/pinpoint/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/pinpoint/endpoints.go b/service/pinpoint/endpoints.go index 70d1b1e305d..37d237255d0 100644 --- a/service/pinpoint/endpoints.go +++ b/service/pinpoint/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpoint/generated.json b/service/pinpoint/generated.json index 63e2a0c3893..b2162904b3a 100644 --- a/service/pinpoint/generated.json +++ b/service/pinpoint/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpoint/go.mod b/service/pinpoint/go.mod index 75d9fa0ce65..46e28510702 100644 --- a/service/pinpoint/go.mod +++ b/service/pinpoint/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpoint/internal/endpoints/endpoints.go b/service/pinpoint/internal/endpoints/endpoints.go index 5cd8578160a..a66119fc136 100644 --- a/service/pinpoint/internal/endpoints/endpoints.go +++ b/service/pinpoint/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Pinpoint endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "mobiletargeting", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pinpoint.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -108,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pinpoint.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -141,6 +173,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "mobiletargeting", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "pinpoint.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/pinpointemail/api_client.go b/service/pinpointemail/api_client.go index 6f42a5efdda..c1fe9961fcd 100644 --- a/service/pinpointemail/api_client.go +++ b/service/pinpointemail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/pinpointemail/endpoints.go b/service/pinpointemail/endpoints.go index fb7900eed8e..b3762c53736 100644 --- a/service/pinpointemail/endpoints.go +++ b/service/pinpointemail/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpointemail/generated.json b/service/pinpointemail/generated.json index 4eebf5dbcbe..987925652e0 100644 --- a/service/pinpointemail/generated.json +++ b/service/pinpointemail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpointemail/go.mod b/service/pinpointemail/go.mod index c69c286ad88..5b1f1604c61 100644 --- a/service/pinpointemail/go.mod +++ b/service/pinpointemail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpointemail/internal/endpoints/endpoints.go b/service/pinpointemail/internal/endpoints/endpoints.go index 0d847ce864a..c012b3c31ab 100644 --- a/service/pinpointemail/internal/endpoints/endpoints.go +++ b/service/pinpointemail/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Pinpoint Email endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,6 +105,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +140,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/pinpointsmsvoice/api_client.go b/service/pinpointsmsvoice/api_client.go index a208257b18d..cf20676226e 100644 --- a/service/pinpointsmsvoice/api_client.go +++ b/service/pinpointsmsvoice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/pinpointsmsvoice/endpoints.go b/service/pinpointsmsvoice/endpoints.go index 20fcd2d9f52..6d7fb1fb423 100644 --- a/service/pinpointsmsvoice/endpoints.go +++ b/service/pinpointsmsvoice/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpointsmsvoice/generated.json b/service/pinpointsmsvoice/generated.json index 999aebfb56f..0825fed4fec 100644 --- a/service/pinpointsmsvoice/generated.json +++ b/service/pinpointsmsvoice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpointsmsvoice/go.mod b/service/pinpointsmsvoice/go.mod index c2b179796a2..7187a58309f 100644 --- a/service/pinpointsmsvoice/go.mod +++ b/service/pinpointsmsvoice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpointsmsvoice/internal/endpoints/endpoints.go b/service/pinpointsmsvoice/internal/endpoints/endpoints.go index 7307e5e7361..cfb4dada939 100644 --- a/service/pinpointsmsvoice/internal/endpoints/endpoints.go +++ b/service/pinpointsmsvoice/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Pinpoint SMS Voice endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,16 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms-voice.pinpoint.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -78,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms-voice.pinpoint.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms-voice.pinpoint.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/polly/api_client.go b/service/polly/api_client.go index 8a60467811e..0df4bef4083 100644 --- a/service/polly/api_client.go +++ b/service/polly/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/polly/endpoints.go b/service/polly/endpoints.go index e855498f780..0ff42006950 100644 --- a/service/polly/endpoints.go +++ b/service/polly/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/polly/generated.json b/service/polly/generated.json index 2c365e27eae..de162804099 100644 --- a/service/polly/generated.json +++ b/service/polly/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/polly/go.mod b/service/polly/go.mod index 65de6f6439e..54a77aa0dd3 100644 --- a/service/polly/go.mod +++ b/service/polly/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/polly/internal/endpoints/endpoints.go b/service/polly/internal/endpoints/endpoints.go index 59605f2e7bb..2b87706e123 100644 --- a/service/polly/internal/endpoints/endpoints.go +++ b/service/polly/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Polly endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "polly.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -114,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "polly.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -147,6 +179,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "polly.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/pricing/api_client.go b/service/pricing/api_client.go index fd9d936e5bf..17cf83be1a2 100644 --- a/service/pricing/api_client.go +++ b/service/pricing/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/pricing/endpoints.go b/service/pricing/endpoints.go index 1856fc32634..d920d86e493 100644 --- a/service/pricing/endpoints.go +++ b/service/pricing/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pricing/generated.json b/service/pricing/generated.json index b96c43dcf8c..9ddd88f0a16 100644 --- a/service/pricing/generated.json +++ b/service/pricing/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pricing/go.mod b/service/pricing/go.mod index 2482b137b3b..4fbaa9f1095 100644 --- a/service/pricing/go.mod +++ b/service/pricing/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pricing/internal/endpoints/endpoints.go b/service/pricing/internal/endpoints/endpoints.go index 67a5c42f18c..ab91da3587e 100644 --- a/service/pricing/internal/endpoints/endpoints.go +++ b/service/pricing/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Pricing endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -63,6 +85,11 @@ var defaultPartitions = endpoints.Partitions{ Service: "pricing", }, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.pricing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -77,6 +104,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.pricing.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -107,6 +139,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.pricing.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/qldb/api_client.go b/service/qldb/api_client.go index d3cd8e7fff2..1b3479aad15 100644 --- a/service/qldb/api_client.go +++ b/service/qldb/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/qldb/endpoints.go b/service/qldb/endpoints.go index 2e02ea107d1..9372cbae823 100644 --- a/service/qldb/endpoints.go +++ b/service/qldb/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/qldb/generated.json b/service/qldb/generated.json index 675796f08bd..428eae56d9e 100644 --- a/service/qldb/generated.json +++ b/service/qldb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/qldb/go.mod b/service/qldb/go.mod index 6cedd84da08..39804eaae63 100644 --- a/service/qldb/go.mod +++ b/service/qldb/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/qldb/internal/endpoints/endpoints.go b/service/qldb/internal/endpoints/endpoints.go index cb8b0626515..2566b5b8775 100644 --- a/service/qldb/internal/endpoints/endpoints.go +++ b/service/qldb/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver QLDB endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "qldb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "qldb.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "qldb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/qldbsession/api_client.go b/service/qldbsession/api_client.go index 8be4cc2cab9..9e75e92f3b0 100644 --- a/service/qldbsession/api_client.go +++ b/service/qldbsession/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/qldbsession/endpoints.go b/service/qldbsession/endpoints.go index 53c7c150e90..1fe4739518b 100644 --- a/service/qldbsession/endpoints.go +++ b/service/qldbsession/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/qldbsession/generated.json b/service/qldbsession/generated.json index 83622da29d2..dc61430abf4 100644 --- a/service/qldbsession/generated.json +++ b/service/qldbsession/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/qldbsession/go.mod b/service/qldbsession/go.mod index 1d9edbaf392..23b3a721a7d 100644 --- a/service/qldbsession/go.mod +++ b/service/qldbsession/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/qldbsession/internal/endpoints/endpoints.go b/service/qldbsession/internal/endpoints/endpoints.go index 2bcc0e17553..63514bedf8b 100644 --- a/service/qldbsession/internal/endpoints/endpoints.go +++ b/service/qldbsession/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver QLDB Session endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "session.qldb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -81,6 +108,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "session.qldb.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -111,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "session.qldb.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/quicksight/api_client.go b/service/quicksight/api_client.go index be2a36ccbb3..997400c2126 100644 --- a/service/quicksight/api_client.go +++ b/service/quicksight/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/quicksight/endpoints.go b/service/quicksight/endpoints.go index 9384f8c65f2..c2987249a7b 100644 --- a/service/quicksight/endpoints.go +++ b/service/quicksight/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/quicksight/generated.json b/service/quicksight/generated.json index 336a2afc874..2c848e06911 100644 --- a/service/quicksight/generated.json +++ b/service/quicksight/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/quicksight/go.mod b/service/quicksight/go.mod index b0ebea3c9be..c462c132c38 100644 --- a/service/quicksight/go.mod +++ b/service/quicksight/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/quicksight/internal/endpoints/endpoints.go b/service/quicksight/internal/endpoints/endpoints.go index 3f60648b2e3..27f9ce5171d 100644 --- a/service/quicksight/internal/endpoints/endpoints.go +++ b/service/quicksight/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver QuickSight endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "quicksight.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "quicksight.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "quicksight.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ram/api_client.go b/service/ram/api_client.go index 5f493bfa560..9984ef1a0b2 100644 --- a/service/ram/api_client.go +++ b/service/ram/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ram/endpoints.go b/service/ram/endpoints.go index 6bc27d43863..58e1a773fc1 100644 --- a/service/ram/endpoints.go +++ b/service/ram/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ram/generated.json b/service/ram/generated.json index ac26d462937..8497c95e1e7 100644 --- a/service/ram/generated.json +++ b/service/ram/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ram/go.mod b/service/ram/go.mod index 024072c644a..b47b72a3d4b 100644 --- a/service/ram/go.mod +++ b/service/ram/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ram/internal/endpoints/endpoints.go b/service/ram/internal/endpoints/endpoints.go index 4361ab1c790..d81457263b2 100644 --- a/service/ram/internal/endpoints/endpoints.go +++ b/service/ram/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver RAM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ram.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -67,6 +94,7 @@ var defaultPartitions = endpoints.Partitions{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -122,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ram.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -156,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ram.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/rds/api_client.go b/service/rds/api_client.go index 139f82449c9..3d997b0d03a 100644 --- a/service/rds/api_client.go +++ b/service/rds/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/rds/endpoints.go b/service/rds/endpoints.go index 4ae4d0620d3..a354ea23af8 100644 --- a/service/rds/endpoints.go +++ b/service/rds/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rds/generated.json b/service/rds/generated.json index 7a7f170a2f7..f1f935c7cd0 100644 --- a/service/rds/generated.json +++ b/service/rds/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/rds/go.mod b/service/rds/go.mod index 71ba1264bb8..02d1c35f1ed 100644 --- a/service/rds/go.mod +++ b/service/rds/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/rds/internal/endpoints/endpoints.go b/service/rds/internal/endpoints/endpoints.go index 25be3541905..11b1a593330 100644 --- a/service/rds/internal/endpoints/endpoints.go +++ b/service/rds/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver RDS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/rdsdata/api_client.go b/service/rdsdata/api_client.go index 882e56713ec..def43208e33 100644 --- a/service/rdsdata/api_client.go +++ b/service/rdsdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/rdsdata/endpoints.go b/service/rdsdata/endpoints.go index 9d9318aaa6e..733b5a42a98 100644 --- a/service/rdsdata/endpoints.go +++ b/service/rdsdata/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rdsdata/generated.json b/service/rdsdata/generated.json index b4965a6fcc0..1a414285d42 100644 --- a/service/rdsdata/generated.json +++ b/service/rdsdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/rdsdata/go.mod b/service/rdsdata/go.mod index ccd7cd58045..e8a8cd999c5 100644 --- a/service/rdsdata/go.mod +++ b/service/rdsdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/rdsdata/internal/endpoints/endpoints.go b/service/rdsdata/internal/endpoints/endpoints.go index a0b7798e066..683c80095c8 100644 --- a/service/rdsdata/internal/endpoints/endpoints.go +++ b/service/rdsdata/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver RDS Data endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds-data.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds-data.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rds-data.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/redshift/api_client.go b/service/redshift/api_client.go index 5dd4e45bac3..ae8f2360dbe 100644 --- a/service/redshift/api_client.go +++ b/service/redshift/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/redshift/endpoints.go b/service/redshift/endpoints.go index 62ff99a87cc..0cddf095e66 100644 --- a/service/redshift/endpoints.go +++ b/service/redshift/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/redshift/generated.json b/service/redshift/generated.json index eb34b4c3aa7..a70270bef08 100644 --- a/service/redshift/generated.json +++ b/service/redshift/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/redshift/go.mod b/service/redshift/go.mod index 4f0973bf7b8..1014c5adc09 100644 --- a/service/redshift/go.mod +++ b/service/redshift/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/redshift/internal/endpoints/endpoints.go b/service/redshift/internal/endpoints/endpoints.go index f719d24d4bd..144c42f6ecc 100644 --- a/service/redshift/internal/endpoints/endpoints.go +++ b/service/redshift/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Redshift endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/redshiftdata/api_client.go b/service/redshiftdata/api_client.go index 88a3b83b154..161ab06340b 100644 --- a/service/redshiftdata/api_client.go +++ b/service/redshiftdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/redshiftdata/endpoints.go b/service/redshiftdata/endpoints.go index d2692499bd6..def222146cc 100644 --- a/service/redshiftdata/endpoints.go +++ b/service/redshiftdata/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/redshiftdata/generated.json b/service/redshiftdata/generated.json index 2adee145738..9d516f6ff2a 100644 --- a/service/redshiftdata/generated.json +++ b/service/redshiftdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/redshiftdata/go.mod b/service/redshiftdata/go.mod index ce2fbcf35f8..47bc438bf73 100644 --- a/service/redshiftdata/go.mod +++ b/service/redshiftdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/redshiftdata/internal/endpoints/endpoints.go b/service/redshiftdata/internal/endpoints/endpoints.go index 17c3d010231..8304bbcf976 100644 --- a/service/redshiftdata/internal/endpoints/endpoints.go +++ b/service/redshiftdata/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Redshift Data endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift-data.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift-data.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "redshift-data.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/rekognition/api_client.go b/service/rekognition/api_client.go index d801bbbdb97..8ee86e4413a 100644 --- a/service/rekognition/api_client.go +++ b/service/rekognition/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/rekognition/endpoints.go b/service/rekognition/endpoints.go index 4dc73fbe215..d7ca8146753 100644 --- a/service/rekognition/endpoints.go +++ b/service/rekognition/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rekognition/generated.json b/service/rekognition/generated.json index 0e08c71ed95..7d2cd4fe321 100644 --- a/service/rekognition/generated.json +++ b/service/rekognition/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/rekognition/go.mod b/service/rekognition/go.mod index ea31c73008e..d83462c7b45 100644 --- a/service/rekognition/go.mod +++ b/service/rekognition/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/rekognition/internal/endpoints/endpoints.go b/service/rekognition/internal/endpoints/endpoints.go index 6eb3373675c..7f56c4be085 100644 --- a/service/rekognition/internal/endpoints/endpoints.go +++ b/service/rekognition/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Rekognition endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rekognition.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -115,6 +142,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rekognition.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -145,6 +177,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "rekognition.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/resourcegroups/api_client.go b/service/resourcegroups/api_client.go index 59401a4d4be..625eade3318 100644 --- a/service/resourcegroups/api_client.go +++ b/service/resourcegroups/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/resourcegroups/endpoints.go b/service/resourcegroups/endpoints.go index 8e0f751fc12..0da6a27117f 100644 --- a/service/resourcegroups/endpoints.go +++ b/service/resourcegroups/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/resourcegroups/generated.json b/service/resourcegroups/generated.json index f87981ec651..6ca1b44d514 100644 --- a/service/resourcegroups/generated.json +++ b/service/resourcegroups/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/resourcegroups/go.mod b/service/resourcegroups/go.mod index 2fe2f732103..5428c025a59 100644 --- a/service/resourcegroups/go.mod +++ b/service/resourcegroups/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/resourcegroups/internal/endpoints/endpoints.go b/service/resourcegroups/internal/endpoints/endpoints.go index 00b99bab288..8a60b32f3af 100644 --- a/service/resourcegroups/internal/endpoints/endpoints.go +++ b/service/resourcegroups/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Resource Groups endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "resource-groups.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "resource-groups.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "resource-groups.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/resourcegroupstaggingapi/api_client.go b/service/resourcegroupstaggingapi/api_client.go index 98865e8db27..87be9e28305 100644 --- a/service/resourcegroupstaggingapi/api_client.go +++ b/service/resourcegroupstaggingapi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/resourcegroupstaggingapi/endpoints.go b/service/resourcegroupstaggingapi/endpoints.go index e9995e62468..8b8f405020f 100644 --- a/service/resourcegroupstaggingapi/endpoints.go +++ b/service/resourcegroupstaggingapi/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/resourcegroupstaggingapi/generated.json b/service/resourcegroupstaggingapi/generated.json index 8767a920882..ec2046d92b1 100644 --- a/service/resourcegroupstaggingapi/generated.json +++ b/service/resourcegroupstaggingapi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/resourcegroupstaggingapi/go.mod b/service/resourcegroupstaggingapi/go.mod index ac66332e458..f717b0f1905 100644 --- a/service/resourcegroupstaggingapi/go.mod +++ b/service/resourcegroupstaggingapi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go b/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go index d3b341eb036..e32b9045e19 100644 --- a/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go +++ b/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Resource Groups Tagging API endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "tagging.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "tagging.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -127,6 +159,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "tagging.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/robomaker/api_client.go b/service/robomaker/api_client.go index bb8e4f83111..bad5f17a218 100644 --- a/service/robomaker/api_client.go +++ b/service/robomaker/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/robomaker/endpoints.go b/service/robomaker/endpoints.go index a798b233670..de78c689ee0 100644 --- a/service/robomaker/endpoints.go +++ b/service/robomaker/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/robomaker/generated.json b/service/robomaker/generated.json index 8878f132153..096e24fc042 100644 --- a/service/robomaker/generated.json +++ b/service/robomaker/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/robomaker/go.mod b/service/robomaker/go.mod index f17673744d0..9c44f2dc9c6 100644 --- a/service/robomaker/go.mod +++ b/service/robomaker/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/robomaker/internal/endpoints/endpoints.go b/service/robomaker/internal/endpoints/endpoints.go index 75994981c0e..fd39382ee6b 100644 --- a/service/robomaker/internal/endpoints/endpoints.go +++ b/service/robomaker/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver RoboMaker endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "robomaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "robomaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "robomaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/route53/api_client.go b/service/route53/api_client.go index 8f4dfa70ae0..b276416394c 100644 --- a/service/route53/api_client.go +++ b/service/route53/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" route53cust "github.com/aws/aws-sdk-go-v2/service/route53/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/route53/endpoints.go b/service/route53/endpoints.go index b8966449b53..5b6eac90a07 100644 --- a/service/route53/endpoints.go +++ b/service/route53/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53/generated.json b/service/route53/generated.json index 8defb0fffcc..0f6266e8349 100644 --- a/service/route53/generated.json +++ b/service/route53/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/route53/go.mod b/service/route53/go.mod index 5e7a741b3f6..d20d2b96dfb 100644 --- a/service/route53/go.mod +++ b/service/route53/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53/internal/endpoints/endpoints.go b/service/route53/internal/endpoints/endpoints.go index 9c82fc9a158..a31287d2059 100644 --- a/service/route53/internal/endpoints/endpoints.go +++ b/service/route53/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Route 53 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", @@ -142,6 +174,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", diff --git a/service/route53domains/api_client.go b/service/route53domains/api_client.go index f9165fb5ed7..8ffc35ebc85 100644 --- a/service/route53domains/api_client.go +++ b/service/route53domains/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/route53domains/endpoints.go b/service/route53domains/endpoints.go index bf0db236204..c729aed1f5d 100644 --- a/service/route53domains/endpoints.go +++ b/service/route53domains/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53domains/generated.json b/service/route53domains/generated.json index fbe805ab88d..f8113335ee1 100644 --- a/service/route53domains/generated.json +++ b/service/route53domains/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/route53domains/go.mod b/service/route53domains/go.mod index 4e03f53ed58..8db32d9467a 100644 --- a/service/route53domains/go.mod +++ b/service/route53domains/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53domains/internal/endpoints/endpoints.go b/service/route53domains/internal/endpoints/endpoints.go index 3b1cf0a397e..c1eb48c8897 100644 --- a/service/route53domains/internal/endpoints/endpoints.go +++ b/service/route53domains/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Route 53 Domains endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53domains.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53domains.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -103,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53domains.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/route53resolver/api_client.go b/service/route53resolver/api_client.go index 89a8e1e2b84..a1c48b24d0e 100644 --- a/service/route53resolver/api_client.go +++ b/service/route53resolver/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/route53resolver/endpoints.go b/service/route53resolver/endpoints.go index 1ceccc16080..0d9be5b341f 100644 --- a/service/route53resolver/endpoints.go +++ b/service/route53resolver/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53resolver/generated.json b/service/route53resolver/generated.json index 4504eb3f364..21f92b9630f 100644 --- a/service/route53resolver/generated.json +++ b/service/route53resolver/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/route53resolver/go.mod b/service/route53resolver/go.mod index f6338f47611..54a046ae76c 100644 --- a/service/route53resolver/go.mod +++ b/service/route53resolver/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53resolver/internal/endpoints/endpoints.go b/service/route53resolver/internal/endpoints/endpoints.go index 5cdd3730197..d4a7e48825d 100644 --- a/service/route53resolver/internal/endpoints/endpoints.go +++ b/service/route53resolver/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Route53Resolver endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53resolver.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -92,8 +119,17 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53resolver.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, }, { ID: "aws-iso", @@ -122,6 +158,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "route53resolver.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/s3/api_client.go b/service/s3/api_client.go index 1fadace2d2d..0ddb3f659cf 100644 --- a/service/s3/api_client.go +++ b/service/s3/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" @@ -101,7 +102,10 @@ type Options struct { // DNS compatible to work with accelerate. UseAccelerate bool - // Allows you to enable Dualstack endpoint support for the service. + // Allows you to enable dual-stack endpoint support for the service. Deprecated: + // Set dual-stack by setting UseDualStack on EndpointResolverOptions. When + // EndpointResolverOptions' UseDualStack field is set it overrides this field + // value. UseDualstack bool // Allows you to enable the client to use path-style addressing, i.e., @@ -196,7 +200,8 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) - resolveClientConfig(cfg, &opts) + resolveUseARNRegion(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -268,8 +273,8 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } -// resolves client config -func resolveClientConfig(cfg aws.Config, o *Options) error { +// resolves UseARNRegion S3 configuration +func resolveUseARNRegion(cfg aws.Config, o *Options) error { if len(cfg.ConfigSources) == 0 { return nil } @@ -283,6 +288,26 @@ func resolveClientConfig(cfg aws.Config, o *Options) error { return nil } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualstack = true + } else { + o.UseDualstack = false + } + + } + return nil +} + func addMetadataRetrieverMiddleware(stack *middleware.Stack) error { return s3shared.AddMetadataRetrieverMiddleware(stack) } diff --git a/service/s3/endpoints.go b/service/s3/endpoints.go index 4652db06f87..f6dad60dd2f 100644 --- a/service/s3/endpoints.go +++ b/service/s3/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,18 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions + if o.EndpointOptions.UseDualStack == UnsetDualStackEndpoint { + if o.UseDualstack { + endpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + endpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3/generated.json b/service/s3/generated.json index d070516de88..b2902acf8e5 100644 --- a/service/s3/generated.json +++ b/service/s3/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/aws-sdk-go-v2/service/internal/s3shared": "v1.2.3", diff --git a/service/s3/go.mod b/service/s3/go.mod index fed48d6e109..497bd609a55 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.3.1 @@ -13,6 +14,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../service/internal/accept-encoding/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/s3/internal/configtesting/go.mod b/service/s3/internal/configtesting/go.mod index 0a5f936ca64..592cb94fd47 100644 --- a/service/s3/internal/configtesting/go.mod +++ b/service/s3/internal/configtesting/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../../../service/internal/presigned-url/ diff --git a/service/s3/internal/endpoints/endpoints.go b/service/s3/internal/endpoints/endpoints.go index 3acda91a3b7..ccecc7bae9e 100644 --- a/service/s3/internal/endpoints/endpoints.go +++ b/service/s3/internal/endpoints/endpoints.go @@ -10,9 +10,30 @@ import ( "strings" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver S3 endpoint resolver @@ -28,6 +49,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -62,6 +84,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -101,318 +128,320 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-af-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", + "accesspoint-eu-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", + "accesspoint-eu-north-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", + "accesspoint-eu-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + "accesspoint-eu-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + "accesspoint-eu-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + "accesspoint-eu-west-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + "accesspoint-me-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + "accesspoint-sa-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", + "accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", + "accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", + "accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", + "accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "aws-global": endpoints.Endpoint{ + Hostname: "s3.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "fips-accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", + "fips-accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", + "fips-accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", + "fips-accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", + "fips-accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", + "me-south-1": endpoints.Endpoint{}, + "s3-external-1": endpoints.Endpoint{ + Hostname: "s3-external-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-1": endpoints.Endpoint{ + Hostname: "s3.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-2": endpoints.Endpoint{}, + "us-west-1": endpoints.Endpoint{ + Hostname: "s3.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-west-2": endpoints.Endpoint{ + Hostname: "s3.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-af-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", + "accesspoint-ap-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", + "accesspoint-ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", + "accesspoint-ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.me-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "af-south-1": endpoints.Endpoint{}, - "af-south-1-dualstack": endpoints.Endpoint{ + "af-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-east-1": endpoints.Endpoint{}, - "ap-east-1-dualstack": endpoints.Endpoint{ + "ap-east-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-2-dualstack": endpoints.Endpoint{ + "ap-northeast-2": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-3": endpoints.Endpoint{}, - "ap-northeast-3-dualstack": endpoints.Endpoint{ + "ap-northeast-3": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-south-1": endpoints.Endpoint{}, - "ap-south-1-dualstack": endpoints.Endpoint{ + "ap-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "aws-global": endpoints.Endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoints.Endpoint{}, - "ca-central-1-dualstack": endpoints.Endpoint{ + "ca-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-central-1": endpoints.Endpoint{}, - "eu-central-1-dualstack": endpoints.Endpoint{ + "eu-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-north-1": endpoints.Endpoint{}, - "eu-north-1-dualstack": endpoints.Endpoint{ + "eu-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-south-1": endpoints.Endpoint{}, - "eu-south-1-dualstack": endpoints.Endpoint{ + "eu-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "eu-west-1": endpoints.Endpoint{ - Hostname: "s3.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-2-dualstack": endpoints.Endpoint{ + "eu-west-2": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-3": endpoints.Endpoint{}, - "eu-west-3-dualstack": endpoints.Endpoint{ + "eu-west-3": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "fips-accesspoint-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "me-south-1": endpoints.Endpoint{}, - "me-south-1-dualstack": endpoints.Endpoint{ + "me-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "s3-external-1": endpoints.Endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, "sa-east-1": endpoints.Endpoint{ - Hostname: "s3.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "sa-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-east-1": endpoints.Endpoint{ - Hostname: "s3.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "us-east-2": endpoints.Endpoint{}, - "us-east-2-dualstack": endpoints.Endpoint{ + "us-east-2": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-1": endpoints.Endpoint{ - Hostname: "s3.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-2": endpoints.Endpoint{ - Hostname: "s3.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, @@ -425,6 +454,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -436,20 +470,22 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-north-1": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-cn-north-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-northwest-1": endpoints.Endpoint{ + "accesspoint-cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "cn-north-1": endpoints.Endpoint{}, - "cn-north-1-dualstack": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn", }, - "cn-northwest-1": endpoints.Endpoint{}, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn", }, }, @@ -490,17 +526,14 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3", "s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -509,14 +542,6 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -535,15 +560,33 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, diff --git a/service/s3control/api_client.go b/service/s3control/api_client.go index f5b7dcee684..2697094243e 100644 --- a/service/s3control/api_client.go +++ b/service/s3control/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" s3sharedconfig "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config" smithy "github.com/aws/smithy-go" @@ -96,7 +97,10 @@ type Options struct { // Allows you to enable arn region support for the service. UseARNRegion bool - // Allows you to enable Dualstack endpoint support for the service. + // Allows you to enable dual-stack endpoint support for the service. Deprecated: + // Set dual-stack by setting UseDualStack on EndpointResolverOptions. When + // EndpointResolverOptions' UseDualStack field is set it overrides this field + // value. UseDualstack bool // The HTTP client to invoke API calls with. Defaults to client's default HTTP @@ -186,7 +190,8 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) - resolveClientConfig(cfg, &opts) + resolveUseARNRegion(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -264,8 +269,8 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } -// resolves client config -func resolveClientConfig(cfg aws.Config, o *Options) error { +// resolves UseARNRegion S3 configuration +func resolveUseARNRegion(cfg aws.Config, o *Options) error { if len(cfg.ConfigSources) == 0 { return nil } @@ -279,6 +284,26 @@ func resolveClientConfig(cfg aws.Config, o *Options) error { return nil } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualstack = true + } else { + o.UseDualstack = false + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/s3control/endpoints.go b/service/s3control/endpoints.go index 7889cc861f7..fb15437f35a 100644 --- a/service/s3control/endpoints.go +++ b/service/s3control/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,18 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions + if o.EndpointOptions.UseDualStack == UnsetDualStackEndpoint { + if o.UseDualstack { + endpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + endpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3control/generated.json b/service/s3control/generated.json index 4e3ba094389..bdf7e0fb2c4 100644 --- a/service/s3control/generated.json +++ b/service/s3control/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/s3shared": "v1.2.3", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/s3control/go.mod b/service/s3control/go.mod index cafd7d204d6..14362105421 100644 --- a/service/s3control/go.mod +++ b/service/s3control/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.3.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/s3shared => ../../service/internal/s3shared/ diff --git a/service/s3control/internal/endpoints/endpoints.go b/service/s3control/internal/endpoints/endpoints.go index 5f23ecb30e2..52bd63e693b 100644 --- a/service/s3control/internal/endpoints/endpoints.go +++ b/service/s3control/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver S3 Control endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -70,301 +97,303 @@ var defaultPartitions = endpoints.Partitions{ Region: "ap-northeast-1", }, }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-1.amazonaws.com", + "ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-control.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-1", + Region: "ap-northeast-2", }, }, - "ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-control.ap-northeast-2.amazonaws.com", + "ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-control.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-2", + Region: "ap-northeast-3", }, }, - "ap-northeast-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-2.amazonaws.com", + "ap-south-1": endpoints.Endpoint{ + Hostname: "s3-control.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-2", + Region: "ap-south-1", }, }, - "ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-control.ap-northeast-3.amazonaws.com", + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-control.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-3", + Region: "ap-southeast-1", }, }, - "ap-northeast-3-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-3.amazonaws.com", + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-control.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-3", + Region: "ap-southeast-2", }, }, - "ap-south-1": endpoints.Endpoint{ - Hostname: "s3-control.ap-south-1.amazonaws.com", + "ca-central-1": endpoints.Endpoint{ + Hostname: "s3-control.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-south-1", + Region: "ca-central-1", }, }, - "ap-south-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-south-1.amazonaws.com", + "ca-central-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-south-1", + Region: "ca-central-1", }, }, - "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-control.ap-southeast-1.amazonaws.com", + "eu-central-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-1", + Region: "eu-central-1", }, }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-southeast-1.amazonaws.com", + "eu-north-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-1", + Region: "eu-north-1", }, }, - "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-control.ap-southeast-2.amazonaws.com", + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-2", + Region: "eu-west-1", }, }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-southeast-2.amazonaws.com", + "eu-west-2": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-2", + Region: "eu-west-2", }, }, - "ca-central-1": endpoints.Endpoint{ - Hostname: "s3-control.ca-central-1.amazonaws.com", + "eu-west-3": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "eu-west-3", }, }, - "ca-central-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ca-central-1.amazonaws.com", + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3-control.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "sa-east-1", }, }, - "ca-central-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.ca-central-1.amazonaws.com", + "us-east-1": endpoints.Endpoint{ + Hostname: "s3-control.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "us-east-1", }, }, - "ca-central-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.ca-central-1.amazonaws.com", + "us-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "us-east-1", }, }, - "eu-central-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-central-1.amazonaws.com", + "us-east-2": endpoints.Endpoint{ + Hostname: "s3-control.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-central-1", + Region: "us-east-2", }, }, - "eu-central-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-central-1.amazonaws.com", + "us-east-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-central-1", + Region: "us-east-2", }, }, - "eu-north-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-north-1.amazonaws.com", + "us-west-1": endpoints.Endpoint{ + Hostname: "s3-control.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-north-1", + Region: "us-west-1", }, }, - "eu-north-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-north-1.amazonaws.com", + "us-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-north-1", + Region: "us-west-1", }, }, - "eu-west-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-1.amazonaws.com", + "us-west-2": endpoints.Endpoint{ + Hostname: "s3-control.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-1", + Region: "us-west-2", }, }, - "eu-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-1.amazonaws.com", + "us-west-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-1", + Region: "us-west-2", }, }, - "eu-west-2": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-2.amazonaws.com", + }, + DualStackEndpoints: endpoints.Endpoints{ + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-2", + Region: "ap-northeast-1", }, }, - "eu-west-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-2.amazonaws.com", + "ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-2", + Region: "ap-northeast-2", }, }, - "eu-west-3": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-3.amazonaws.com", + "ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-3", + Region: "ap-northeast-3", }, }, - "eu-west-3-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-3.amazonaws.com", + "ap-south-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-3", + Region: "ap-south-1", }, }, - "sa-east-1": endpoints.Endpoint{ - Hostname: "s3-control.sa-east-1.amazonaws.com", + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "sa-east-1", + Region: "ap-southeast-1", }, }, - "sa-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.sa-east-1.amazonaws.com", + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "sa-east-1", + Region: "ap-southeast-2", }, }, - "us-east-1": endpoints.Endpoint{ - Hostname: "s3-control.us-east-1.amazonaws.com", + "ca-central-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "ca-central-1", }, }, - "us-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-east-1.amazonaws.com", + "ca-central-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "ca-central-1", }, }, - "us-east-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-east-1.amazonaws.com", + "eu-central-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "eu-central-1", }, }, - "us-east-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-east-1.amazonaws.com", + "eu-north-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "eu-north-1", }, }, - "us-east-2": endpoints.Endpoint{ - Hostname: "s3-control.us-east-2.amazonaws.com", + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-1", }, }, - "us-east-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-east-2.amazonaws.com", + "eu-west-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-2", }, }, - "us-east-2-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-east-2.amazonaws.com", + "eu-west-3": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-3", }, }, - "us-east-2-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-east-2.amazonaws.com", + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "sa-east-1", }, }, - "us-west-1": endpoints.Endpoint{ - Hostname: "s3-control.us-west-1.amazonaws.com", + "us-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-1", }, }, - "us-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-west-1.amazonaws.com", + "us-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-1", }, }, - "us-west-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-west-1.amazonaws.com", + "us-east-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-2", }, }, - "us-west-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-west-1.amazonaws.com", + "us-east-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-2", }, }, - "us-west-2": endpoints.Endpoint{ - Hostname: "s3-control.us-west-2.amazonaws.com", + "us-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", + Region: "us-west-1", }, }, - "us-west-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-west-2.amazonaws.com", + "us-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", + Region: "us-west-1", }, }, - "us-west-2-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-west-2.amazonaws.com", + "us-west-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-west-2", }, }, - "us-west-2-fips-dualstack": endpoints.Endpoint{ + "us-west-2-fips": endpoints.Endpoint{ Hostname: "s3-control-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ @@ -380,6 +409,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -390,21 +424,23 @@ var defaultPartitions = endpoints.Partitions{ Region: "cn-north-1", }, }, - "cn-north-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.cn-north-1.amazonaws.com.cn", + "cn-northwest-1": endpoints.Endpoint{ + Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "cn-north-1", + Region: "cn-northwest-1", }, }, - "cn-northwest-1": endpoints.Endpoint{ - Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", + }, + DualStackEndpoints: endpoints.Endpoints{ + "cn-north-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "cn-northwest-1", + Region: "cn-north-1", }, }, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-control.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ @@ -440,6 +476,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -450,49 +491,51 @@ var defaultPartitions = endpoints.Partitions{ Region: "us-gov-east-1", }, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-gov-east-1.amazonaws.com", + "us-gov-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-gov-east-1", }, }, - "us-gov-east-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", + "us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-control.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", + Region: "us-gov-west-1", }, }, - "us-gov-east-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-gov-east-1.amazonaws.com", + "us-gov-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", + Region: "us-gov-west-1", }, }, - "us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-control.us-gov-west-1.amazonaws.com", + }, + DualStackEndpoints: endpoints.Endpoints{ + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", + Region: "us-gov-east-1", }, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-gov-west-1.amazonaws.com", + "us-gov-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", + Region: "us-gov-east-1", }, }, - "us-gov-west-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", + "us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-gov-west-1", }, }, - "us-gov-west-1-fips-dualstack": endpoints.Endpoint{ + "us-gov-west-1-fips": endpoints.Endpoint{ Hostname: "s3-control-fips.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ diff --git a/service/s3control/internal/endpoints/s3/endpoints.go b/service/s3control/internal/endpoints/s3/endpoints.go index 0ca85492e3e..e6283522ae4 100644 --- a/service/s3control/internal/endpoints/s3/endpoints.go +++ b/service/s3control/internal/endpoints/s3/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver S3 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,318 +126,320 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-af-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", + "accesspoint-eu-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", + "accesspoint-eu-north-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", + "accesspoint-eu-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + "accesspoint-eu-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + "accesspoint-eu-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + "accesspoint-eu-west-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + "accesspoint-me-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + "accesspoint-sa-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", + "accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", + "accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", + "accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", + "accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "aws-global": endpoints.Endpoint{ + Hostname: "s3.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "fips-accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", + "fips-accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", + "fips-accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", + "fips-accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", + "fips-accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", + "me-south-1": endpoints.Endpoint{}, + "s3-external-1": endpoints.Endpoint{ + Hostname: "s3-external-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-1": endpoints.Endpoint{ + Hostname: "s3.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-2": endpoints.Endpoint{}, + "us-west-1": endpoints.Endpoint{ + Hostname: "s3.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-west-2": endpoints.Endpoint{ + Hostname: "s3.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-af-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", + "accesspoint-ap-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", + "accesspoint-ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", + "accesspoint-ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.me-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "af-south-1": endpoints.Endpoint{}, - "af-south-1-dualstack": endpoints.Endpoint{ + "af-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-east-1": endpoints.Endpoint{}, - "ap-east-1-dualstack": endpoints.Endpoint{ + "ap-east-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-2-dualstack": endpoints.Endpoint{ + "ap-northeast-2": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-3": endpoints.Endpoint{}, - "ap-northeast-3-dualstack": endpoints.Endpoint{ + "ap-northeast-3": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-south-1": endpoints.Endpoint{}, - "ap-south-1-dualstack": endpoints.Endpoint{ + "ap-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "aws-global": endpoints.Endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoints.Endpoint{}, - "ca-central-1-dualstack": endpoints.Endpoint{ + "ca-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-central-1": endpoints.Endpoint{}, - "eu-central-1-dualstack": endpoints.Endpoint{ + "eu-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-north-1": endpoints.Endpoint{}, - "eu-north-1-dualstack": endpoints.Endpoint{ + "eu-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-south-1": endpoints.Endpoint{}, - "eu-south-1-dualstack": endpoints.Endpoint{ + "eu-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "eu-west-1": endpoints.Endpoint{ - Hostname: "s3.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-2-dualstack": endpoints.Endpoint{ + "eu-west-2": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-3": endpoints.Endpoint{}, - "eu-west-3-dualstack": endpoints.Endpoint{ + "eu-west-3": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "fips-accesspoint-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "me-south-1": endpoints.Endpoint{}, - "me-south-1-dualstack": endpoints.Endpoint{ + "me-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "s3-external-1": endpoints.Endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, "sa-east-1": endpoints.Endpoint{ - Hostname: "s3.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "sa-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-east-1": endpoints.Endpoint{ - Hostname: "s3.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "us-east-2": endpoints.Endpoint{}, - "us-east-2-dualstack": endpoints.Endpoint{ + "us-east-2": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-1": endpoints.Endpoint{ - Hostname: "s3.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-2": endpoints.Endpoint{ - Hostname: "s3.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, @@ -423,6 +452,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -434,20 +468,22 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-north-1": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-cn-north-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-northwest-1": endpoints.Endpoint{ + "accesspoint-cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "cn-north-1": endpoints.Endpoint{}, - "cn-north-1-dualstack": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn", }, - "cn-northwest-1": endpoints.Endpoint{}, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn", }, }, @@ -488,17 +524,14 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3", "s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -507,14 +540,6 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -533,15 +558,33 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, diff --git a/service/s3outposts/api_client.go b/service/s3outposts/api_client.go index ef670431347..fbf9a0eb3f0 100644 --- a/service/s3outposts/api_client.go +++ b/service/s3outposts/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/s3outposts/endpoints.go b/service/s3outposts/endpoints.go index e714cc118b0..717ea3ff3da 100644 --- a/service/s3outposts/endpoints.go +++ b/service/s3outposts/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3outposts/generated.json b/service/s3outposts/generated.json index a5f324d30a5..df1f9ddf29d 100644 --- a/service/s3outposts/generated.json +++ b/service/s3outposts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/s3outposts/go.mod b/service/s3outposts/go.mod index 1d1af78a965..f3b1a6e3e2f 100644 --- a/service/s3outposts/go.mod +++ b/service/s3outposts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/s3outposts/internal/endpoints/endpoints.go b/service/s3outposts/internal/endpoints/endpoints.go index be7f7c4d744..5609c41ca68 100644 --- a/service/s3outposts/internal/endpoints/endpoints.go +++ b/service/s3outposts/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver S3Outposts endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,30 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-outposts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -92,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-outposts.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -122,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-outposts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sagemaker/api_client.go b/service/sagemaker/api_client.go index 319050be35c..19014fb2427 100644 --- a/service/sagemaker/api_client.go +++ b/service/sagemaker/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/sagemaker/endpoints.go b/service/sagemaker/endpoints.go index 3b81b93393a..b907578a6ef 100644 --- a/service/sagemaker/endpoints.go +++ b/service/sagemaker/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemaker/generated.json b/service/sagemaker/generated.json index 47cf2235713..0f7bbe3ea0d 100644 --- a/service/sagemaker/generated.json +++ b/service/sagemaker/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/sagemaker/go.mod b/service/sagemaker/go.mod index 15e25198c50..51c31628bfd 100644 --- a/service/sagemaker/go.mod +++ b/service/sagemaker/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemaker/internal/endpoints/endpoints.go b/service/sagemaker/internal/endpoints/endpoints.go index 0322494588d..92d48e42202 100644 --- a/service/sagemaker/internal/endpoints/endpoints.go +++ b/service/sagemaker/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SageMaker endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.sagemaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -153,6 +185,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "api.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sagemakera2iruntime/api_client.go b/service/sagemakera2iruntime/api_client.go index 480f7030c02..37751dacddc 100644 --- a/service/sagemakera2iruntime/api_client.go +++ b/service/sagemakera2iruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sagemakera2iruntime/endpoints.go b/service/sagemakera2iruntime/endpoints.go index ed95370cd96..33012ce06ef 100644 --- a/service/sagemakera2iruntime/endpoints.go +++ b/service/sagemakera2iruntime/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakera2iruntime/generated.json b/service/sagemakera2iruntime/generated.json index e4e8a8fed6b..135ac63eee4 100644 --- a/service/sagemakera2iruntime/generated.json +++ b/service/sagemakera2iruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakera2iruntime/go.mod b/service/sagemakera2iruntime/go.mod index 43338912a64..394e905f3bd 100644 --- a/service/sagemakera2iruntime/go.mod +++ b/service/sagemakera2iruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakera2iruntime/internal/endpoints/endpoints.go b/service/sagemakera2iruntime/internal/endpoints/endpoints.go index f36a95b6257..292292c0682 100644 --- a/service/sagemakera2iruntime/internal/endpoints/endpoints.go +++ b/service/sagemakera2iruntime/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SageMaker A2I Runtime endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a2i-runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a2i-runtime.sagemaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "a2i-runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sagemakeredge/api_client.go b/service/sagemakeredge/api_client.go index 68c4e29b14c..33fa64d1c42 100644 --- a/service/sagemakeredge/api_client.go +++ b/service/sagemakeredge/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sagemakeredge/endpoints.go b/service/sagemakeredge/endpoints.go index d0f21577e34..c4c010a0c09 100644 --- a/service/sagemakeredge/endpoints.go +++ b/service/sagemakeredge/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakeredge/generated.json b/service/sagemakeredge/generated.json index 6f632d65fd0..2b7c9292074 100644 --- a/service/sagemakeredge/generated.json +++ b/service/sagemakeredge/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakeredge/go.mod b/service/sagemakeredge/go.mod index a8fafebdc97..58340088bd7 100644 --- a/service/sagemakeredge/go.mod +++ b/service/sagemakeredge/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakeredge/internal/endpoints/endpoints.go b/service/sagemakeredge/internal/endpoints/endpoints.go index 9820e2ad5c3..f19b45f0f6e 100644 --- a/service/sagemakeredge/internal/endpoints/endpoints.go +++ b/service/sagemakeredge/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Sagemaker Edge endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "edge.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "edge.sagemaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "edge.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sagemakerfeaturestoreruntime/api_client.go b/service/sagemakerfeaturestoreruntime/api_client.go index c790c7a76f3..1bc4c74d09d 100644 --- a/service/sagemakerfeaturestoreruntime/api_client.go +++ b/service/sagemakerfeaturestoreruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sagemakerfeaturestoreruntime/endpoints.go b/service/sagemakerfeaturestoreruntime/endpoints.go index e90ec96a628..74535631b9a 100644 --- a/service/sagemakerfeaturestoreruntime/endpoints.go +++ b/service/sagemakerfeaturestoreruntime/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakerfeaturestoreruntime/generated.json b/service/sagemakerfeaturestoreruntime/generated.json index 8584b56d1c9..832e8e9cdaa 100644 --- a/service/sagemakerfeaturestoreruntime/generated.json +++ b/service/sagemakerfeaturestoreruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakerfeaturestoreruntime/go.mod b/service/sagemakerfeaturestoreruntime/go.mod index 4ba3c69e5e4..d7807c626d6 100644 --- a/service/sagemakerfeaturestoreruntime/go.mod +++ b/service/sagemakerfeaturestoreruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go b/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go index 1939942c2fd..385c0f216bf 100644 --- a/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go +++ b/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SageMaker FeatureStore Runtime endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "featurestore-runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "featurestore-runtime.sagemaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "featurestore-runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sagemakerruntime/api_client.go b/service/sagemakerruntime/api_client.go index d69ebc55f66..0761404e796 100644 --- a/service/sagemakerruntime/api_client.go +++ b/service/sagemakerruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sagemakerruntime/endpoints.go b/service/sagemakerruntime/endpoints.go index 6197e5c7f07..d7297bf9138 100644 --- a/service/sagemakerruntime/endpoints.go +++ b/service/sagemakerruntime/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakerruntime/generated.json b/service/sagemakerruntime/generated.json index d58f8bec8d4..26f6a6a5455 100644 --- a/service/sagemakerruntime/generated.json +++ b/service/sagemakerruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakerruntime/go.mod b/service/sagemakerruntime/go.mod index 6c73d42d19c..021e281a53a 100644 --- a/service/sagemakerruntime/go.mod +++ b/service/sagemakerruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakerruntime/internal/endpoints/endpoints.go b/service/sagemakerruntime/internal/endpoints/endpoints.go index 0d88783842b..5af6e1c6b4b 100644 --- a/service/sagemakerruntime/internal/endpoints/endpoints.go +++ b/service/sagemakerruntime/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SageMaker Runtime endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.sagemaker.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -153,6 +185,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "runtime.sagemaker.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/savingsplans/api_client.go b/service/savingsplans/api_client.go index 8ef5e146d7c..a23aefa044f 100644 --- a/service/savingsplans/api_client.go +++ b/service/savingsplans/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/savingsplans/endpoints.go b/service/savingsplans/endpoints.go index 95923c14342..1751ca93d3b 100644 --- a/service/savingsplans/endpoints.go +++ b/service/savingsplans/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/savingsplans/generated.json b/service/savingsplans/generated.json index 7511af13d52..0cc5f003ea9 100644 --- a/service/savingsplans/generated.json +++ b/service/savingsplans/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/savingsplans/go.mod b/service/savingsplans/go.mod index 7abd9ddd9e6..6eb7587d64d 100644 --- a/service/savingsplans/go.mod +++ b/service/savingsplans/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/savingsplans/internal/endpoints/endpoints.go b/service/savingsplans/internal/endpoints/endpoints.go index 540f6cc5e96..6bd258689d0 100644 --- a/service/savingsplans/internal/endpoints/endpoints.go +++ b/service/savingsplans/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver savingsplans endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "savingsplans.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -79,6 +106,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "savingsplans.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -109,6 +141,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "savingsplans.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/schemas/api_client.go b/service/schemas/api_client.go index 154fd16e0b8..1f4f3767491 100644 --- a/service/schemas/api_client.go +++ b/service/schemas/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/schemas/endpoints.go b/service/schemas/endpoints.go index 29e0b507f75..e38b91df123 100644 --- a/service/schemas/endpoints.go +++ b/service/schemas/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/schemas/generated.json b/service/schemas/generated.json index 942ef135ba0..b83b76a2e2a 100644 --- a/service/schemas/generated.json +++ b/service/schemas/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/schemas/go.mod b/service/schemas/go.mod index 28ff150044e..9e5b1841881 100644 --- a/service/schemas/go.mod +++ b/service/schemas/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/schemas/internal/endpoints/endpoints.go b/service/schemas/internal/endpoints/endpoints.go index 5766470fb0b..29e1966e3aa 100644 --- a/service/schemas/internal/endpoints/endpoints.go +++ b/service/schemas/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver schemas endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "schemas.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -89,6 +116,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "schemas.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -119,6 +151,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "schemas.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/secretsmanager/api_client.go b/service/secretsmanager/api_client.go index 7569596f231..57eb5e368f1 100644 --- a/service/secretsmanager/api_client.go +++ b/service/secretsmanager/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/secretsmanager/endpoints.go b/service/secretsmanager/endpoints.go index a9c5bb12112..6a656b5c04e 100644 --- a/service/secretsmanager/endpoints.go +++ b/service/secretsmanager/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/secretsmanager/generated.json b/service/secretsmanager/generated.json index 84246ee5b96..9c2f5973041 100644 --- a/service/secretsmanager/generated.json +++ b/service/secretsmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/secretsmanager/go.mod b/service/secretsmanager/go.mod index 2368e2cdd65..4cdeffb744b 100644 --- a/service/secretsmanager/go.mod +++ b/service/secretsmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/secretsmanager/internal/endpoints/endpoints.go b/service/secretsmanager/internal/endpoints/endpoints.go index 135bc8194ab..d71d9ca718b 100644 --- a/service/secretsmanager/internal/endpoints/endpoints.go +++ b/service/secretsmanager/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Secrets Manager endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "secretsmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "secretsmanager.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -154,6 +186,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "secretsmanager.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/securityhub/api_client.go b/service/securityhub/api_client.go index 64966c749df..710d3b50635 100644 --- a/service/securityhub/api_client.go +++ b/service/securityhub/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/securityhub/endpoints.go b/service/securityhub/endpoints.go index a0d2c14a570..f1bc99a287c 100644 --- a/service/securityhub/endpoints.go +++ b/service/securityhub/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/securityhub/generated.json b/service/securityhub/generated.json index 2a42a3e18d7..9fa4a808572 100644 --- a/service/securityhub/generated.json +++ b/service/securityhub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/securityhub/go.mod b/service/securityhub/go.mod index 8cfbf8cbb31..e66e5f665d9 100644 --- a/service/securityhub/go.mod +++ b/service/securityhub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/securityhub/internal/endpoints/endpoints.go b/service/securityhub/internal/endpoints/endpoints.go index deda44feb9f..e8b22b26bd0 100644 --- a/service/securityhub/internal/endpoints/endpoints.go +++ b/service/securityhub/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SecurityHub endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "securityhub.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "securityhub.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "securityhub.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/serverlessapplicationrepository/api_client.go b/service/serverlessapplicationrepository/api_client.go index f400ae65474..d6a4238a84e 100644 --- a/service/serverlessapplicationrepository/api_client.go +++ b/service/serverlessapplicationrepository/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/serverlessapplicationrepository/endpoints.go b/service/serverlessapplicationrepository/endpoints.go index ea4a74d5624..c9e3bfbcf88 100644 --- a/service/serverlessapplicationrepository/endpoints.go +++ b/service/serverlessapplicationrepository/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/serverlessapplicationrepository/generated.json b/service/serverlessapplicationrepository/generated.json index 94bb3f62285..e793106aee2 100644 --- a/service/serverlessapplicationrepository/generated.json +++ b/service/serverlessapplicationrepository/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/serverlessapplicationrepository/go.mod b/service/serverlessapplicationrepository/go.mod index 18905a92133..99011d55ea6 100644 --- a/service/serverlessapplicationrepository/go.mod +++ b/service/serverlessapplicationrepository/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/serverlessapplicationrepository/internal/endpoints/endpoints.go b/service/serverlessapplicationrepository/internal/endpoints/endpoints.go index 9d202f7fb1d..26c12799e90 100644 --- a/service/serverlessapplicationrepository/internal/endpoints/endpoints.go +++ b/service/serverlessapplicationrepository/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ServerlessApplicationRepository endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "serverlessrepo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -126,6 +153,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "serverlessrepo.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -164,6 +196,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "serverlessrepo.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/servicecatalog/api_client.go b/service/servicecatalog/api_client.go index 2da35b625a2..b8742c0a790 100644 --- a/service/servicecatalog/api_client.go +++ b/service/servicecatalog/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/servicecatalog/endpoints.go b/service/servicecatalog/endpoints.go index 75d5571a2f4..39537efe9e0 100644 --- a/service/servicecatalog/endpoints.go +++ b/service/servicecatalog/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicecatalog/generated.json b/service/servicecatalog/generated.json index 1ce18921a3e..45756ae1f02 100644 --- a/service/servicecatalog/generated.json +++ b/service/servicecatalog/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicecatalog/go.mod b/service/servicecatalog/go.mod index d2e4172bf9b..a0f6b74bbf9 100644 --- a/service/servicecatalog/go.mod +++ b/service/servicecatalog/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicecatalog/internal/endpoints/endpoints.go b/service/servicecatalog/internal/endpoints/endpoints.go index 4ca17b48c4a..7bee2592313 100644 --- a/service/servicecatalog/internal/endpoints/endpoints.go +++ b/service/servicecatalog/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Service Catalog endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -67,6 +94,7 @@ var defaultPartitions = endpoints.Partitions{ "ap-east-1": endpoints.Endpoint{}, "ap-northeast-1": endpoints.Endpoint{}, "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, "ap-south-1": endpoints.Endpoint{}, "ap-southeast-1": endpoints.Endpoint{}, "ap-southeast-2": endpoints.Endpoint{}, @@ -116,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -146,6 +179,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/servicecatalogappregistry/api_client.go b/service/servicecatalogappregistry/api_client.go index 42548807d64..63007391a7a 100644 --- a/service/servicecatalogappregistry/api_client.go +++ b/service/servicecatalogappregistry/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/servicecatalogappregistry/endpoints.go b/service/servicecatalogappregistry/endpoints.go index 25e7582fc68..4cf55d4d421 100644 --- a/service/servicecatalogappregistry/endpoints.go +++ b/service/servicecatalogappregistry/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicecatalogappregistry/generated.json b/service/servicecatalogappregistry/generated.json index c9ab5073733..05c01283a2c 100644 --- a/service/servicecatalogappregistry/generated.json +++ b/service/servicecatalogappregistry/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicecatalogappregistry/go.mod b/service/servicecatalogappregistry/go.mod index 649ea1eb442..7d6e831a85f 100644 --- a/service/servicecatalogappregistry/go.mod +++ b/service/servicecatalogappregistry/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicecatalogappregistry/internal/endpoints/endpoints.go b/service/servicecatalogappregistry/internal/endpoints/endpoints.go index 3546b75d9b0..4b181e7b3a9 100644 --- a/service/servicecatalogappregistry/internal/endpoints/endpoints.go +++ b/service/servicecatalogappregistry/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Service Catalog AppRegistry endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog-appregistry.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog-appregistry.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicecatalog-appregistry.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/servicediscovery/api_client.go b/service/servicediscovery/api_client.go index 533998dcdcf..3db3f9be0c1 100644 --- a/service/servicediscovery/api_client.go +++ b/service/servicediscovery/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/servicediscovery/endpoints.go b/service/servicediscovery/endpoints.go index 55e01c3f4be..cec9e8a8051 100644 --- a/service/servicediscovery/endpoints.go +++ b/service/servicediscovery/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicediscovery/generated.json b/service/servicediscovery/generated.json index 6f134dca62b..e8e63ac3af9 100644 --- a/service/servicediscovery/generated.json +++ b/service/servicediscovery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicediscovery/go.mod b/service/servicediscovery/go.mod index a0eefbb6908..f6a7acd53d3 100644 --- a/service/servicediscovery/go.mod +++ b/service/servicediscovery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicediscovery/internal/endpoints/endpoints.go b/service/servicediscovery/internal/endpoints/endpoints.go index b08232968f0..f58fa2e0aec 100644 --- a/service/servicediscovery/internal/endpoints/endpoints.go +++ b/service/servicediscovery/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver ServiceDiscovery endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicediscovery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -98,6 +125,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicediscovery.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -132,6 +164,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicediscovery.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/servicequotas/api_client.go b/service/servicequotas/api_client.go index 9993cf149d3..78e7393e7cf 100644 --- a/service/servicequotas/api_client.go +++ b/service/servicequotas/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/servicequotas/endpoints.go b/service/servicequotas/endpoints.go index 29f9d7c0157..ff26d63eed4 100644 --- a/service/servicequotas/endpoints.go +++ b/service/servicequotas/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicequotas/generated.json b/service/servicequotas/generated.json index 7568a09d2a0..d004df15d75 100644 --- a/service/servicequotas/generated.json +++ b/service/servicequotas/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicequotas/go.mod b/service/servicequotas/go.mod index 308303d88ab..df28fc96a2e 100644 --- a/service/servicequotas/go.mod +++ b/service/servicequotas/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicequotas/internal/endpoints/endpoints.go b/service/servicequotas/internal/endpoints/endpoints.go index d0b2be34714..eefc4c3d600 100644 --- a/service/servicequotas/internal/endpoints/endpoints.go +++ b/service/servicequotas/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Service Quotas endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicequotas.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -93,6 +120,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicequotas.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -123,6 +155,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "servicequotas.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ses/api_client.go b/service/ses/api_client.go index 9158b47aa60..aeee3bb9baf 100644 --- a/service/ses/api_client.go +++ b/service/ses/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ses/endpoints.go b/service/ses/endpoints.go index 1e0cee2eccc..792cdfd5c71 100644 --- a/service/ses/endpoints.go +++ b/service/ses/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ses/generated.json b/service/ses/generated.json index b1a0d92d460..d80cab89125 100644 --- a/service/ses/generated.json +++ b/service/ses/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ses/go.mod b/service/ses/go.mod index 20abad36e50..01af906c766 100644 --- a/service/ses/go.mod +++ b/service/ses/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ses/internal/endpoints/endpoints.go b/service/ses/internal/endpoints/endpoints.go index e280612c5f1..9e3bf7d4f09 100644 --- a/service/ses/internal/endpoints/endpoints.go +++ b/service/ses/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SES endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,6 +105,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +140,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sesv2/api_client.go b/service/sesv2/api_client.go index 1d251be39c6..cf201f27646 100644 --- a/service/sesv2/api_client.go +++ b/service/sesv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sesv2/endpoints.go b/service/sesv2/endpoints.go index f8223f47441..2a86edabead 100644 --- a/service/sesv2/endpoints.go +++ b/service/sesv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sesv2/generated.json b/service/sesv2/generated.json index 1ef9f9449fa..2d5bf6f96ee 100644 --- a/service/sesv2/generated.json +++ b/service/sesv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sesv2/go.mod b/service/sesv2/go.mod index a7de55486d6..5404457fc1e 100644 --- a/service/sesv2/go.mod +++ b/service/sesv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sesv2/internal/endpoints/endpoints.go b/service/sesv2/internal/endpoints/endpoints.go index 39f2c478657..7e92b3a1828 100644 --- a/service/sesv2/internal/endpoints/endpoints.go +++ b/service/sesv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SESv2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,6 +105,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -108,6 +140,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "email.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sfn/api_client.go b/service/sfn/api_client.go index 438f48a553b..401866ee0b9 100644 --- a/service/sfn/api_client.go +++ b/service/sfn/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sfn/endpoints.go b/service/sfn/endpoints.go index 3ab47c7f416..ec292b0cdbb 100644 --- a/service/sfn/endpoints.go +++ b/service/sfn/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sfn/generated.json b/service/sfn/generated.json index b8c334e8a25..e3a677c2307 100644 --- a/service/sfn/generated.json +++ b/service/sfn/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sfn/go.mod b/service/sfn/go.mod index 110c96e94ba..9243285552e 100644 --- a/service/sfn/go.mod +++ b/service/sfn/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sfn/internal/endpoints/endpoints.go b/service/sfn/internal/endpoints/endpoints.go index 590b1dd05f6..3098b542ec0 100644 --- a/service/sfn/internal/endpoints/endpoints.go +++ b/service/sfn/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SFN endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "states.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "states.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "states.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/shield/api_client.go b/service/shield/api_client.go index 86ad6df1bf4..a5a4d945e9f 100644 --- a/service/shield/api_client.go +++ b/service/shield/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/shield/endpoints.go b/service/shield/endpoints.go index a3159a0eb45..bda61a6f8e3 100644 --- a/service/shield/endpoints.go +++ b/service/shield/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/shield/generated.json b/service/shield/generated.json index c3580a2363e..9832d3d0dee 100644 --- a/service/shield/generated.json +++ b/service/shield/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/shield/go.mod b/service/shield/go.mod index ca1c7d0bc6f..dcb63ef8612 100644 --- a/service/shield/go.mod +++ b/service/shield/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/shield/internal/endpoints/endpoints.go b/service/shield/internal/endpoints/endpoints.go index a3a57043001..caf950e3532 100644 --- a/service/shield/internal/endpoints/endpoints.go +++ b/service/shield/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Shield endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "shield.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "shield.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "shield.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/signer/api_client.go b/service/signer/api_client.go index 6c80d5e3dda..3e00ee4b1e3 100644 --- a/service/signer/api_client.go +++ b/service/signer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/signer/endpoints.go b/service/signer/endpoints.go index 8ad3ad86c9c..46b42ec7020 100644 --- a/service/signer/endpoints.go +++ b/service/signer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/signer/generated.json b/service/signer/generated.json index 99e1fbbf2c5..d93064c89e9 100644 --- a/service/signer/generated.json +++ b/service/signer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/signer/go.mod b/service/signer/go.mod index 32a222aedfb..df8b77ade49 100644 --- a/service/signer/go.mod +++ b/service/signer/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/signer/internal/endpoints/endpoints.go b/service/signer/internal/endpoints/endpoints.go index 1156ed49372..0cb3d44bdc8 100644 --- a/service/signer/internal/endpoints/endpoints.go +++ b/service/signer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver signer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,30 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "signer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -92,12 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "signer.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - "cn-northwest-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -126,11 +132,12 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "signer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-gov-east-1": endpoints.Endpoint{}, - "us-gov-west-1": endpoints.Endpoint{}, - }, }, } diff --git a/service/sms/api_client.go b/service/sms/api_client.go index 9afc424e981..1b24715b033 100644 --- a/service/sms/api_client.go +++ b/service/sms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sms/endpoints.go b/service/sms/endpoints.go index 75ec50f9773..9abbfcf2a38 100644 --- a/service/sms/endpoints.go +++ b/service/sms/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sms/generated.json b/service/sms/generated.json index 07f299d9743..c0ee59772f1 100644 --- a/service/sms/generated.json +++ b/service/sms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sms/go.mod b/service/sms/go.mod index c90e0f2c2a2..b779e3fdb66 100644 --- a/service/sms/go.mod +++ b/service/sms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sms/internal/endpoints/endpoints.go b/service/sms/internal/endpoints/endpoints.go index b3ac36db355..6107c1628d1 100644 --- a/service/sms/internal/endpoints/endpoints.go +++ b/service/sms/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SMS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -116,6 +143,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -150,6 +182,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sms.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/snowball/api_client.go b/service/snowball/api_client.go index 53ea77a7638..b832eab1efb 100644 --- a/service/snowball/api_client.go +++ b/service/snowball/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/snowball/endpoints.go b/service/snowball/endpoints.go index 59ff60c0600..f88dcfb94eb 100644 --- a/service/snowball/endpoints.go +++ b/service/snowball/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/snowball/generated.json b/service/snowball/generated.json index f332ebb1606..95c6f03bb49 100644 --- a/service/snowball/generated.json +++ b/service/snowball/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/snowball/go.mod b/service/snowball/go.mod index 637f7bd8209..6430a1cf601 100644 --- a/service/snowball/go.mod +++ b/service/snowball/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/snowball/internal/endpoints/endpoints.go b/service/snowball/internal/endpoints/endpoints.go index 366f890c651..a92577232e5 100644 --- a/service/snowball/internal/endpoints/endpoints.go +++ b/service/snowball/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Snowball endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "snowball.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -188,6 +215,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "snowball.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -240,6 +272,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "snowball.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sns/api_client.go b/service/sns/api_client.go index 8dad0b86e49..a230abc09c4 100644 --- a/service/sns/api_client.go +++ b/service/sns/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sns/endpoints.go b/service/sns/endpoints.go index e83b1b5832b..1e6b885ff0c 100644 --- a/service/sns/endpoints.go +++ b/service/sns/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sns/generated.json b/service/sns/generated.json index 6a1ba7b4913..65736971f1b 100644 --- a/service/sns/generated.json +++ b/service/sns/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sns/go.mod b/service/sns/go.mod index f6969c569e0..80716423298 100644 --- a/service/sns/go.mod +++ b/service/sns/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sns/internal/endpoints/endpoints.go b/service/sns/internal/endpoints/endpoints.go index 926bd4d3086..53507035ba2 100644 --- a/service/sns/internal/endpoints/endpoints.go +++ b/service/sns/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SNS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sns.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sns.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -159,6 +191,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sns.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sqs/api_client.go b/service/sqs/api_client.go index 5fff2a579aa..7da864f6673 100644 --- a/service/sqs/api_client.go +++ b/service/sqs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sqs/endpoints.go b/service/sqs/endpoints.go index c9180f138f7..79dd4c9108f 100644 --- a/service/sqs/endpoints.go +++ b/service/sqs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sqs/generated.json b/service/sqs/generated.json index 93ebbb4cbf1..acbf448849d 100644 --- a/service/sqs/generated.json +++ b/service/sqs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sqs/go.mod b/service/sqs/go.mod index 506884d416a..bde1bf433ac 100644 --- a/service/sqs/go.mod +++ b/service/sqs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sqs/internal/endpoints/endpoints.go b/service/sqs/internal/endpoints/endpoints.go index cc1fab22471..a898edea1b8 100644 --- a/service/sqs/internal/endpoints/endpoints.go +++ b/service/sqs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SQS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sqs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sqs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -159,6 +191,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sqs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ssm/api_client.go b/service/ssm/api_client.go index b6ddec2568e..b0b8970a67c 100644 --- a/service/ssm/api_client.go +++ b/service/ssm/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ssm/endpoints.go b/service/ssm/endpoints.go index ab4433edc49..fdd2e771483 100644 --- a/service/ssm/endpoints.go +++ b/service/ssm/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssm/generated.json b/service/ssm/generated.json index 1faa87f195a..7b008bff6fb 100644 --- a/service/ssm/generated.json +++ b/service/ssm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ssm/go.mod b/service/ssm/go.mod index 830e21e0a52..9ede881c590 100644 --- a/service/ssm/go.mod +++ b/service/ssm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssm/internal/endpoints/endpoints.go b/service/ssm/internal/endpoints/endpoints.go index 24c48ade116..af85856554c 100644 --- a/service/ssm/internal/endpoints/endpoints.go +++ b/service/ssm/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSM endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/ssmcontacts/api_client.go b/service/ssmcontacts/api_client.go index 28d59e24ba2..f2eb07796a1 100644 --- a/service/ssmcontacts/api_client.go +++ b/service/ssmcontacts/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ssmcontacts/endpoints.go b/service/ssmcontacts/endpoints.go index 3ffb4ae13cd..0bd1aa3fd68 100644 --- a/service/ssmcontacts/endpoints.go +++ b/service/ssmcontacts/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssmcontacts/generated.json b/service/ssmcontacts/generated.json index 31c7940bd60..648ec72317d 100644 --- a/service/ssmcontacts/generated.json +++ b/service/ssmcontacts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssmcontacts/go.mod b/service/ssmcontacts/go.mod index ff56ff98df9..76b8006e0e0 100644 --- a/service/ssmcontacts/go.mod +++ b/service/ssmcontacts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssmcontacts/internal/endpoints/endpoints.go b/service/ssmcontacts/internal/endpoints/endpoints.go index 494c0809622..9a1d9b60723 100644 --- a/service/ssmcontacts/internal/endpoints/endpoints.go +++ b/service/ssmcontacts/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSM Contacts endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ssmincidents/api_client.go b/service/ssmincidents/api_client.go index 1e7b22ece93..2e94126bc67 100644 --- a/service/ssmincidents/api_client.go +++ b/service/ssmincidents/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ssmincidents/endpoints.go b/service/ssmincidents/endpoints.go index 3fe96d7d623..9e0c260e0fe 100644 --- a/service/ssmincidents/endpoints.go +++ b/service/ssmincidents/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssmincidents/generated.json b/service/ssmincidents/generated.json index 17ba1f63701..e30eacabeff 100644 --- a/service/ssmincidents/generated.json +++ b/service/ssmincidents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ssmincidents/go.mod b/service/ssmincidents/go.mod index 2853c87e53b..8c6992a3774 100644 --- a/service/ssmincidents/go.mod +++ b/service/ssmincidents/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssmincidents/internal/endpoints/endpoints.go b/service/ssmincidents/internal/endpoints/endpoints.go index 8f2e2466d1b..3db69dbbf3d 100644 --- a/service/ssmincidents/internal/endpoints/endpoints.go +++ b/service/ssmincidents/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSM Incidents endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sso/api_client.go b/service/sso/api_client.go index 7b8887b24c5..72cd969a90b 100644 --- a/service/sso/api_client.go +++ b/service/sso/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sso/endpoints.go b/service/sso/endpoints.go index 761a3a792cb..a0c4a05846b 100644 --- a/service/sso/endpoints.go +++ b/service/sso/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sso/generated.json b/service/sso/generated.json index a82f11041b7..385f727936e 100644 --- a/service/sso/generated.json +++ b/service/sso/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sso/go.mod b/service/sso/go.mod index d41388aeb4d..1ab7cdeff2b 100644 --- a/service/sso/go.mod +++ b/service/sso/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sso/internal/endpoints/endpoints.go b/service/sso/internal/endpoints/endpoints.go index 398f8bc96aa..d315bd426f8 100644 --- a/service/sso/internal/endpoints/endpoints.go +++ b/service/sso/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSO endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "portal.sso.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -126,6 +153,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "portal.sso.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -156,6 +188,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "portal.sso.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ssoadmin/api_client.go b/service/ssoadmin/api_client.go index f2e8e5ad462..d7b88400f23 100644 --- a/service/ssoadmin/api_client.go +++ b/service/ssoadmin/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ssoadmin/endpoints.go b/service/ssoadmin/endpoints.go index 8e8cc41fc18..659289c43e0 100644 --- a/service/ssoadmin/endpoints.go +++ b/service/ssoadmin/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssoadmin/generated.json b/service/ssoadmin/generated.json index 8ddd61a9bd1..c2deb2e9337 100644 --- a/service/ssoadmin/generated.json +++ b/service/ssoadmin/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssoadmin/go.mod b/service/ssoadmin/go.mod index 483bb0ecd66..f4a94ce7607 100644 --- a/service/ssoadmin/go.mod +++ b/service/ssoadmin/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssoadmin/internal/endpoints/endpoints.go b/service/ssoadmin/internal/endpoints/endpoints.go index e067a94dd6b..2a7cf929119 100644 --- a/service/ssoadmin/internal/endpoints/endpoints.go +++ b/service/ssoadmin/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSO Admin endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sso.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sso.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sso.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ssooidc/api_client.go b/service/ssooidc/api_client.go index 344fad727f3..2b144356e33 100644 --- a/service/ssooidc/api_client.go +++ b/service/ssooidc/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/ssooidc/endpoints.go b/service/ssooidc/endpoints.go index fdd9386413a..0afaf5c3cd2 100644 --- a/service/ssooidc/endpoints.go +++ b/service/ssooidc/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssooidc/generated.json b/service/ssooidc/generated.json index e86429a3754..b5ea615bdb7 100644 --- a/service/ssooidc/generated.json +++ b/service/ssooidc/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssooidc/go.mod b/service/ssooidc/go.mod index 7508145839a..9a69170f8da 100644 --- a/service/ssooidc/go.mod +++ b/service/ssooidc/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssooidc/internal/endpoints/endpoints.go b/service/ssooidc/internal/endpoints/endpoints.go index c9307a6178c..a5144e5691e 100644 --- a/service/ssooidc/internal/endpoints/endpoints.go +++ b/service/ssooidc/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SSO OIDC endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "oidc.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -150,6 +177,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "oidc.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -180,6 +212,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "oidc.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/storagegateway/api_client.go b/service/storagegateway/api_client.go index 50b14927116..d792a53d43a 100644 --- a/service/storagegateway/api_client.go +++ b/service/storagegateway/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/storagegateway/endpoints.go b/service/storagegateway/endpoints.go index b5fa037e764..aac6b779a9b 100644 --- a/service/storagegateway/endpoints.go +++ b/service/storagegateway/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/storagegateway/generated.json b/service/storagegateway/generated.json index 9499ef38eb6..7c29a05c9cc 100644 --- a/service/storagegateway/generated.json +++ b/service/storagegateway/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/storagegateway/go.mod b/service/storagegateway/go.mod index 82be4ec21ac..c259faeee59 100644 --- a/service/storagegateway/go.mod +++ b/service/storagegateway/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/storagegateway/internal/endpoints/endpoints.go b/service/storagegateway/internal/endpoints/endpoints.go index 82b0bfe9096..e99302e6738 100644 --- a/service/storagegateway/internal/endpoints/endpoints.go +++ b/service/storagegateway/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Storage Gateway endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "storagegateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -98,6 +125,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "storagegateway.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -132,6 +164,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "storagegateway.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/sts/api_client.go b/service/sts/api_client.go index 8022a3e4b2d..11ac7191744 100644 --- a/service/sts/api_client.go +++ b/service/sts/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/sts/endpoints.go b/service/sts/endpoints.go index 5b6aa7b1771..e07e7bb344f 100644 --- a/service/sts/endpoints.go +++ b/service/sts/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sts/generated.json b/service/sts/generated.json index d223a42ed7f..374d7a6a3d0 100644 --- a/service/sts/generated.json +++ b/service/sts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/sts/go.mod b/service/sts/go.mod index b29ffc3c9bb..727f66e8083 100644 --- a/service/sts/go.mod +++ b/service/sts/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/sts/internal/endpoints/endpoints.go b/service/sts/internal/endpoints/endpoints.go index e99aab6a62c..b5966cbf154 100644 --- a/service/sts/internal/endpoints/endpoints.go +++ b/service/sts/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver STS endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -123,6 +150,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sts.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -163,6 +195,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "sts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/support/api_client.go b/service/support/api_client.go index b36cf9579c0..b3613a041a9 100644 --- a/service/support/api_client.go +++ b/service/support/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/support/endpoints.go b/service/support/endpoints.go index b9b9632f255..a1937a2296b 100644 --- a/service/support/endpoints.go +++ b/service/support/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/support/generated.json b/service/support/generated.json index 354bd91e80e..5e9429ef5a1 100644 --- a/service/support/generated.json +++ b/service/support/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/support/go.mod b/service/support/go.mod index 3594b8bd656..d3f77a900e9 100644 --- a/service/support/go.mod +++ b/service/support/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/support/internal/endpoints/endpoints.go b/service/support/internal/endpoints/endpoints.go index abf6d4c1969..d3e3aae580f 100644 --- a/service/support/internal/endpoints/endpoints.go +++ b/service/support/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Support endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "support.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -78,6 +105,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "support.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -132,6 +164,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "support.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/swf/api_client.go b/service/swf/api_client.go index a61e0b071a6..9d9eff7a954 100644 --- a/service/swf/api_client.go +++ b/service/swf/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/swf/endpoints.go b/service/swf/endpoints.go index a4ec5c2c69b..71b3e3a824f 100644 --- a/service/swf/endpoints.go +++ b/service/swf/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/swf/generated.json b/service/swf/generated.json index 2aafeff9831..450a9770bbf 100644 --- a/service/swf/generated.json +++ b/service/swf/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/swf/go.mod b/service/swf/go.mod index f435b1ecc25..29df890b8b1 100644 --- a/service/swf/go.mod +++ b/service/swf/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/swf/internal/endpoints/endpoints.go b/service/swf/internal/endpoints/endpoints.go index 10c79532e45..695ba4e6872 100644 --- a/service/swf/internal/endpoints/endpoints.go +++ b/service/swf/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver SWF endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "swf.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "swf.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -157,6 +189,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "swf.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/synthetics/api_client.go b/service/synthetics/api_client.go index b0e99e7394e..53a11706be4 100644 --- a/service/synthetics/api_client.go +++ b/service/synthetics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/synthetics/endpoints.go b/service/synthetics/endpoints.go index 6f545fc8542..5a753229698 100644 --- a/service/synthetics/endpoints.go +++ b/service/synthetics/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/synthetics/generated.json b/service/synthetics/generated.json index 50cef98d7cf..127c64596c6 100644 --- a/service/synthetics/generated.json +++ b/service/synthetics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/synthetics/go.mod b/service/synthetics/go.mod index c4f18866244..35bcb7ed93b 100644 --- a/service/synthetics/go.mod +++ b/service/synthetics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/synthetics/internal/endpoints/endpoints.go b/service/synthetics/internal/endpoints/endpoints.go index e2c85fa7182..85d5ff50f8d 100644 --- a/service/synthetics/internal/endpoints/endpoints.go +++ b/service/synthetics/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver synthetics endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,30 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "synthetics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "af-south-1": endpoints.Endpoint{}, - "ap-east-1": endpoints.Endpoint{}, - "ap-northeast-1": endpoints.Endpoint{}, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-north-1": endpoints.Endpoint{}, - "eu-south-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "me-south-1": endpoints.Endpoint{}, - "sa-east-1": endpoints.Endpoint{}, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -92,12 +97,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "synthetics.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "cn-north-1": endpoints.Endpoint{}, - "cn-northwest-1": endpoints.Endpoint{}, - }, }, { ID: "aws-iso", @@ -126,11 +132,12 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "synthetics.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "us-gov-east-1": endpoints.Endpoint{}, - "us-gov-west-1": endpoints.Endpoint{}, - }, }, } diff --git a/service/textract/api_client.go b/service/textract/api_client.go index ecfbbdd06fc..f95faeb6c7f 100644 --- a/service/textract/api_client.go +++ b/service/textract/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/textract/endpoints.go b/service/textract/endpoints.go index 40b466972ec..2ca23533a8f 100644 --- a/service/textract/endpoints.go +++ b/service/textract/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/textract/generated.json b/service/textract/generated.json index 62509949099..797fcd485df 100644 --- a/service/textract/generated.json +++ b/service/textract/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/textract/go.mod b/service/textract/go.mod index 8eb66566946..44b15373b81 100644 --- a/service/textract/go.mod +++ b/service/textract/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/textract/internal/endpoints/endpoints.go b/service/textract/internal/endpoints/endpoints.go index b36356c9a29..b7349709fc6 100644 --- a/service/textract/internal/endpoints/endpoints.go +++ b/service/textract/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Textract endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,53 +82,13 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "textract.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "ap-northeast-2": endpoints.Endpoint{}, - "ap-south-1": endpoints.Endpoint{}, - "ap-southeast-1": endpoints.Endpoint{}, - "ap-southeast-2": endpoints.Endpoint{}, - "ca-central-1": endpoints.Endpoint{}, - "eu-central-1": endpoints.Endpoint{}, - "eu-west-1": endpoints.Endpoint{}, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-3": endpoints.Endpoint{}, - "fips-ca-central-1": endpoints.Endpoint{ - Hostname: "textract-fips.ca-central-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoints.Endpoint{ - Hostname: "textract-fips.us-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoints.Endpoint{ - Hostname: "textract-fips.us-east-2.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoints.Endpoint{ - Hostname: "textract-fips.us-west-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoints.Endpoint{ - Hostname: "textract-fips.us-west-2.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoints.Endpoint{}, - "us-east-2": endpoints.Endpoint{}, - "us-west-1": endpoints.Endpoint{}, - "us-west-2": endpoints.Endpoint{}, - }, }, { ID: "aws-cn", @@ -115,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "textract.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -145,23 +132,12 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "textract.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - "fips-us-gov-east-1": endpoints.Endpoint{ - Hostname: "textract-fips.us-gov-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoints.Endpoint{ - Hostname: "textract-fips.us-gov-west-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoints.Endpoint{}, - "us-gov-west-1": endpoints.Endpoint{}, - }, }, } diff --git a/service/timestreamquery/api_client.go b/service/timestreamquery/api_client.go index 770aba2c637..d5d48ba35a2 100644 --- a/service/timestreamquery/api_client.go +++ b/service/timestreamquery/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/timestreamquery/endpoints.go b/service/timestreamquery/endpoints.go index 94c2b7628a7..ae8585e644e 100644 --- a/service/timestreamquery/endpoints.go +++ b/service/timestreamquery/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/timestreamquery/generated.json b/service/timestreamquery/generated.json index 837cb34e73f..c646ca8494a 100644 --- a/service/timestreamquery/generated.json +++ b/service/timestreamquery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/timestreamquery/go.mod b/service/timestreamquery/go.mod index 07e585e9749..8da13402d49 100644 --- a/service/timestreamquery/go.mod +++ b/service/timestreamquery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/timestreamquery/internal/endpoints/endpoints.go b/service/timestreamquery/internal/endpoints/endpoints.go index 84df6bea531..9847ec8eef4 100644 --- a/service/timestreamquery/internal/endpoints/endpoints.go +++ b/service/timestreamquery/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Timestream Query endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "query.timestream.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "query.timestream.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "query.timestream.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/timestreamwrite/api_client.go b/service/timestreamwrite/api_client.go index a1c6a335316..b54f847f425 100644 --- a/service/timestreamwrite/api_client.go +++ b/service/timestreamwrite/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/timestreamwrite/endpoints.go b/service/timestreamwrite/endpoints.go index 6467637e677..417f3e1e223 100644 --- a/service/timestreamwrite/endpoints.go +++ b/service/timestreamwrite/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/timestreamwrite/generated.json b/service/timestreamwrite/generated.json index 9ca39bfe4f6..b515f8d8736 100644 --- a/service/timestreamwrite/generated.json +++ b/service/timestreamwrite/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/timestreamwrite/go.mod b/service/timestreamwrite/go.mod index 8609eb2617d..acd7f43cb72 100644 --- a/service/timestreamwrite/go.mod +++ b/service/timestreamwrite/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/timestreamwrite/internal/endpoints/endpoints.go b/service/timestreamwrite/internal/endpoints/endpoints.go index baf7927a44f..990b056fb6d 100644 --- a/service/timestreamwrite/internal/endpoints/endpoints.go +++ b/service/timestreamwrite/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Timestream Write endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ingest.timestream.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ingest.timestream.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ingest.timestream.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/transcribe/api_client.go b/service/transcribe/api_client.go index 5855e68c0df..2587ff7e6d5 100644 --- a/service/transcribe/api_client.go +++ b/service/transcribe/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/transcribe/endpoints.go b/service/transcribe/endpoints.go index 83971161d32..77a78f3106a 100644 --- a/service/transcribe/endpoints.go +++ b/service/transcribe/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/transcribe/generated.json b/service/transcribe/generated.json index b00e110b055..2bba3be0f7b 100644 --- a/service/transcribe/generated.json +++ b/service/transcribe/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/transcribe/go.mod b/service/transcribe/go.mod index 8be474161ae..9d06c213ad0 100644 --- a/service/transcribe/go.mod +++ b/service/transcribe/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/transcribe/internal/endpoints/endpoints.go b/service/transcribe/internal/endpoints/endpoints.go index 69edd845334..8a753f3df48 100644 --- a/service/transcribe/internal/endpoints/endpoints.go +++ b/service/transcribe/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Transcribe endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transcribe.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -113,6 +140,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transcribe.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -160,6 +192,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transcribe.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/transfer/api_client.go b/service/transfer/api_client.go index 854d3103739..a36283f9823 100644 --- a/service/transfer/api_client.go +++ b/service/transfer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/transfer/endpoints.go b/service/transfer/endpoints.go index 2fec3086a8e..7f38838ab48 100644 --- a/service/transfer/endpoints.go +++ b/service/transfer/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/transfer/generated.json b/service/transfer/generated.json index ded5c1efcff..c5907cdf309 100644 --- a/service/transfer/generated.json +++ b/service/transfer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/transfer/go.mod b/service/transfer/go.mod index b5b8c49748b..c56a331a84d 100644 --- a/service/transfer/go.mod +++ b/service/transfer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/transfer/internal/endpoints/endpoints.go b/service/transfer/internal/endpoints/endpoints.go index ea240f63ad0..42ccb9a41b6 100644 --- a/service/transfer/internal/endpoints/endpoints.go +++ b/service/transfer/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Transfer endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transfer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -73,6 +100,7 @@ var defaultPartitions = endpoints.Partitions{ "ca-central-1": endpoints.Endpoint{}, "eu-central-1": endpoints.Endpoint{}, "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, "eu-west-1": endpoints.Endpoint{}, "eu-west-2": endpoints.Endpoint{}, "eu-west-3": endpoints.Endpoint{}, @@ -121,6 +149,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transfer.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -151,6 +184,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "transfer.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/translate/api_client.go b/service/translate/api_client.go index 0bb96dcd43c..df7ca784cd0 100644 --- a/service/translate/api_client.go +++ b/service/translate/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/translate/endpoints.go b/service/translate/endpoints.go index 37fd8fee7c9..0c3c5091ebd 100644 --- a/service/translate/endpoints.go +++ b/service/translate/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/translate/generated.json b/service/translate/generated.json index 0a0bd528ac5..b965549d5e8 100644 --- a/service/translate/generated.json +++ b/service/translate/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/translate/go.mod b/service/translate/go.mod index ea34a98974f..e18c064b572 100644 --- a/service/translate/go.mod +++ b/service/translate/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/translate/internal/endpoints/endpoints.go b/service/translate/internal/endpoints/endpoints.go index c034489b92e..3ab8d4e70ec 100644 --- a/service/translate/internal/endpoints/endpoints.go +++ b/service/translate/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Translate endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "translate.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -106,6 +133,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "translate.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -139,6 +171,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "translate.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/waf/api_client.go b/service/waf/api_client.go index e0af0783101..3f4f70bc617 100644 --- a/service/waf/api_client.go +++ b/service/waf/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/waf/endpoints.go b/service/waf/endpoints.go index 34665df0ee6..3277c2f156a 100644 --- a/service/waf/endpoints.go +++ b/service/waf/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/waf/generated.json b/service/waf/generated.json index 35e9e49c44c..25d4aadfb52 100644 --- a/service/waf/generated.json +++ b/service/waf/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/waf/go.mod b/service/waf/go.mod index 5ac748fa625..4f45edfb8ad 100644 --- a/service/waf/go.mod +++ b/service/waf/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/waf/internal/endpoints/endpoints.go b/service/waf/internal/endpoints/endpoints.go index 1f15710743e..bbb3b67ffff 100644 --- a/service/waf/internal/endpoints/endpoints.go +++ b/service/waf/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WAF endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", @@ -85,6 +112,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -115,6 +147,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/wafregional/api_client.go b/service/wafregional/api_client.go index 73c67984ee6..9b3e3e9a485 100644 --- a/service/wafregional/api_client.go +++ b/service/wafregional/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/wafregional/endpoints.go b/service/wafregional/endpoints.go index f299829f083..966b7859bb7 100644 --- a/service/wafregional/endpoints.go +++ b/service/wafregional/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wafregional/generated.json b/service/wafregional/generated.json index fc1e8c79bc8..14c0526b4c5 100644 --- a/service/wafregional/generated.json +++ b/service/wafregional/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wafregional/go.mod b/service/wafregional/go.mod index 239e6f3f770..cebf5c2b07a 100644 --- a/service/wafregional/go.mod +++ b/service/wafregional/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wafregional/internal/endpoints/endpoints.go b/service/wafregional/internal/endpoints/endpoints.go index c111d0c3298..f5cd1f55c04 100644 --- a/service/wafregional/internal/endpoints/endpoints.go +++ b/service/wafregional/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WAF Regional endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf-regional.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -312,6 +339,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf-regional.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -342,6 +374,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "waf-regional.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/wafv2/api_client.go b/service/wafv2/api_client.go index acc286382b5..5f583f0db26 100644 --- a/service/wafv2/api_client.go +++ b/service/wafv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/wafv2/endpoints.go b/service/wafv2/endpoints.go index 35aa3033428..d8897530ac5 100644 --- a/service/wafv2/endpoints.go +++ b/service/wafv2/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wafv2/generated.json b/service/wafv2/generated.json index b2a582e3416..4feb9600053 100644 --- a/service/wafv2/generated.json +++ b/service/wafv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wafv2/go.mod b/service/wafv2/go.mod index eee2266ba48..9b46268cb56 100644 --- a/service/wafv2/go.mod +++ b/service/wafv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wafv2/internal/endpoints/endpoints.go b/service/wafv2/internal/endpoints/endpoints.go index 8a0648efbbb..a79661707ae 100644 --- a/service/wafv2/internal/endpoints/endpoints.go +++ b/service/wafv2/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WAFV2 endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wafv2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wafv2.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wafv2.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/wellarchitected/api_client.go b/service/wellarchitected/api_client.go index 975d8ae5721..dad9a71ec81 100644 --- a/service/wellarchitected/api_client.go +++ b/service/wellarchitected/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/wellarchitected/endpoints.go b/service/wellarchitected/endpoints.go index ac021e89608..b9dcb93cb4a 100644 --- a/service/wellarchitected/endpoints.go +++ b/service/wellarchitected/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wellarchitected/generated.json b/service/wellarchitected/generated.json index ff0147239b8..67ba76bf978 100644 --- a/service/wellarchitected/generated.json +++ b/service/wellarchitected/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wellarchitected/go.mod b/service/wellarchitected/go.mod index 4dcbf865079..db39061deb9 100644 --- a/service/wellarchitected/go.mod +++ b/service/wellarchitected/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wellarchitected/internal/endpoints/endpoints.go b/service/wellarchitected/internal/endpoints/endpoints.go index 4412ee761f4..125f536d4a2 100644 --- a/service/wellarchitected/internal/endpoints/endpoints.go +++ b/service/wellarchitected/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WellArchitected endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wellarchitected.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wellarchitected.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "wellarchitected.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/workdocs/api_client.go b/service/workdocs/api_client.go index 6b42cb11134..e168e7bf02b 100644 --- a/service/workdocs/api_client.go +++ b/service/workdocs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/workdocs/endpoints.go b/service/workdocs/endpoints.go index b6f14944a42..501185926cd 100644 --- a/service/workdocs/endpoints.go +++ b/service/workdocs/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workdocs/generated.json b/service/workdocs/generated.json index 94c4d37b9e1..42bf2dc5a94 100644 --- a/service/workdocs/generated.json +++ b/service/workdocs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workdocs/go.mod b/service/workdocs/go.mod index 8aeb638431d..5ef48e797a1 100644 --- a/service/workdocs/go.mod +++ b/service/workdocs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workdocs/internal/endpoints/endpoints.go b/service/workdocs/internal/endpoints/endpoints.go index 2630d84fa60..cb293202e32 100644 --- a/service/workdocs/internal/endpoints/endpoints.go +++ b/service/workdocs/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WorkDocs endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workdocs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -90,6 +117,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workdocs.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -120,6 +152,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workdocs.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/worklink/api_client.go b/service/worklink/api_client.go index f0d3d8d40d8..467493b20e8 100644 --- a/service/worklink/api_client.go +++ b/service/worklink/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/worklink/endpoints.go b/service/worklink/endpoints.go index b610aea3bc3..f26d7c2fe81 100644 --- a/service/worklink/endpoints.go +++ b/service/worklink/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/worklink/generated.json b/service/worklink/generated.json index 61131bf8e03..d84500ffbf2 100644 --- a/service/worklink/generated.json +++ b/service/worklink/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/worklink/go.mod b/service/worklink/go.mod index 586b128338b..9feaf388e88 100644 --- a/service/worklink/go.mod +++ b/service/worklink/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/worklink/internal/endpoints/endpoints.go b/service/worklink/internal/endpoints/endpoints.go index 0ed2cd6f0fa..536157229e5 100644 --- a/service/worklink/internal/endpoints/endpoints.go +++ b/service/worklink/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WorkLink endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "worklink.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "worklink.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "worklink.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/workmail/api_client.go b/service/workmail/api_client.go index f328dd4cf0a..66eac978246 100644 --- a/service/workmail/api_client.go +++ b/service/workmail/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/workmail/endpoints.go b/service/workmail/endpoints.go index 0f5e7acd689..22fc041df86 100644 --- a/service/workmail/endpoints.go +++ b/service/workmail/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workmail/generated.json b/service/workmail/generated.json index 68dfe2561ac..fb663d98fcf 100644 --- a/service/workmail/generated.json +++ b/service/workmail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workmail/go.mod b/service/workmail/go.mod index 0d6f5568b0c..d115841c631 100644 --- a/service/workmail/go.mod +++ b/service/workmail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workmail/internal/endpoints/endpoints.go b/service/workmail/internal/endpoints/endpoints.go index 88dc477f0c3..5706470a0f8 100644 --- a/service/workmail/internal/endpoints/endpoints.go +++ b/service/workmail/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WorkMail endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -75,6 +102,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmail.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -105,6 +137,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmail.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/workmailmessageflow/api_client.go b/service/workmailmessageflow/api_client.go index f7ef1db8029..ff97057b12b 100644 --- a/service/workmailmessageflow/api_client.go +++ b/service/workmailmessageflow/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/workmailmessageflow/endpoints.go b/service/workmailmessageflow/endpoints.go index 22fd055db50..57ae84195b7 100644 --- a/service/workmailmessageflow/endpoints.go +++ b/service/workmailmessageflow/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workmailmessageflow/generated.json b/service/workmailmessageflow/generated.json index 7cfdefaef65..08329f6d50c 100644 --- a/service/workmailmessageflow/generated.json +++ b/service/workmailmessageflow/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workmailmessageflow/go.mod b/service/workmailmessageflow/go.mod index 38cf5d2cfd7..e91bb1946c6 100644 --- a/service/workmailmessageflow/go.mod +++ b/service/workmailmessageflow/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workmailmessageflow/internal/endpoints/endpoints.go b/service/workmailmessageflow/internal/endpoints/endpoints.go index 6b6f5050d4c..075a1863ead 100644 --- a/service/workmailmessageflow/internal/endpoints/endpoints.go +++ b/service/workmailmessageflow/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WorkMailMessageFlow endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmailmessageflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmailmessageflow.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workmailmessageflow.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/workspaces/api_client.go b/service/workspaces/api_client.go index fae159cb5bc..44a4ce4c38c 100644 --- a/service/workspaces/api_client.go +++ b/service/workspaces/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/workspaces/endpoints.go b/service/workspaces/endpoints.go index 79f747fca22..f601060deac 100644 --- a/service/workspaces/endpoints.go +++ b/service/workspaces/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workspaces/generated.json b/service/workspaces/generated.json index 6ae1f1383de..166b8d8b53a 100644 --- a/service/workspaces/generated.json +++ b/service/workspaces/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workspaces/go.mod b/service/workspaces/go.mod index 9939336a5d2..ac1347a2631 100644 --- a/service/workspaces/go.mod +++ b/service/workspaces/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workspaces/internal/endpoints/endpoints.go b/service/workspaces/internal/endpoints/endpoints.go index 94d0b6fe413..f0b3edea77b 100644 --- a/service/workspaces/internal/endpoints/endpoints.go +++ b/service/workspaces/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver WorkSpaces endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workspaces.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -96,6 +123,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workspaces.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -132,6 +164,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "workspaces.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/xray/api_client.go b/service/xray/api_client.go index 69218bc9a6e..dabee3e2abf 100644 --- a/service/xray/api_client.go +++ b/service/xray/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStack(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves UseDualStack configuration +func resolveUseDualStack(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.UseDualStack = EnableDualStackEndpoint + } else { + o.EndpointOptions.UseDualStack = DisableDualStackEndpoint + } + + } + return nil +} + func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) } diff --git a/service/xray/endpoints.go b/service/xray/endpoints.go index 31d01bdc379..32c89000fca 100644 --- a/service/xray/endpoints.go +++ b/service/xray/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/xray/generated.json b/service/xray/generated.json index fde6ca5f7b6..310e9d30611 100644 --- a/service/xray/generated.json +++ b/service/xray/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/xray/go.mod b/service/xray/go.mod index 574de5e470a..838c6121082 100644 --- a/service/xray/go.mod +++ b/service/xray/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/xray/internal/endpoints/endpoints.go b/service/xray/internal/endpoints/endpoints.go index 1db09e625fa..711ec34282e 100644 --- a/service/xray/internal/endpoints/endpoints.go +++ b/service/xray/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver XRay endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.UseDualStack), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "xray.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -117,6 +144,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "xray.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -151,6 +183,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "xray.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{