From 0d71cc2e4b14934f5c0c3ac2e81545eee487e16e Mon Sep 17 00:00:00 2001 From: Sean McGrail Date: Fri, 21 May 2021 11:00:27 -0700 Subject: [PATCH] Regenerated Clients --- .../aws/go/codegen/EndpointGenerator.java | 2 +- .../ResolveClientConfigFromSources.java | 24 +- config/go.mod | 2 + credentials/go.mod | 2 + example/service/s3/listObjects/go.mod | 2 + example/service/s3/usingPrivateLink/go.mod | 2 + feature/dynamodb/attributevalue/go.mod | 2 + feature/dynamodb/expression/go.mod | 2 + feature/dynamodbstreams/attributevalue/go.mod | 2 + feature/s3/manager/go.mod | 2 + .../protocoltest/awsrestjson/api_client.go | 22 + .../protocoltest/awsrestjson/endpoints.go | 19 +- .../protocoltest/awsrestjson/generated.json | 1 + internal/protocoltest/awsrestjson/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ internal/protocoltest/ec2query/api_client.go | 22 + internal/protocoltest/ec2query/endpoints.go | 19 +- internal/protocoltest/ec2query/generated.json | 1 + internal/protocoltest/ec2query/go.mod | 3 + .../ec2query/internal/endpoints/endpoints.go | 37 ++ internal/protocoltest/jsonrpc/api_client.go | 22 + internal/protocoltest/jsonrpc/endpoints.go | 19 +- internal/protocoltest/jsonrpc/generated.json | 1 + internal/protocoltest/jsonrpc/go.mod | 3 + .../jsonrpc/internal/endpoints/endpoints.go | 37 ++ internal/protocoltest/jsonrpc10/api_client.go | 22 + internal/protocoltest/jsonrpc10/endpoints.go | 19 +- .../protocoltest/jsonrpc10/generated.json | 1 + internal/protocoltest/jsonrpc10/go.mod | 3 + .../jsonrpc10/internal/endpoints/endpoints.go | 37 ++ internal/protocoltest/query/api_client.go | 22 + internal/protocoltest/query/endpoints.go | 19 +- internal/protocoltest/query/generated.json | 1 + internal/protocoltest/query/go.mod | 3 + .../query/internal/endpoints/endpoints.go | 37 ++ internal/protocoltest/restxml/api_client.go | 22 + internal/protocoltest/restxml/endpoints.go | 19 +- internal/protocoltest/restxml/generated.json | 1 + internal/protocoltest/restxml/go.mod | 3 + .../restxml/internal/endpoints/endpoints.go | 37 ++ .../restxmlwithnamespace/api_client.go | 22 + .../restxmlwithnamespace/endpoints.go | 19 +- .../restxmlwithnamespace/generated.json | 1 + .../protocoltest/restxmlwithnamespace/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/accessanalyzer/api_client.go | 22 + service/accessanalyzer/endpoints.go | 19 +- service/accessanalyzer/generated.json | 1 + service/accessanalyzer/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/acm/api_client.go | 22 + service/acm/endpoints.go | 19 +- service/acm/generated.json | 1 + service/acm/go.mod | 3 + service/acm/internal/endpoints/endpoints.go | 37 ++ service/acmpca/api_client.go | 22 + service/acmpca/endpoints.go | 19 +- service/acmpca/generated.json | 1 + service/acmpca/go.mod | 3 + .../acmpca/internal/endpoints/endpoints.go | 37 ++ service/alexaforbusiness/api_client.go | 22 + service/alexaforbusiness/endpoints.go | 19 +- service/alexaforbusiness/generated.json | 1 + service/alexaforbusiness/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/amp/api_client.go | 22 + service/amp/endpoints.go | 19 +- service/amp/generated.json | 1 + service/amp/go.mod | 3 + service/amp/internal/endpoints/endpoints.go | 44 +- service/amplify/api_client.go | 22 + service/amplify/endpoints.go | 19 +- service/amplify/generated.json | 1 + service/amplify/go.mod | 3 + .../amplify/internal/endpoints/endpoints.go | 37 ++ service/amplifybackend/api_client.go | 22 + service/amplifybackend/endpoints.go | 19 +- service/amplifybackend/generated.json | 1 + service/amplifybackend/go.mod | 3 + .../internal/endpoints/endpoints.go | 51 +++ service/apigateway/api_client.go | 22 + service/apigateway/endpoints.go | 19 +- service/apigateway/generated.json | 1 + service/apigateway/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/apigatewaymanagementapi/api_client.go | 22 + service/apigatewaymanagementapi/endpoints.go | 19 +- .../apigatewaymanagementapi/generated.json | 1 + service/apigatewaymanagementapi/go.mod | 3 + .../internal/endpoints/endpoints.go | 70 +-- service/apigatewayv2/api_client.go | 22 + service/apigatewayv2/endpoints.go | 19 +- service/apigatewayv2/generated.json | 1 + service/apigatewayv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/appconfig/api_client.go | 22 + service/appconfig/endpoints.go | 19 +- service/appconfig/generated.json | 1 + service/appconfig/go.mod | 3 + .../appconfig/internal/endpoints/endpoints.go | 37 ++ service/appflow/api_client.go | 22 + service/appflow/endpoints.go | 19 +- service/appflow/generated.json | 1 + service/appflow/go.mod | 3 + .../appflow/internal/endpoints/endpoints.go | 37 ++ service/appintegrations/api_client.go | 22 + service/appintegrations/endpoints.go | 19 +- service/appintegrations/generated.json | 1 + service/appintegrations/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/applicationautoscaling/api_client.go | 22 + service/applicationautoscaling/endpoints.go | 19 +- service/applicationautoscaling/generated.json | 1 + service/applicationautoscaling/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/applicationcostprofiler/api_client.go | 22 + service/applicationcostprofiler/endpoints.go | 19 +- .../applicationcostprofiler/generated.json | 1 + service/applicationcostprofiler/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../applicationdiscoveryservice/api_client.go | 22 + .../applicationdiscoveryservice/endpoints.go | 19 +- .../generated.json | 1 + service/applicationdiscoveryservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/applicationinsights/api_client.go | 22 + service/applicationinsights/endpoints.go | 19 +- service/applicationinsights/generated.json | 1 + service/applicationinsights/go.mod | 3 + .../internal/endpoints/endpoints.go | 59 ++- service/appmesh/api_client.go | 22 + service/appmesh/endpoints.go | 19 +- service/appmesh/generated.json | 1 + service/appmesh/go.mod | 3 + .../appmesh/internal/endpoints/endpoints.go | 37 ++ service/apprunner/api_client.go | 22 + service/apprunner/endpoints.go | 19 +- service/apprunner/generated.json | 1 + service/apprunner/go.mod | 3 + .../apprunner/internal/endpoints/endpoints.go | 37 ++ service/appstream/api_client.go | 22 + service/appstream/endpoints.go | 19 +- service/appstream/generated.json | 1 + service/appstream/go.mod | 3 + .../appstream/internal/endpoints/endpoints.go | 37 ++ service/appsync/api_client.go | 22 + service/appsync/endpoints.go | 19 +- service/appsync/generated.json | 1 + service/appsync/go.mod | 3 + .../appsync/internal/endpoints/endpoints.go | 37 ++ service/athena/api_client.go | 22 + service/athena/endpoints.go | 19 +- service/athena/generated.json | 1 + service/athena/go.mod | 3 + .../athena/internal/endpoints/endpoints.go | 37 ++ service/auditmanager/api_client.go | 22 + service/auditmanager/endpoints.go | 19 +- service/auditmanager/generated.json | 1 + service/auditmanager/go.mod | 3 + .../internal/endpoints/endpoints.go | 49 ++- service/autoscaling/api_client.go | 22 + service/autoscaling/endpoints.go | 19 +- service/autoscaling/generated.json | 1 + service/autoscaling/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/autoscalingplans/api_client.go | 22 + service/autoscalingplans/endpoints.go | 19 +- service/autoscalingplans/generated.json | 1 + service/autoscalingplans/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/backup/api_client.go | 22 + service/backup/endpoints.go | 19 +- service/backup/generated.json | 1 + service/backup/go.mod | 3 + .../backup/internal/endpoints/endpoints.go | 37 ++ service/batch/api_client.go | 22 + service/batch/endpoints.go | 19 +- service/batch/generated.json | 1 + service/batch/go.mod | 3 + service/batch/internal/endpoints/endpoints.go | 49 +++ service/braket/api_client.go | 22 + service/braket/endpoints.go | 19 +- service/braket/generated.json | 1 + service/braket/go.mod | 3 + .../braket/internal/endpoints/endpoints.go | 42 +- service/budgets/api_client.go | 22 + service/budgets/endpoints.go | 19 +- service/budgets/generated.json | 1 + service/budgets/go.mod | 3 + .../budgets/internal/endpoints/endpoints.go | 37 ++ service/chime/api_client.go | 22 + service/chime/endpoints.go | 19 +- service/chime/generated.json | 1 + service/chime/go.mod | 3 + service/chime/internal/endpoints/endpoints.go | 37 ++ service/cloud9/api_client.go | 22 + service/cloud9/endpoints.go | 19 +- service/cloud9/generated.json | 1 + service/cloud9/go.mod | 3 + .../cloud9/internal/endpoints/endpoints.go | 37 ++ service/clouddirectory/api_client.go | 22 + service/clouddirectory/endpoints.go | 19 +- service/clouddirectory/generated.json | 1 + service/clouddirectory/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudformation/api_client.go | 22 + service/cloudformation/endpoints.go | 19 +- service/cloudformation/generated.json | 1 + service/cloudformation/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudfront/api_client.go | 22 + service/cloudfront/endpoints.go | 19 +- service/cloudfront/generated.json | 1 + service/cloudfront/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudhsm/api_client.go | 22 + service/cloudhsm/endpoints.go | 19 +- service/cloudhsm/generated.json | 1 + service/cloudhsm/go.mod | 3 + .../cloudhsm/internal/endpoints/endpoints.go | 37 ++ service/cloudhsmv2/api_client.go | 22 + service/cloudhsmv2/endpoints.go | 19 +- service/cloudhsmv2/generated.json | 1 + service/cloudhsmv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudsearch/api_client.go | 22 + service/cloudsearch/endpoints.go | 19 +- service/cloudsearch/generated.json | 1 + service/cloudsearch/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudsearchdomain/api_client.go | 22 + service/cloudsearchdomain/endpoints.go | 19 +- service/cloudsearchdomain/generated.json | 1 + service/cloudsearchdomain/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudtrail/api_client.go | 22 + service/cloudtrail/endpoints.go | 19 +- service/cloudtrail/generated.json | 1 + service/cloudtrail/go.mod | 3 + .../internal/endpoints/endpoints.go | 83 ++++ service/cloudwatch/api_client.go | 22 + service/cloudwatch/endpoints.go | 19 +- service/cloudwatch/generated.json | 1 + service/cloudwatch/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudwatchevents/api_client.go | 22 + service/cloudwatchevents/endpoints.go | 19 +- service/cloudwatchevents/generated.json | 1 + service/cloudwatchevents/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cloudwatchlogs/api_client.go | 22 + service/cloudwatchlogs/endpoints.go | 19 +- service/cloudwatchlogs/generated.json | 1 + service/cloudwatchlogs/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/codeartifact/api_client.go | 22 + service/codeartifact/endpoints.go | 19 +- service/codeartifact/generated.json | 1 + service/codeartifact/go.mod | 3 + .../internal/endpoints/endpoints.go | 40 ++ service/codebuild/api_client.go | 22 + service/codebuild/endpoints.go | 19 +- service/codebuild/generated.json | 1 + service/codebuild/go.mod | 3 + .../codebuild/internal/endpoints/endpoints.go | 37 ++ service/codecommit/api_client.go | 22 + service/codecommit/endpoints.go | 19 +- service/codecommit/generated.json | 1 + service/codecommit/go.mod | 3 + .../internal/endpoints/endpoints.go | 38 ++ service/codedeploy/api_client.go | 22 + service/codedeploy/endpoints.go | 19 +- service/codedeploy/generated.json | 1 + service/codedeploy/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/codeguruprofiler/api_client.go | 22 + service/codeguruprofiler/endpoints.go | 19 +- service/codeguruprofiler/generated.json | 1 + service/codeguruprofiler/go.mod | 3 + .../internal/endpoints/endpoints.go | 49 ++- service/codegurureviewer/api_client.go | 22 + service/codegurureviewer/endpoints.go | 19 +- service/codegurureviewer/generated.json | 1 + service/codegurureviewer/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/codepipeline/api_client.go | 22 + service/codepipeline/endpoints.go | 19 +- service/codepipeline/generated.json | 1 + service/codepipeline/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/codestar/api_client.go | 22 + service/codestar/endpoints.go | 19 +- service/codestar/generated.json | 1 + service/codestar/go.mod | 3 + .../codestar/internal/endpoints/endpoints.go | 37 ++ service/codestarconnections/api_client.go | 22 + service/codestarconnections/endpoints.go | 19 +- service/codestarconnections/generated.json | 1 + service/codestarconnections/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/codestarnotifications/api_client.go | 22 + service/codestarnotifications/endpoints.go | 19 +- service/codestarnotifications/generated.json | 1 + service/codestarnotifications/go.mod | 3 + .../internal/endpoints/endpoints.go | 57 ++- service/cognitoidentity/api_client.go | 22 + service/cognitoidentity/endpoints.go | 19 +- service/cognitoidentity/generated.json | 1 + service/cognitoidentity/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cognitoidentityprovider/api_client.go | 22 + service/cognitoidentityprovider/endpoints.go | 19 +- .../cognitoidentityprovider/generated.json | 1 + service/cognitoidentityprovider/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/cognitosync/api_client.go | 22 + service/cognitosync/endpoints.go | 19 +- service/cognitosync/generated.json | 1 + service/cognitosync/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/commander/api_client.go | 22 + service/commander/endpoints.go | 19 +- service/commander/generated.json | 1 + service/commander/go.mod | 3 + .../commander/internal/endpoints/endpoints.go | 37 ++ service/comprehend/api_client.go | 22 + service/comprehend/endpoints.go | 19 +- service/comprehend/generated.json | 1 + service/comprehend/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/comprehendmedical/api_client.go | 22 + service/comprehendmedical/endpoints.go | 19 +- service/comprehendmedical/generated.json | 1 + service/comprehendmedical/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/computeoptimizer/api_client.go | 22 + service/computeoptimizer/endpoints.go | 19 +- service/computeoptimizer/generated.json | 1 + service/computeoptimizer/go.mod | 3 + .../internal/endpoints/endpoints.go | 55 ++- service/configservice/api_client.go | 22 + service/configservice/endpoints.go | 19 +- service/configservice/generated.json | 1 + service/configservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/connect/api_client.go | 22 + service/connect/endpoints.go | 19 +- service/connect/generated.json | 1 + service/connect/go.mod | 3 + .../connect/internal/endpoints/endpoints.go | 37 ++ service/connectcontactlens/api_client.go | 22 + service/connectcontactlens/endpoints.go | 19 +- service/connectcontactlens/generated.json | 1 + service/connectcontactlens/go.mod | 3 + .../internal/endpoints/endpoints.go | 38 ++ service/connectparticipant/api_client.go | 22 + service/connectparticipant/endpoints.go | 19 +- service/connectparticipant/generated.json | 1 + service/connectparticipant/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../costandusagereportservice/api_client.go | 22 + .../costandusagereportservice/endpoints.go | 19 +- .../costandusagereportservice/generated.json | 1 + service/costandusagereportservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/costexplorer/api_client.go | 22 + service/costexplorer/endpoints.go | 19 +- service/costexplorer/generated.json | 1 + service/costexplorer/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/customerprofiles/api_client.go | 22 + service/customerprofiles/endpoints.go | 19 +- service/customerprofiles/generated.json | 1 + service/customerprofiles/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../databasemigrationservice/api_client.go | 22 + service/databasemigrationservice/endpoints.go | 19 +- .../databasemigrationservice/generated.json | 1 + service/databasemigrationservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/databrew/api_client.go | 22 + service/databrew/endpoints.go | 19 +- service/databrew/generated.json | 1 + service/databrew/go.mod | 3 + .../databrew/internal/endpoints/endpoints.go | 37 ++ service/dataexchange/api_client.go | 22 + service/dataexchange/endpoints.go | 19 +- service/dataexchange/generated.json | 1 + service/dataexchange/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/datapipeline/api_client.go | 22 + service/datapipeline/endpoints.go | 19 +- service/datapipeline/generated.json | 1 + service/datapipeline/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/datasync/api_client.go | 22 + service/datasync/endpoints.go | 19 +- service/datasync/generated.json | 1 + service/datasync/go.mod | 3 + .../datasync/internal/endpoints/endpoints.go | 37 ++ service/dax/api_client.go | 22 + service/dax/endpoints.go | 19 +- service/dax/generated.json | 1 + service/dax/go.mod | 3 + service/dax/internal/endpoints/endpoints.go | 37 ++ service/detective/api_client.go | 22 + service/detective/endpoints.go | 19 +- service/detective/generated.json | 1 + service/detective/go.mod | 3 + .../detective/internal/endpoints/endpoints.go | 37 ++ service/devicefarm/api_client.go | 22 + service/devicefarm/endpoints.go | 19 +- service/devicefarm/generated.json | 1 + service/devicefarm/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/devopsguru/api_client.go | 22 + service/devopsguru/endpoints.go | 19 +- service/devopsguru/generated.json | 1 + service/devopsguru/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/directconnect/api_client.go | 22 + service/directconnect/endpoints.go | 19 +- service/directconnect/generated.json | 1 + service/directconnect/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/directoryservice/api_client.go | 22 + service/directoryservice/endpoints.go | 19 +- service/directoryservice/generated.json | 1 + service/directoryservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/dlm/api_client.go | 22 + service/dlm/endpoints.go | 19 +- service/dlm/generated.json | 1 + service/dlm/go.mod | 3 + service/dlm/internal/endpoints/endpoints.go | 68 +-- service/docdb/api_client.go | 22 + service/docdb/endpoints.go | 19 +- service/docdb/generated.json | 1 + service/docdb/go.mod | 3 + service/docdb/internal/endpoints/endpoints.go | 37 ++ service/dynamodb/api_client.go | 22 + service/dynamodb/endpoints.go | 19 +- service/dynamodb/generated.json | 1 + service/dynamodb/go.mod | 3 + .../dynamodb/internal/endpoints/endpoints.go | 37 ++ service/dynamodbstreams/api_client.go | 22 + service/dynamodbstreams/endpoints.go | 19 +- service/dynamodbstreams/generated.json | 1 + service/dynamodbstreams/go.mod | 3 + .../internal/endpoints/endpoints.go | 110 ++++- service/ebs/api_client.go | 22 + service/ebs/endpoints.go | 19 +- service/ebs/generated.json | 1 + service/ebs/go.mod | 3 + service/ebs/internal/endpoints/endpoints.go | 37 ++ service/ec2/api_client.go | 22 + service/ec2/endpoints.go | 19 +- service/ec2/generated.json | 1 + service/ec2/go.mod | 3 + service/ec2/internal/endpoints/endpoints.go | 123 ++++-- service/ec2instanceconnect/api_client.go | 22 + service/ec2instanceconnect/endpoints.go | 19 +- service/ec2instanceconnect/generated.json | 1 + service/ec2instanceconnect/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/ecr/api_client.go | 22 + service/ecr/endpoints.go | 19 +- service/ecr/generated.json | 1 + service/ecr/go.mod | 3 + service/ecr/internal/endpoints/endpoints.go | 37 ++ service/ecrpublic/api_client.go | 22 + service/ecrpublic/endpoints.go | 19 +- service/ecrpublic/generated.json | 1 + service/ecrpublic/go.mod | 3 + .../ecrpublic/internal/endpoints/endpoints.go | 45 +- service/ecs/api_client.go | 22 + service/ecs/endpoints.go | 19 +- service/ecs/generated.json | 1 + service/ecs/go.mod | 3 + service/ecs/internal/endpoints/endpoints.go | 37 ++ service/efs/api_client.go | 22 + service/efs/endpoints.go | 19 +- service/efs/generated.json | 1 + service/efs/go.mod | 3 + service/efs/internal/endpoints/endpoints.go | 37 ++ service/eks/api_client.go | 22 + service/eks/endpoints.go | 19 +- service/eks/generated.json | 1 + service/eks/go.mod | 3 + service/eks/internal/endpoints/endpoints.go | 37 ++ service/elasticache/api_client.go | 22 + service/elasticache/endpoints.go | 19 +- service/elasticache/generated.json | 1 + service/elasticache/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elasticbeanstalk/api_client.go | 22 + service/elasticbeanstalk/endpoints.go | 19 +- service/elasticbeanstalk/generated.json | 1 + service/elasticbeanstalk/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elasticinference/api_client.go | 22 + service/elasticinference/endpoints.go | 19 +- service/elasticinference/generated.json | 1 + service/elasticinference/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elasticloadbalancing/api_client.go | 22 + service/elasticloadbalancing/endpoints.go | 19 +- service/elasticloadbalancing/generated.json | 1 + service/elasticloadbalancing/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elasticloadbalancingv2/api_client.go | 22 + service/elasticloadbalancingv2/endpoints.go | 19 +- service/elasticloadbalancingv2/generated.json | 1 + service/elasticloadbalancingv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elasticsearchservice/api_client.go | 22 + service/elasticsearchservice/endpoints.go | 19 +- service/elasticsearchservice/generated.json | 1 + service/elasticsearchservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/elastictranscoder/api_client.go | 22 + service/elastictranscoder/endpoints.go | 19 +- service/elastictranscoder/generated.json | 1 + service/elastictranscoder/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/emr/api_client.go | 22 + service/emr/endpoints.go | 19 +- service/emr/generated.json | 1 + service/emr/go.mod | 3 + service/emr/internal/endpoints/endpoints.go | 37 ++ service/emrcontainers/api_client.go | 22 + service/emrcontainers/endpoints.go | 19 +- service/emrcontainers/generated.json | 1 + service/emrcontainers/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/eventbridge/api_client.go | 22 + service/eventbridge/endpoints.go | 19 +- service/eventbridge/generated.json | 1 + service/eventbridge/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/finspace/api_client.go | 22 + service/finspace/endpoints.go | 19 +- service/finspace/generated.json | 1 + service/finspace/go.mod | 3 + .../finspace/internal/endpoints/endpoints.go | 44 ++ service/finspacedata/api_client.go | 22 + service/finspacedata/endpoints.go | 19 +- service/finspacedata/generated.json | 1 + service/finspacedata/go.mod | 3 + .../internal/endpoints/endpoints.go | 44 ++ service/firehose/api_client.go | 22 + service/firehose/endpoints.go | 19 +- service/firehose/generated.json | 1 + service/firehose/go.mod | 3 + .../firehose/internal/endpoints/endpoints.go | 40 ++ service/fis/api_client.go | 22 + service/fis/endpoints.go | 19 +- service/fis/generated.json | 1 + service/fis/go.mod | 3 + service/fis/internal/endpoints/endpoints.go | 37 ++ service/fms/api_client.go | 22 + service/fms/endpoints.go | 19 +- service/fms/generated.json | 1 + service/fms/go.mod | 3 + service/fms/internal/endpoints/endpoints.go | 53 +++ service/forecast/api_client.go | 22 + service/forecast/endpoints.go | 19 +- service/forecast/generated.json | 1 + service/forecast/go.mod | 3 + .../forecast/internal/endpoints/endpoints.go | 37 ++ service/forecastquery/api_client.go | 22 + service/forecastquery/endpoints.go | 19 +- service/forecastquery/generated.json | 1 + service/forecastquery/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/frauddetector/api_client.go | 22 + service/frauddetector/endpoints.go | 19 +- service/frauddetector/generated.json | 1 + service/frauddetector/go.mod | 3 + .../internal/endpoints/endpoints.go | 45 +- service/fsx/api_client.go | 22 + service/fsx/endpoints.go | 19 +- service/fsx/generated.json | 1 + service/fsx/go.mod | 3 + service/fsx/internal/endpoints/endpoints.go | 37 ++ service/gamelift/api_client.go | 22 + service/gamelift/endpoints.go | 19 +- service/gamelift/generated.json | 1 + service/gamelift/go.mod | 3 + .../gamelift/internal/endpoints/endpoints.go | 43 ++ service/glacier/api_client.go | 22 + service/glacier/endpoints.go | 19 +- service/glacier/generated.json | 1 + service/glacier/go.mod | 3 + .../glacier/internal/endpoints/endpoints.go | 37 ++ service/globalaccelerator/api_client.go | 22 + service/globalaccelerator/endpoints.go | 19 +- service/globalaccelerator/generated.json | 1 + service/globalaccelerator/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/glue/api_client.go | 22 + service/glue/endpoints.go | 19 +- service/glue/generated.json | 1 + service/glue/go.mod | 3 + service/glue/internal/endpoints/endpoints.go | 37 ++ service/greengrass/api_client.go | 22 + service/greengrass/endpoints.go | 19 +- service/greengrass/generated.json | 1 + service/greengrass/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/greengrassv2/api_client.go | 22 + service/greengrassv2/endpoints.go | 19 +- service/greengrassv2/generated.json | 1 + service/greengrassv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/groundstation/api_client.go | 22 + service/groundstation/endpoints.go | 19 +- service/groundstation/generated.json | 1 + service/groundstation/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/guardduty/api_client.go | 22 + service/guardduty/endpoints.go | 19 +- service/guardduty/generated.json | 1 + service/guardduty/go.mod | 3 + .../guardduty/internal/endpoints/endpoints.go | 38 ++ service/health/api_client.go | 22 + service/health/endpoints.go | 19 +- service/health/generated.json | 1 + service/health/go.mod | 3 + .../health/internal/endpoints/endpoints.go | 47 +++ service/healthlake/api_client.go | 22 + service/healthlake/endpoints.go | 19 +- service/healthlake/generated.json | 1 + service/healthlake/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/honeycode/api_client.go | 22 + service/honeycode/endpoints.go | 19 +- service/honeycode/generated.json | 1 + service/honeycode/go.mod | 3 + .../honeycode/internal/endpoints/endpoints.go | 37 ++ service/iam/api_client.go | 22 + service/iam/endpoints.go | 19 +- service/iam/generated.json | 1 + service/iam/go.mod | 3 + service/iam/internal/endpoints/endpoints.go | 37 ++ service/identitystore/api_client.go | 22 + service/identitystore/endpoints.go | 19 +- service/identitystore/generated.json | 1 + service/identitystore/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/imagebuilder/api_client.go | 22 + service/imagebuilder/endpoints.go | 19 +- service/imagebuilder/generated.json | 1 + service/imagebuilder/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/inspector/api_client.go | 22 + service/inspector/endpoints.go | 19 +- service/inspector/generated.json | 1 + service/inspector/go.mod | 3 + .../inspector/internal/endpoints/endpoints.go | 37 ++ service/internal/benchmark/go.mod | 2 + service/internal/integrationtest/go.mod | 2 + service/internal/s3shared/update_endpoint.go | 2 + service/iot/api_client.go | 22 + service/iot/endpoints.go | 19 +- service/iot/generated.json | 1 + service/iot/go.mod | 3 + service/iot/internal/endpoints/endpoints.go | 37 ++ service/iot1clickdevicesservice/api_client.go | 22 + service/iot1clickdevicesservice/endpoints.go | 19 +- .../iot1clickdevicesservice/generated.json | 1 + service/iot1clickdevicesservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 40 +- service/iot1clickprojects/api_client.go | 22 + service/iot1clickprojects/endpoints.go | 19 +- service/iot1clickprojects/generated.json | 1 + service/iot1clickprojects/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotanalytics/api_client.go | 22 + service/iotanalytics/endpoints.go | 19 +- service/iotanalytics/generated.json | 1 + service/iotanalytics/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotdataplane/api_client.go | 22 + service/iotdataplane/endpoints.go | 19 +- service/iotdataplane/generated.json | 1 + service/iotdataplane/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotdeviceadvisor/api_client.go | 22 + service/iotdeviceadvisor/endpoints.go | 19 +- service/iotdeviceadvisor/generated.json | 1 + service/iotdeviceadvisor/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotevents/api_client.go | 22 + service/iotevents/endpoints.go | 19 +- service/iotevents/generated.json | 1 + service/iotevents/go.mod | 3 + .../iotevents/internal/endpoints/endpoints.go | 37 ++ service/ioteventsdata/api_client.go | 22 + service/ioteventsdata/endpoints.go | 19 +- service/ioteventsdata/generated.json | 1 + service/ioteventsdata/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotfleethub/api_client.go | 22 + service/iotfleethub/endpoints.go | 19 +- service/iotfleethub/generated.json | 1 + service/iotfleethub/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotjobsdataplane/api_client.go | 22 + service/iotjobsdataplane/endpoints.go | 19 +- service/iotjobsdataplane/generated.json | 1 + service/iotjobsdataplane/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotsecuretunneling/api_client.go | 22 + service/iotsecuretunneling/endpoints.go | 19 +- service/iotsecuretunneling/generated.json | 1 + service/iotsecuretunneling/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotsitewise/api_client.go | 22 + service/iotsitewise/endpoints.go | 19 +- service/iotsitewise/generated.json | 1 + service/iotsitewise/go.mod | 3 + .../internal/endpoints/endpoints.go | 40 +- service/iotthingsgraph/api_client.go | 22 + service/iotthingsgraph/endpoints.go | 19 +- service/iotthingsgraph/generated.json | 1 + service/iotthingsgraph/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/iotwireless/api_client.go | 22 + service/iotwireless/endpoints.go | 19 +- service/iotwireless/generated.json | 1 + service/iotwireless/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/ivs/api_client.go | 22 + service/ivs/endpoints.go | 19 +- service/ivs/generated.json | 1 + service/ivs/go.mod | 3 + service/ivs/internal/endpoints/endpoints.go | 42 +- service/kafka/api_client.go | 22 + service/kafka/endpoints.go | 19 +- service/kafka/generated.json | 1 + service/kafka/go.mod | 3 + service/kafka/internal/endpoints/endpoints.go | 37 ++ service/kendra/api_client.go | 22 + service/kendra/endpoints.go | 19 +- service/kendra/generated.json | 1 + service/kendra/go.mod | 3 + .../kendra/internal/endpoints/endpoints.go | 37 ++ service/kinesis/api_client.go | 22 + service/kinesis/endpoints.go | 19 +- service/kinesis/generated.json | 1 + service/kinesis/go.mod | 3 + .../kinesis/internal/endpoints/endpoints.go | 37 ++ service/kinesisanalytics/api_client.go | 22 + service/kinesisanalytics/endpoints.go | 19 +- service/kinesisanalytics/generated.json | 1 + service/kinesisanalytics/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/kinesisanalyticsv2/api_client.go | 22 + service/kinesisanalyticsv2/endpoints.go | 19 +- service/kinesisanalyticsv2/generated.json | 1 + service/kinesisanalyticsv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/kinesisvideo/api_client.go | 22 + service/kinesisvideo/endpoints.go | 19 +- service/kinesisvideo/generated.json | 1 + service/kinesisvideo/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../kinesisvideoarchivedmedia/api_client.go | 22 + .../kinesisvideoarchivedmedia/endpoints.go | 19 +- .../kinesisvideoarchivedmedia/generated.json | 1 + service/kinesisvideoarchivedmedia/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/kinesisvideomedia/api_client.go | 22 + service/kinesisvideomedia/endpoints.go | 19 +- service/kinesisvideomedia/generated.json | 1 + service/kinesisvideomedia/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/kinesisvideosignaling/api_client.go | 22 + service/kinesisvideosignaling/endpoints.go | 19 +- service/kinesisvideosignaling/generated.json | 1 + service/kinesisvideosignaling/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/kms/api_client.go | 22 + service/kms/endpoints.go | 19 +- service/kms/generated.json | 1 + service/kms/go.mod | 3 + service/kms/internal/endpoints/endpoints.go | 37 ++ service/lakeformation/api_client.go | 22 + service/lakeformation/endpoints.go | 19 +- service/lakeformation/generated.json | 1 + service/lakeformation/go.mod | 3 + .../internal/endpoints/endpoints.go | 41 +- service/lambda/api_client.go | 22 + service/lambda/endpoints.go | 19 +- service/lambda/generated.json | 1 + service/lambda/go.mod | 3 + .../lambda/internal/endpoints/endpoints.go | 37 ++ service/lexmodelbuildingservice/api_client.go | 22 + service/lexmodelbuildingservice/endpoints.go | 19 +- .../lexmodelbuildingservice/generated.json | 1 + service/lexmodelbuildingservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/lexmodelsv2/api_client.go | 22 + service/lexmodelsv2/endpoints.go | 19 +- service/lexmodelsv2/generated.json | 1 + service/lexmodelsv2/go.mod | 3 + .../internal/endpoints/endpoints.go | 47 ++- service/lexruntimeservice/api_client.go | 22 + service/lexruntimeservice/endpoints.go | 19 +- service/lexruntimeservice/generated.json | 1 + service/lexruntimeservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/lexruntimev2/api_client.go | 22 + service/lexruntimev2/endpoints.go | 19 +- service/lexruntimev2/generated.json | 1 + service/lexruntimev2/go.mod | 3 + .../internal/endpoints/endpoints.go | 47 ++- service/licensemanager/api_client.go | 22 + service/licensemanager/endpoints.go | 19 +- service/licensemanager/generated.json | 1 + service/licensemanager/go.mod | 3 + .../internal/endpoints/endpoints.go | 38 ++ service/lightsail/api_client.go | 22 + service/lightsail/endpoints.go | 19 +- service/lightsail/generated.json | 1 + service/lightsail/go.mod | 3 + .../lightsail/internal/endpoints/endpoints.go | 37 ++ service/location/api_client.go | 22 + service/location/endpoints.go | 19 +- service/location/generated.json | 1 + service/location/go.mod | 3 + .../location/internal/endpoints/endpoints.go | 37 ++ service/lookoutequipment/api_client.go | 22 + service/lookoutequipment/endpoints.go | 19 +- service/lookoutequipment/generated.json | 1 + service/lookoutequipment/go.mod | 3 + .../internal/endpoints/endpoints.go | 42 ++ service/lookoutmetrics/api_client.go | 22 + service/lookoutmetrics/endpoints.go | 19 +- service/lookoutmetrics/generated.json | 1 + service/lookoutmetrics/go.mod | 3 + .../internal/endpoints/endpoints.go | 48 ++- service/lookoutvision/api_client.go | 22 + service/lookoutvision/endpoints.go | 19 +- service/lookoutvision/generated.json | 1 + service/lookoutvision/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/machinelearning/api_client.go | 22 + service/machinelearning/endpoints.go | 19 +- service/machinelearning/generated.json | 1 + service/machinelearning/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/macie/api_client.go | 22 + service/macie/endpoints.go | 19 +- service/macie/generated.json | 1 + service/macie/go.mod | 3 + service/macie/internal/endpoints/endpoints.go | 37 ++ service/macie2/api_client.go | 22 + service/macie2/endpoints.go | 19 +- service/macie2/generated.json | 1 + service/macie2/go.mod | 3 + .../macie2/internal/endpoints/endpoints.go | 38 ++ service/managedblockchain/api_client.go | 22 + service/managedblockchain/endpoints.go | 19 +- service/managedblockchain/generated.json | 1 + service/managedblockchain/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/marketplacecatalog/api_client.go | 22 + service/marketplacecatalog/endpoints.go | 19 +- service/marketplacecatalog/generated.json | 1 + service/marketplacecatalog/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../api_client.go | 22 + .../marketplacecommerceanalytics/endpoints.go | 19 +- .../generated.json | 1 + service/marketplacecommerceanalytics/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../api_client.go | 22 + .../endpoints.go | 19 +- .../generated.json | 1 + service/marketplaceentitlementservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/marketplacemetering/api_client.go | 22 + service/marketplacemetering/endpoints.go | 19 +- service/marketplacemetering/generated.json | 1 + service/marketplacemetering/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mediaconnect/api_client.go | 22 + service/mediaconnect/endpoints.go | 19 +- service/mediaconnect/generated.json | 1 + service/mediaconnect/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mediaconvert/api_client.go | 22 + service/mediaconvert/endpoints.go | 19 +- service/mediaconvert/generated.json | 1 + service/mediaconvert/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/medialive/api_client.go | 22 + service/medialive/endpoints.go | 19 +- service/medialive/generated.json | 1 + service/medialive/go.mod | 3 + .../medialive/internal/endpoints/endpoints.go | 37 ++ service/mediapackage/api_client.go | 22 + service/mediapackage/endpoints.go | 19 +- service/mediapackage/generated.json | 1 + service/mediapackage/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mediapackagevod/api_client.go | 22 + service/mediapackagevod/endpoints.go | 19 +- service/mediapackagevod/generated.json | 1 + service/mediapackagevod/go.mod | 3 + .../internal/endpoints/endpoints.go | 53 ++- service/mediastore/api_client.go | 22 + service/mediastore/endpoints.go | 19 +- service/mediastore/generated.json | 1 + service/mediastore/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mediastoredata/api_client.go | 22 + service/mediastoredata/endpoints.go | 19 +- service/mediastoredata/generated.json | 1 + service/mediastoredata/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mediatailor/api_client.go | 22 + service/mediatailor/endpoints.go | 19 +- service/mediatailor/generated.json | 1 + service/mediatailor/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mgn/api_client.go | 22 + service/mgn/endpoints.go | 19 +- service/mgn/generated.json | 1 + service/mgn/go.mod | 3 + service/mgn/internal/endpoints/endpoints.go | 37 ++ service/migrationhub/api_client.go | 22 + service/migrationhub/endpoints.go | 19 +- service/migrationhub/generated.json | 1 + service/migrationhub/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/migrationhubconfig/api_client.go | 22 + service/migrationhubconfig/endpoints.go | 19 +- service/migrationhubconfig/generated.json | 1 + service/migrationhubconfig/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/mobile/api_client.go | 22 + service/mobile/endpoints.go | 19 +- service/mobile/generated.json | 1 + service/mobile/go.mod | 3 + .../mobile/internal/endpoints/endpoints.go | 37 ++ service/mq/api_client.go | 22 + service/mq/endpoints.go | 19 +- service/mq/generated.json | 1 + service/mq/go.mod | 3 + service/mq/internal/endpoints/endpoints.go | 41 ++ service/mturk/api_client.go | 22 + service/mturk/endpoints.go | 19 +- service/mturk/generated.json | 1 + service/mturk/go.mod | 3 + service/mturk/internal/endpoints/endpoints.go | 37 ++ service/mwaa/api_client.go | 22 + service/mwaa/endpoints.go | 19 +- service/mwaa/generated.json | 1 + service/mwaa/go.mod | 3 + service/mwaa/internal/endpoints/endpoints.go | 37 ++ service/neptune/api_client.go | 22 + service/neptune/endpoints.go | 19 +- service/neptune/generated.json | 1 + service/neptune/go.mod | 3 + .../neptune/internal/endpoints/endpoints.go | 37 ++ service/networkfirewall/api_client.go | 22 + service/networkfirewall/endpoints.go | 19 +- service/networkfirewall/generated.json | 1 + service/networkfirewall/go.mod | 3 + .../internal/endpoints/endpoints.go | 47 ++- service/networkmanager/api_client.go | 22 + service/networkmanager/endpoints.go | 19 +- service/networkmanager/generated.json | 1 + service/networkmanager/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/nimble/api_client.go | 22 + service/nimble/endpoints.go | 19 +- service/nimble/generated.json | 1 + service/nimble/go.mod | 3 + .../nimble/internal/endpoints/endpoints.go | 37 ++ service/opsworks/api_client.go | 22 + service/opsworks/endpoints.go | 19 +- service/opsworks/generated.json | 1 + service/opsworks/go.mod | 3 + .../opsworks/internal/endpoints/endpoints.go | 37 ++ service/opsworkscm/api_client.go | 22 + service/opsworkscm/endpoints.go | 19 +- service/opsworkscm/generated.json | 1 + service/opsworkscm/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/organizations/api_client.go | 22 + service/organizations/endpoints.go | 19 +- service/organizations/generated.json | 1 + service/organizations/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/outposts/api_client.go | 22 + service/outposts/endpoints.go | 19 +- service/outposts/generated.json | 1 + service/outposts/go.mod | 3 + .../outposts/internal/endpoints/endpoints.go | 37 ++ service/personalize/api_client.go | 22 + service/personalize/endpoints.go | 19 +- service/personalize/generated.json | 1 + service/personalize/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/personalizeevents/api_client.go | 22 + service/personalizeevents/endpoints.go | 19 +- service/personalizeevents/generated.json | 1 + service/personalizeevents/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/personalizeruntime/api_client.go | 22 + service/personalizeruntime/endpoints.go | 19 +- service/personalizeruntime/generated.json | 1 + service/personalizeruntime/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/pi/api_client.go | 22 + service/pi/endpoints.go | 19 +- service/pi/generated.json | 1 + service/pi/go.mod | 3 + service/pi/internal/endpoints/endpoints.go | 60 ++- service/pinpoint/api_client.go | 22 + service/pinpoint/endpoints.go | 19 +- service/pinpoint/generated.json | 1 + service/pinpoint/go.mod | 3 + .../pinpoint/internal/endpoints/endpoints.go | 37 ++ service/pinpointemail/api_client.go | 22 + service/pinpointemail/endpoints.go | 19 +- service/pinpointemail/generated.json | 1 + service/pinpointemail/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/pinpointsmsvoice/api_client.go | 22 + service/pinpointsmsvoice/endpoints.go | 19 +- service/pinpointsmsvoice/generated.json | 1 + service/pinpointsmsvoice/go.mod | 3 + .../internal/endpoints/endpoints.go | 45 +- service/polly/api_client.go | 22 + service/polly/endpoints.go | 19 +- service/polly/generated.json | 1 + service/polly/go.mod | 3 + service/polly/internal/endpoints/endpoints.go | 37 ++ service/pricing/api_client.go | 22 + service/pricing/endpoints.go | 19 +- service/pricing/generated.json | 1 + service/pricing/go.mod | 3 + .../pricing/internal/endpoints/endpoints.go | 37 ++ service/qldb/api_client.go | 22 + service/qldb/endpoints.go | 19 +- service/qldb/generated.json | 1 + service/qldb/go.mod | 3 + service/qldb/internal/endpoints/endpoints.go | 37 ++ service/qldbsession/api_client.go | 22 + service/qldbsession/endpoints.go | 19 +- service/qldbsession/generated.json | 1 + service/qldbsession/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/quicksight/api_client.go | 22 + service/quicksight/endpoints.go | 19 +- service/quicksight/generated.json | 1 + service/quicksight/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/ram/api_client.go | 22 + service/ram/endpoints.go | 19 +- service/ram/generated.json | 1 + service/ram/go.mod | 3 + service/ram/internal/endpoints/endpoints.go | 38 ++ service/rds/api_client.go | 22 + service/rds/endpoints.go | 19 +- service/rds/generated.json | 1 + service/rds/go.mod | 3 + service/rds/internal/endpoints/endpoints.go | 37 ++ service/rdsdata/api_client.go | 22 + service/rdsdata/endpoints.go | 19 +- service/rdsdata/generated.json | 1 + service/rdsdata/go.mod | 3 + .../rdsdata/internal/endpoints/endpoints.go | 37 ++ service/redshift/api_client.go | 22 + service/redshift/endpoints.go | 19 +- service/redshift/generated.json | 1 + service/redshift/go.mod | 3 + .../redshift/internal/endpoints/endpoints.go | 37 ++ service/redshiftdata/api_client.go | 22 + service/redshiftdata/endpoints.go | 19 +- service/redshiftdata/generated.json | 1 + service/redshiftdata/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/rekognition/api_client.go | 22 + service/rekognition/endpoints.go | 19 +- service/rekognition/generated.json | 1 + service/rekognition/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/resourcegroups/api_client.go | 22 + service/resourcegroups/endpoints.go | 19 +- service/resourcegroups/generated.json | 1 + service/resourcegroups/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../resourcegroupstaggingapi/api_client.go | 22 + service/resourcegroupstaggingapi/endpoints.go | 19 +- .../resourcegroupstaggingapi/generated.json | 1 + service/resourcegroupstaggingapi/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/robomaker/api_client.go | 22 + service/robomaker/endpoints.go | 19 +- service/robomaker/generated.json | 1 + service/robomaker/go.mod | 3 + .../robomaker/internal/endpoints/endpoints.go | 37 ++ service/route53/api_client.go | 22 + service/route53/endpoints.go | 19 +- service/route53/generated.json | 1 + service/route53/go.mod | 3 + .../route53/internal/endpoints/endpoints.go | 37 ++ service/route53domains/api_client.go | 22 + service/route53domains/endpoints.go | 19 +- service/route53domains/generated.json | 1 + service/route53domains/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/route53resolver/api_client.go | 22 + service/route53resolver/endpoints.go | 19 +- service/route53resolver/generated.json | 1 + service/route53resolver/go.mod | 3 + .../internal/endpoints/endpoints.go | 41 ++ service/s3/api_client.go | 33 +- service/s3/endpoints.go | 27 +- service/s3/generated.json | 1 + service/s3/go.mod | 3 + service/s3/internal/configtesting/go.mod | 2 + service/s3/internal/endpoints/endpoints.go | 397 ++++++++++-------- service/s3control/api_client.go | 33 +- service/s3control/endpoints.go | 27 +- service/s3control/generated.json | 1 + service/s3control/go.mod | 3 + .../s3control/internal/endpoints/endpoints.go | 343 ++++++++------- .../internal/endpoints/s3/endpoints.go | 397 ++++++++++-------- service/s3outposts/api_client.go | 22 + service/s3outposts/endpoints.go | 19 +- service/s3outposts/generated.json | 1 + service/s3outposts/go.mod | 3 + .../internal/endpoints/endpoints.go | 59 ++- service/sagemaker/api_client.go | 22 + service/sagemaker/endpoints.go | 19 +- service/sagemaker/generated.json | 1 + service/sagemaker/go.mod | 3 + .../sagemaker/internal/endpoints/endpoints.go | 37 ++ service/sagemakera2iruntime/api_client.go | 22 + service/sagemakera2iruntime/endpoints.go | 19 +- service/sagemakera2iruntime/generated.json | 1 + service/sagemakera2iruntime/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/sagemakeredge/api_client.go | 22 + service/sagemakeredge/endpoints.go | 19 +- service/sagemakeredge/generated.json | 1 + service/sagemakeredge/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../api_client.go | 22 + .../sagemakerfeaturestoreruntime/endpoints.go | 19 +- .../generated.json | 1 + service/sagemakerfeaturestoreruntime/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/sagemakerruntime/api_client.go | 22 + service/sagemakerruntime/endpoints.go | 19 +- service/sagemakerruntime/generated.json | 1 + service/sagemakerruntime/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/savingsplans/api_client.go | 22 + service/savingsplans/endpoints.go | 19 +- service/savingsplans/generated.json | 1 + service/savingsplans/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/schemas/api_client.go | 22 + service/schemas/endpoints.go | 19 +- service/schemas/generated.json | 1 + service/schemas/go.mod | 3 + .../schemas/internal/endpoints/endpoints.go | 37 ++ service/secretsmanager/api_client.go | 22 + service/secretsmanager/endpoints.go | 19 +- service/secretsmanager/generated.json | 1 + service/secretsmanager/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/securityhub/api_client.go | 22 + service/securityhub/endpoints.go | 19 +- service/securityhub/generated.json | 1 + service/securityhub/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ .../api_client.go | 22 + .../endpoints.go | 19 +- .../generated.json | 1 + .../serverlessapplicationrepository/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/servicecatalog/api_client.go | 22 + service/servicecatalog/endpoints.go | 19 +- service/servicecatalog/generated.json | 1 + service/servicecatalog/go.mod | 3 + .../internal/endpoints/endpoints.go | 38 ++ .../servicecatalogappregistry/api_client.go | 22 + .../servicecatalogappregistry/endpoints.go | 19 +- .../servicecatalogappregistry/generated.json | 1 + service/servicecatalogappregistry/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/servicediscovery/api_client.go | 22 + service/servicediscovery/endpoints.go | 19 +- service/servicediscovery/generated.json | 1 + service/servicediscovery/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/servicequotas/api_client.go | 22 + service/servicequotas/endpoints.go | 19 +- service/servicequotas/generated.json | 1 + service/servicequotas/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/ses/api_client.go | 22 + service/ses/endpoints.go | 19 +- service/ses/generated.json | 1 + service/ses/go.mod | 3 + service/ses/internal/endpoints/endpoints.go | 37 ++ service/sesv2/api_client.go | 22 + service/sesv2/endpoints.go | 19 +- service/sesv2/generated.json | 1 + service/sesv2/go.mod | 3 + service/sesv2/internal/endpoints/endpoints.go | 37 ++ service/sfn/api_client.go | 22 + service/sfn/endpoints.go | 19 +- service/sfn/generated.json | 1 + service/sfn/go.mod | 3 + service/sfn/internal/endpoints/endpoints.go | 37 ++ service/shield/api_client.go | 22 + service/shield/endpoints.go | 19 +- service/shield/generated.json | 1 + service/shield/go.mod | 3 + .../shield/internal/endpoints/endpoints.go | 37 ++ service/signer/api_client.go | 22 + service/signer/endpoints.go | 19 +- service/signer/generated.json | 1 + service/signer/go.mod | 3 + .../signer/internal/endpoints/endpoints.go | 67 +-- service/sms/api_client.go | 22 + service/sms/endpoints.go | 19 +- service/sms/generated.json | 1 + service/sms/go.mod | 3 + service/sms/internal/endpoints/endpoints.go | 37 ++ service/snowball/api_client.go | 22 + service/snowball/endpoints.go | 19 +- service/snowball/generated.json | 1 + service/snowball/go.mod | 3 + .../snowball/internal/endpoints/endpoints.go | 37 ++ service/sns/api_client.go | 22 + service/sns/endpoints.go | 19 +- service/sns/generated.json | 1 + service/sns/go.mod | 3 + service/sns/internal/endpoints/endpoints.go | 37 ++ service/sqs/api_client.go | 22 + service/sqs/endpoints.go | 19 +- service/sqs/generated.json | 1 + service/sqs/go.mod | 3 + service/sqs/internal/endpoints/endpoints.go | 37 ++ service/ssm/api_client.go | 22 + service/ssm/endpoints.go | 19 +- service/ssm/generated.json | 1 + service/ssm/go.mod | 3 + service/ssm/internal/endpoints/endpoints.go | 37 ++ service/ssmcontacts/api_client.go | 22 + service/ssmcontacts/endpoints.go | 19 +- service/ssmcontacts/generated.json | 1 + service/ssmcontacts/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/sso/api_client.go | 22 + service/sso/endpoints.go | 19 +- service/sso/generated.json | 1 + service/sso/go.mod | 3 + service/sso/internal/endpoints/endpoints.go | 37 ++ service/ssoadmin/api_client.go | 22 + service/ssoadmin/endpoints.go | 19 +- service/ssoadmin/generated.json | 1 + service/ssoadmin/go.mod | 3 + .../ssoadmin/internal/endpoints/endpoints.go | 37 ++ service/ssooidc/api_client.go | 22 + service/ssooidc/endpoints.go | 19 +- service/ssooidc/generated.json | 1 + service/ssooidc/go.mod | 3 + .../ssooidc/internal/endpoints/endpoints.go | 37 ++ service/storagegateway/api_client.go | 22 + service/storagegateway/endpoints.go | 19 +- service/storagegateway/generated.json | 1 + service/storagegateway/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/sts/api_client.go | 22 + service/sts/endpoints.go | 19 +- service/sts/generated.json | 1 + service/sts/go.mod | 3 + service/sts/internal/endpoints/endpoints.go | 37 ++ service/support/api_client.go | 22 + service/support/endpoints.go | 19 +- service/support/generated.json | 1 + service/support/go.mod | 3 + .../support/internal/endpoints/endpoints.go | 37 ++ service/swf/api_client.go | 22 + service/swf/endpoints.go | 19 +- service/swf/generated.json | 1 + service/swf/go.mod | 3 + service/swf/internal/endpoints/endpoints.go | 37 ++ service/synthetics/api_client.go | 22 + service/synthetics/endpoints.go | 19 +- service/synthetics/generated.json | 1 + service/synthetics/go.mod | 3 + .../internal/endpoints/endpoints.go | 67 +-- service/textract/api_client.go | 22 + service/textract/endpoints.go | 19 +- service/textract/generated.json | 1 + service/textract/go.mod | 3 + .../textract/internal/endpoints/endpoints.go | 98 ++--- service/timestreamquery/api_client.go | 22 + service/timestreamquery/endpoints.go | 19 +- service/timestreamquery/generated.json | 1 + service/timestreamquery/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/timestreamwrite/api_client.go | 22 + service/timestreamwrite/endpoints.go | 19 +- service/timestreamwrite/generated.json | 1 + service/timestreamwrite/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/transcribe/api_client.go | 22 + service/transcribe/endpoints.go | 19 +- service/transcribe/generated.json | 1 + service/transcribe/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/transfer/api_client.go | 22 + service/transfer/endpoints.go | 19 +- service/transfer/generated.json | 1 + service/transfer/go.mod | 3 + .../transfer/internal/endpoints/endpoints.go | 38 ++ service/translate/api_client.go | 22 + service/translate/endpoints.go | 19 +- service/translate/generated.json | 1 + service/translate/go.mod | 3 + .../translate/internal/endpoints/endpoints.go | 37 ++ service/waf/api_client.go | 22 + service/waf/endpoints.go | 19 +- service/waf/generated.json | 1 + service/waf/go.mod | 3 + service/waf/internal/endpoints/endpoints.go | 37 ++ service/wafregional/api_client.go | 22 + service/wafregional/endpoints.go | 19 +- service/wafregional/generated.json | 1 + service/wafregional/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/wafv2/api_client.go | 22 + service/wafv2/endpoints.go | 19 +- service/wafv2/generated.json | 1 + service/wafv2/go.mod | 3 + service/wafv2/internal/endpoints/endpoints.go | 37 ++ service/wellarchitected/api_client.go | 22 + service/wellarchitected/endpoints.go | 19 +- service/wellarchitected/generated.json | 1 + service/wellarchitected/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/workdocs/api_client.go | 22 + service/workdocs/endpoints.go | 19 +- service/workdocs/generated.json | 1 + service/workdocs/go.mod | 3 + .../workdocs/internal/endpoints/endpoints.go | 37 ++ service/worklink/api_client.go | 22 + service/worklink/endpoints.go | 19 +- service/worklink/generated.json | 1 + service/worklink/go.mod | 3 + .../worklink/internal/endpoints/endpoints.go | 37 ++ service/workmail/api_client.go | 22 + service/workmail/endpoints.go | 19 +- service/workmail/generated.json | 1 + service/workmail/go.mod | 3 + .../workmail/internal/endpoints/endpoints.go | 37 ++ service/workmailmessageflow/api_client.go | 22 + service/workmailmessageflow/endpoints.go | 19 +- service/workmailmessageflow/generated.json | 1 + service/workmailmessageflow/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/workspaces/api_client.go | 22 + service/workspaces/endpoints.go | 19 +- service/workspaces/generated.json | 1 + service/workspaces/go.mod | 3 + .../internal/endpoints/endpoints.go | 37 ++ service/xray/api_client.go | 22 + service/xray/endpoints.go | 19 +- service/xray/generated.json | 1 + service/xray/go.mod | 3 + service/xray/internal/endpoints/endpoints.go | 37 ++ 1385 files changed, 23073 insertions(+), 1272 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java index 9bb6c1532e9..45c00b212b3 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java @@ -965,7 +965,7 @@ public EndpointGenerator build() { } } - private enum DualStackEndpointConstant { + enum DualStackEndpointConstant { UNSET("Unset" + DUAL_STACK_ENDPOINT_CONST_TYPE, "is the default value behavior for dual-stack endpoint " + "resolution."), ENABLE("Enable" + DUAL_STACK_ENDPOINT_CONST_TYPE, "enable dual-stack endpoint resolution for endpoints."), diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ResolveClientConfigFromSources.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ResolveClientConfigFromSources.java index 900b6dcb250..4b722a425d5 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ResolveClientConfigFromSources.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ResolveClientConfigFromSources.java @@ -1,6 +1,7 @@ package software.amazon.smithy.aws.go.codegen; import java.util.List; +import java.util.function.Consumer; import java.util.logging.Logger; import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.codegen.core.Symbol; @@ -111,11 +112,24 @@ private void generateUseUseDualStackResolver(Model model, ServiceShape serviceSh CONFIG_SOURCE_CONFIG_NAME); writer.write("if err != nil { return err }"); - if (isS3SharedService(model, serviceShape)) { - writer.write("if found { o.UseDualstack = value }"); - } else { - writer.write("if found { o.EndpointOptions.UseDualStack = &value }"); - } + Consumer setValue = (String destination) -> { + writer.openBlock("if value {", "", () -> { + writer.write("$L = $L", destination, + EndpointGenerator.DualStackEndpointConstant.ENABLE.getConstantName()); + writer.openBlock("} else {", "}", () -> { + writer.write("$L = $L", destination, + EndpointGenerator.DualStackEndpointConstant.DISABLE.getConstantName()); + }); + }); + }; + + writer.openBlock("if found {", "}", () -> { + if (isS3SharedService(model, serviceShape)) { + setValue.accept("o.UseDualStack"); + } else { + setValue.accept("o.EndpointOptions.UseDualStack"); + } + }); }); writer.write(""); } diff --git a/config/go.mod b/config/go.mod index 12e0b72250f..ad5f635b511 100644 --- a/config/go.mod +++ b/config/go.mod @@ -21,6 +21,8 @@ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../feature/ec2/imds/ replace github.com/aws/aws-sdk-go-v2/internal/ini => ../internal/ini/ +replace github.com/aws/aws-sdk-go-v2/service/internal/config => ../service/internal/config/ + 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/credentials/go.mod b/credentials/go.mod index 9e88907273a..e9c54513d03 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/service/internal/config => ../service/internal/config/ + 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 fdfa970f825..d9ffc6636fd 100644 --- a/example/service/s3/listObjects/go.mod +++ b/example/service/s3/listObjects/go.mod @@ -19,6 +19,8 @@ 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/ +replace github.com/aws/aws-sdk-go-v2/service/internal/config => ../../../../service/internal/config/ + 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/internal/s3shared => ../../../../service/internal/s3shared/ diff --git a/example/service/s3/usingPrivateLink/go.mod b/example/service/s3/usingPrivateLink/go.mod index 366ab88b7e2..84d76a191ae 100644 --- a/example/service/s3/usingPrivateLink/go.mod +++ b/example/service/s3/usingPrivateLink/go.mod @@ -21,6 +21,8 @@ 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/ +replace github.com/aws/aws-sdk-go-v2/service/internal/config => ../../../../service/internal/config/ + 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/internal/s3shared => ../../../../service/internal/s3shared/ diff --git a/feature/dynamodb/attributevalue/go.mod b/feature/dynamodb/attributevalue/go.mod index b249093fda6..90735c614f3 100644 --- a/feature/dynamodb/attributevalue/go.mod +++ b/feature/dynamodb/attributevalue/go.mod @@ -16,3 +16,5 @@ replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamo replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ 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/config => ../../../service/internal/config/ diff --git a/feature/dynamodb/expression/go.mod b/feature/dynamodb/expression/go.mod index 14e2914deb9..723b35db055 100644 --- a/feature/dynamodb/expression/go.mod +++ b/feature/dynamodb/expression/go.mod @@ -17,3 +17,5 @@ replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamo replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ 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/config => ../../../service/internal/config/ diff --git a/feature/dynamodbstreams/attributevalue/go.mod b/feature/dynamodbstreams/attributevalue/go.mod index 832c9708cd7..592390d5cc8 100644 --- a/feature/dynamodbstreams/attributevalue/go.mod +++ b/feature/dynamodbstreams/attributevalue/go.mod @@ -16,3 +16,5 @@ replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamo replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ 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/config => ../../../service/internal/config/ diff --git a/feature/s3/manager/go.mod b/feature/s3/manager/go.mod index e321a809966..1521aeb27c6 100644 --- a/feature/s3/manager/go.mod +++ b/feature/s3/manager/go.mod @@ -22,6 +22,8 @@ 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/ +replace github.com/aws/aws-sdk-go-v2/service/internal/config => ../../../service/internal/config/ + 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/internal/s3shared => ../../../service/internal/s3shared/ diff --git a/internal/protocoltest/awsrestjson/api_client.go b/internal/protocoltest/awsrestjson/api_client.go index f0fe5258307..a6368f0aa0c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3c8969485f2 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/service/internal/config": "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..aa698b2c52a 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..3d86da74743 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..808934878ac 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/service/internal/config": "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..cd10ffe555c 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..4de404fd653 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2472cb0d071 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/service/internal/config": "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..11dfae1cd81 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..d374da3d9ed 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e2a265abbed 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/service/internal/config": "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..d971b1d48b0 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..89000ef3df0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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/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..698059ae6c2 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/service/internal/config": "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..303450b74e7 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..303dcbb0115 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..71f65a06ea2 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/service/internal/config": "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..01df61e2073 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..4659cc29157 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..935e091927d 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/service/internal/config": "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..f0757d8851b 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/service/internal/config 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/service/internal/config => ../../../service/internal/config/ 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..7ee67a62c5c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2cff2cde6d2 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/service/internal/config": "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..b2928a89ea6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7858936edfd 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b59266af179 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/service/internal/config": "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..68b711827bf 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e30af78dc6d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c16e70600f9 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/service/internal/config": "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..72750fc076a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9319d04d9c4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e593bca33a3 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/service/internal/config": "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..8f92fd22ca0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1f34b3e833e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2284e1e653c 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/service/internal/config": "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..e89c01354e0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b032740b754 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..61d93c27b03 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/service/internal/config": "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..e63f65bfb15 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e2e9bef244a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f64b1c195ac 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/service/internal/config": "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..c6dd9b47559 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a0b8465f7ac 100644 --- a/service/apigateway/api_client.go +++ b/service/apigateway/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" agcust "github.com/aws/aws-sdk-go-v2/service/apigateway/internal/customizations" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4d8931124ff 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/service/internal/config": "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..a32f6f7a1f9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3d9e6e26d96 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..98fc4e96e25 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/service/internal/config": "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..1626b393c70 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..0fd7e94fadc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a0ee50a17c4 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/service/internal/config": "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..5d76f22fb05 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..503f4567ccb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f629eb2ac50 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/service/internal/config": "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..4ac02236abc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d367750dc24 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3b4ad84de5f 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/service/internal/config": "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..b6f4cdcc5f4 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..08c47e0969a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7765444a3f8 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/service/internal/config": "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..87c0e3d016e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1f1ad9434d3 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..36d42c64290 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/service/internal/config": "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..6c4e2106676 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..20232815f2a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..92d6b54c1a9 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/service/internal/config": "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..f9eba0e52cd 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a3c3355864d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3206186c7a4 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/service/internal/config": "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..1bff634e15e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1a1292e5127 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..10047476c01 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/service/internal/config": "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..6d1024a8208 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ddf10b3447a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0a5baca0da1 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/service/internal/config": "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..10b23eafab9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4cffcff3282 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7f6eb3c4687 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/service/internal/config": "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..669e98aa319 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..607876eec69 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1d5cd5bac98 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/service/internal/config": "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..c5f61ba0ab3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6b138ffc41d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..83f9f3bef26 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/service/internal/config": "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..3052d582941 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..8384782e33a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..20d37c135e6 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/service/internal/config": "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..a69ea02db6e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f00de22e422 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..07dbea6ebb4 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/service/internal/config": "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..40cfd83af1b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..96d6d6bceb6 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..886b36c9f9e 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/service/internal/config": "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..ae7184470c3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c8dd5372332 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6ea916a56bc 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/service/internal/config": "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..266d03d8eeb 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..dba97c45c88 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6ac6503479a 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/service/internal/config": "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..976e308aa58 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3e87adc3cd9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..dca535b5b0a 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/service/internal/config": "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..2650691ca3f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a2e9b128677 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c65af99007b 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/service/internal/config": "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..13d1ad8c643 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..91d4561eaad 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8b3ece43dad 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/service/internal/config": "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..41542d50e35 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..18c24bf00e9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..11dafa05fc7 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/service/internal/config": "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..5c4969162d2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..39a7dd7c3f5 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..baf5e709163 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/service/internal/config": "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..85849226125 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..5bd7c901f0b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..25726d2c2e0 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/service/internal/config": "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..b7bccde629b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f837f48f04b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4549704d432 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/service/internal/config": "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..48ee05a43d6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..8e7fef9cb4d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f83de343bb3 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/service/internal/config": "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..8b950c8d48a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b5c93a168d0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b46b2bcedc6 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/service/internal/config": "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..12cc2668490 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a296a281223 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5167e16e9cb 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/service/internal/config": "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..746766760b1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6d5af1e2512 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0c2425606d5 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/service/internal/config": "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..3f93e2521df 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4616768404c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..002613fc65c 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/service/internal/config": "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..826c5239613 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..5d27f8ab0e8 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..44ae5d1c93a 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/service/internal/config": "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..5520abc3661 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4b88bfbfe82 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5b3988256a5 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/service/internal/config": "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..12984fddf49 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..90f2ce74500 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b1a4600c2b5 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/service/internal/config": "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..11a27ce01d0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..168012b1969 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b8b55c7ef99 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/service/internal/config": "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..4b6e4a3c2ac 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..16830ce7bab 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..97a5f149eda 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/service/internal/config": "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..227af44cf22 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..64c2dea647e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1dd51078eb3 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/service/internal/config": "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..3d5e1d492c1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d0a1cd18647 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..838de36dbd7 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/service/internal/config": "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..35748165cea 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..fbfb4ae14a4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..54504aa8a32 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/service/internal/config": "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..981546073cd 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3ed2c2bdd4c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3a63ac492c4 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/service/internal/config": "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..eebe44f9099 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..0621450bd05 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..441cdafc9b0 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/service/internal/config": "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..6ec0a9a970b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7c7df007a57 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0d9663af8ae 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/service/internal/config": "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..cdcc5737248 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bad4881fe54 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b858f59f018 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/service/internal/config": "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..baf16ad0878 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9a69eb7f4e9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e940bfa54ea 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/service/internal/config": "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..e3a12776e43 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..2b154eaed06 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b1bb2591a93 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/service/internal/config": "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..89f0da9c767 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..525616b337f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..513baab54dd 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/service/internal/config": "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..cdb9f7833cc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a4976171ff5 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..37bf74f5cd2 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/service/internal/config": "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..ed8bc0535ab 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..045d25005b4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1be7999a4c6 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/service/internal/config": "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..565a540ea85 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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/commander/api_client.go b/service/commander/api_client.go index 24c5e245666..f1212e34962 100644 --- a/service/commander/api_client.go +++ b/service/commander/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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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/commander/endpoints.go b/service/commander/endpoints.go index fb4479d29bf..642902ddeb5 100644 --- a/service/commander/endpoints.go +++ b/service/commander/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = internalendpoints.UnsetDualStackEndpoint + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint DualStackEndpoint = internalendpoints.EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint DualStackEndpoint = internalendpoints.DisableDualStackEndpoint +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/commander/generated.json b/service/commander/generated.json index 48fa81fc18e..ffd42148298 100644 --- a/service/commander/generated.json +++ b/service/commander/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/service/internal/config": "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/commander/go.mod b/service/commander/go.mod index f087993ac72..b672007def5 100644 --- a/service/commander/go.mod +++ b/service/commander/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/service/internal/config 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/service/internal/config => ../../service/internal/config/ diff --git a/service/commander/internal/endpoints/endpoints.go b/service/commander/internal/endpoints/endpoints.go index bdcfb7cb4bc..21af8dc6962 100644 --- a/service/commander/internal/endpoints/endpoints.go +++ b/service/commander/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // UnsetDualStackEndpoint is the default value behavior for dual-stack endpoint + // resolution. + UnsetDualStackEndpoint DualStackEndpoint = iota + + // EnableDualStackEndpoint enable dual-stack endpoint resolution for endpoints. + EnableDualStackEndpoint + + // DisableDualStackEndpoint disables dual-stack endpoint resolution for endpoints. + DisableDualStackEndpoint +) + // Options is the endpoint resolver configuration options type Options struct { DisableHTTPS bool + UseDualStack DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == EnableDualStackEndpoint } // Resolver Commander endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) 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/comprehend/api_client.go b/service/comprehend/api_client.go index 564ab679775..5003f674cc2 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..de40f837bc8 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/service/internal/config": "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..5dc4b6f5c17 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e3ff263a0a9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..610aae3f209 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/service/internal/config": "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..f5df8de72bc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..55a652dd001 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2fefd356721 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/service/internal/config": "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..966b7fc3f2b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..32d9c832c80 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bfa25b034c5 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/service/internal/config": "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..95ba2f417b0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f620d62a054 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2376d8c2bf1 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/service/internal/config": "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..b010a011f3b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e9f7aa89f52 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6c2670c5e3f 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/service/internal/config": "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..5f127362936 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ae57fbca6ab 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0fe605e3702 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/service/internal/config": "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..e95526ce2d2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a17b2c30c59 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b407c848b51 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/service/internal/config": "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..7c9f0b272d7 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c09f392d8e8 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6211ec69ef4 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/service/internal/config": "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..7b3155a4648 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..06dcd61bfcb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e61fefd3751 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/service/internal/config": "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..0b786733d3f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..43658b935f2 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..987cdd03aa8 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/service/internal/config": "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..56f9c13bdc1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..8237cac1b39 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6fbeb2d3956 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/service/internal/config": "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..a212322c6ef 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f3cb1d9077b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..12362569ccd 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/service/internal/config": "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..88bebd89a3f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..fc608a3e601 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3c9ea8c4b75 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/service/internal/config": "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..98b2a58db0d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3394bb61030 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a8f0755a051 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/service/internal/config": "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..21234e2832a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a0087d05371 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ad0e8d25920 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/service/internal/config": "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..d7b6d7b5e22 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..56aca568923 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d9aa1265747 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/service/internal/config": "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..68aea445b8b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1567911bff7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2afbe04cb9a 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/service/internal/config": "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..9025d0c3ab3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..edb9485eb5f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..97cb931d44a 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/service/internal/config": "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..633536421ca 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..13ce1ea74fe 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0c3ad02f0bd 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/service/internal/config": "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..6b7f8ea9f96 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e9c9f828a09 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..18c2e05fe83 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/service/internal/config": "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..0a9c34bd873 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..db17edc5758 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..97a670cc6df 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/service/internal/config": "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..f8fe8447790 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e15acfc7163 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9a928150823 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/service/internal/config": "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..51e9ad09bed 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..cb82935cd61 100644 --- a/service/dynamodb/api_client.go +++ b/service/dynamodb/api_client.go @@ -12,6 +12,7 @@ import ( awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" ddbcust "github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/customizations" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -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 := internalConfig.ResolveUseDualStack(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..b4e4db169b6 100644 --- a/service/dynamodb/generated.json +++ b/service/dynamodb/generated.json @@ -2,6 +2,7 @@ "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", + "github.com/aws/aws-sdk-go-v2/service/internal/config": "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/dynamodb/go.mod b/service/dynamodb/go.mod index c82308d8a0d..fc492101108 100644 --- a/service/dynamodb/go.mod +++ b/service/dynamodb/go.mod @@ -5,6 +5,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 + github.com/aws/aws-sdk-go-v2/service/internal/config v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) @@ -12,3 +13,5 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ 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/config => ../../service/internal/config/ 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..9beabe5e713 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..529886e6422 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/service/internal/config": "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..c04b88d0841 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..104cf48a998 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bc5eaf902ba 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/service/internal/config": "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..2d76b8bcb2e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7dfd02564e9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7cb7b68eece 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/service/internal/config": "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..e8b5408a119 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..26928f1e781 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6fa0773c52c 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/service/internal/config": "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..7d86cf8beed 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..772efd2c830 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e08904585a1 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/service/internal/config": "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..db710afe5f0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4e0b8a06c02 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7791b6dbcc1 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/service/internal/config": "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..8d318a66e39 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..127ab84399b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8f834ea1de0 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/service/internal/config": "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..9bca3b8851e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ba4da284146 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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 39882c8bf69..014e3b4deb1 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/service/internal/config": "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..2875aac98f2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f79b427ac13 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d48d3d394e9 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/service/internal/config": "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..fcf80d2c45b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ea96eb2611e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9ce5f0388c6 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/service/internal/config": "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..8136f216bdb 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..18a76cc70a0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bd112feba39 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/service/internal/config": "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..887b28b2107 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a9381dd5465 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..490d2f3dc67 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/service/internal/config": "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..6e7a3583e51 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b750e5a70ba 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..33955fd6a28 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/service/internal/config": "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..2ecf277e5e2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ec13777cbd0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bb463de1a5f 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/service/internal/config": "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..721c47984c5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..26b1197be5f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f7a57e95492 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/service/internal/config": "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..4f39596b692 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..be88e12bb68 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..524fb70f225 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/service/internal/config": "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..16b2b30a1a1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..81b547b00ac 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0a6b260271f 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/service/internal/config": "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..c401e727639 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..925746900cc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..72e839d5066 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/service/internal/config": "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..5176978e6a2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..77c0a869e43 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..43c381451bc 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/service/internal/config": "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..1bcdffefd8c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..cde148c60af 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d89812c50dd 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/service/internal/config": "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..8b496213143 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..79dd10ad5a7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4dd005a1df0 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/service/internal/config": "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..78d9ac7e5cc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..db0a7e42548 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f9e3fc4a2a7 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/service/internal/config": "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..20c2eb49564 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f4e7ea2123d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b19138441a5 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/service/internal/config": "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..b5ca747a3f9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..dd4da99ed80 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..fe162aa015a 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/service/internal/config": "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..e1f7125befb 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9218e083929 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9322f0bba8a 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/service/internal/config": "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..7dd142e9081 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f4dced85d87 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..821161a8cc0 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/service/internal/config": "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..3fb6c4361d4 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..77d0bdf373b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a0f8df8327c 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/service/internal/config": "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..96ba26000ea 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bfbfbf33b44 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4a913b6f27a 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/service/internal/config": "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..7edd0b23fe6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..16a11720a6a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ca1fd0bf71b 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/service/internal/config": "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..d8dcab215d3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..73acdabc483 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..21384af5672 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/service/internal/config": "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..4bb90d635af 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9a7b7d27a15 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f4beeb07a92 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/service/internal/config": "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..6af57d95ad0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..955ec3bd2f7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..22fb720f2f2 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/service/internal/config": "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..a953f41a92a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7e9959f1677 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e4f07d9ff5f 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/service/internal/config": "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..2d9fcc7fffa 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d261fe580e5 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f12e5492484 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/service/internal/config": "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..9050c373c76 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..998280b1408 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..fe1f6df3b92 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/service/internal/config": "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..22fdd38b6c2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6e555b61bc9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..342c5617560 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/service/internal/config": "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..0d9251557f2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..506bc114c9f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a3c9c10069b 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/service/internal/config": "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..b8ba65701ef 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1c15d3f5a62 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b4892b8890a 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/service/internal/config": "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..67502058e98 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f4163d520cc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..fbee14ef0d4 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/service/internal/config": "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..3e246bfa4ee 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..be4c7ebc213 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ae92a35fa98 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/service/internal/config": "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..cb87c5b35b7 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c7bf9df0446 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..db423a70db8 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/service/internal/config": "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..4052d27fdd1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1ce760f89bd 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..fbb58777393 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/service/internal/config": "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..092de4199a5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..596b0d727c4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c8c3db3e92d 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/service/internal/config": "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..742f11deac9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3428564eab0 100644 --- a/service/internal/benchmark/go.mod +++ b/service/internal/benchmark/go.mod @@ -16,4 +16,6 @@ replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamo 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/config => ../../../service/internal/config/ + replace github.com/aws/aws-sdk-go-v2/service/lexruntimeservice => ../../../service/lexruntimeservice/ diff --git a/service/internal/integrationtest/go.mod b/service/internal/integrationtest/go.mod index 25cd59ca116..7ed75e39685 100644 --- a/service/internal/integrationtest/go.mod +++ b/service/internal/integrationtest/go.mod @@ -196,6 +196,8 @@ replace github.com/aws/aws-sdk-go-v2/service/inspector => ../../../service/inspe 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/config => ../../../service/internal/config/ + 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/internal/s3shared => ../../../service/internal/s3shared/ diff --git a/service/internal/s3shared/update_endpoint.go b/service/internal/s3shared/update_endpoint.go index 1f811a58a36..da94445fdfd 100644 --- a/service/internal/s3shared/update_endpoint.go +++ b/service/internal/s3shared/update_endpoint.go @@ -12,6 +12,8 @@ import ( ) // EnableDualstack represents middleware struct for enabling dualstack support +// +// Deprecated: UseDualStack feature has been added to the endpoint resolver type EnableDualstack struct { // UseDualstack indicates if dualstack endpoint resolving is to be enabled UseDualstack bool diff --git a/service/iot/api_client.go b/service/iot/api_client.go index c7fb40ea0c9..4127a828df8 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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 dc34b4ab42b..939974c49c5 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/service/internal/config": "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..9b5c4f1ca07 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..baf4a432161 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0c3c3c14bb8 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/service/internal/config": "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..145384a738e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..8e5cc66f58b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7b8a5152ef0 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/service/internal/config": "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..76b78d9ba9f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c3c291326bc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..eebd7052958 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/service/internal/config": "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..08f2608b361 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d699ec6fa3b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e165feff093 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/service/internal/config": "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..3b90c16bc84 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..289fa4a4557 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..854d3b781bb 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/service/internal/config": "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..6fd53bef371 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..377af159b62 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8638bcedbb2 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/service/internal/config": "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..5324b5aed1d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..671493c5562 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..761f656bbeb 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/service/internal/config": "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..b637d1099ad 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a8331309d57 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9a3a81bd12b 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/service/internal/config": "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..ad25146d8b9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ec1afd5a344 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..12205eb42f6 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/service/internal/config": "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..09330fa69a3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..53766468b90 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..009d7694883 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/service/internal/config": "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..9edbe5b32ba 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ecaa4b3e0dd 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c6b31b9ec63 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/service/internal/config": "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..fef49bbedb0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..aa9d19fff04 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d5b51eba869 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/service/internal/config": "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..4914b3a65a6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a0a5ebb0d32 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0e158649102 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/service/internal/config": "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..6000f60391b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bc18a86af67 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6a588bbbb15 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/service/internal/config": "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..11957edeb90 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..582f3dfb305 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..04c31228729 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/service/internal/config": "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..c6aed216e3c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..974c72b3354 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..849dc2e5509 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/service/internal/config": "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..3d43b0d65a6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b9f135c8d5f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..96ec8ba924c 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/service/internal/config": "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..5ae6af61551 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bec4e9520fe 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9a3f937ed86 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/service/internal/config": "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..6143f711195 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..18574562901 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ec4ff882a21 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/service/internal/config": "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..c581b0e9953 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d6ccb5b50db 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..aada25cc50f 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/service/internal/config": "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..28e556dd7b1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..322196f3a13 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..96ea46ccac0 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/service/internal/config": "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..b1f6f1a1c66 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..eae105ee8f0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d8b5c9f2c2d 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/service/internal/config": "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..337d0511c12 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..416693d9b93 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..393bbeb13be 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/service/internal/config": "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..2c886ba7164 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..aeccfc134b9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..037c1618672 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/service/internal/config": "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..2c211bc72e5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ce727979192 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..cb7d1f77f29 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/service/internal/config": "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..13c1d28132d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b96669cd084 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d3f2449d765 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/service/internal/config": "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..ea61e017b79 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a063548a8e7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..08b259fb403 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/service/internal/config": "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..fff83b2e040 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1462bc7fba2 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..359c0d9d727 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/service/internal/config": "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..a8baae96e53 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..866ea3b2f57 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..af8c28a16f5 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/service/internal/config": "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..feee55bbf34 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d1ce404a910 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..82c9fde0b76 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/service/internal/config": "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..6f88dcb4690 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bf3ac30546a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a142a1eacb2 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/service/internal/config": "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..37193dc416d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c38a84b39fa 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9d6dc048eb2 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/service/internal/config": "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..32e37ab3407 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..92d36735199 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8dd70d0abaf 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/service/internal/config": "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..3f63bc29f0e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..29d54ba00d2 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5e70f03db2d 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/service/internal/config": "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..0b49cf818c5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d6baa6b29f0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9922a6fb0d5 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/service/internal/config": "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..d17c1c96977 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..03b3ca51643 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..29f8462014a 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/service/internal/config": "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..ea997ebf4da 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..54d9a7c5d83 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..70cb93bedc9 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/service/internal/config": "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..8672501a563 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6f132bf705e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f15ac480002 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/service/internal/config": "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..ba9ead585ac 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a9e4c0ec012 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8980e7f7743 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/service/internal/config": "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..5d864e3ac66 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..0ce9e4fcb9c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..eae32dae866 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/service/internal/config": "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..491d9cf0d3c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ac74f35bc03 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..cd6a1bb2f61 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/service/internal/config": "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..2744aa24ada 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..69d95224fed 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..71f73a4d843 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/service/internal/config": "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..564830a4d87 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ddc48ab023a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ec07bdd7d06 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/service/internal/config": "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..25da9fcdeaf 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f3bc23e4b89 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..68d6377866d 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/service/internal/config": "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..368f85aab23 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..611d6427c83 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..922e42e24bb 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/service/internal/config": "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..52119533d10 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ac20a030321 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..27d11201dd9 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/service/internal/config": "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..c5b0351eae3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c0263d78a6d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..08ddb9f2948 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/service/internal/config": "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..a9e76410e95 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1f66f23e810 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b68d38f64d4 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/service/internal/config": "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..3e47d6556f4 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..55751e9fdc3 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..162b73483b2 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/service/internal/config": "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..14dd18da860 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1527dddae0f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b41bd4146c3 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/service/internal/config": "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..f109362d809 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..1ac40399fdc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..509d885b4c8 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/service/internal/config": "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..b0d9cbd62b3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d22cc2578bc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..6551025a6ed 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/service/internal/config": "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..b544c1eea2c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..63e25b1380d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ecea563337b 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/service/internal/config": "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..69ba0f21a1d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..cebf9eebc07 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..fc66900109a 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/service/internal/config": "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..757b767fbd8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7eb2a529f34 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0f0b8af0711 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/service/internal/config": "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..5f39ce889b5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d07fda4f1bc 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8420d345cfb 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/service/internal/config": "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..ad9ff35099c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d2c6847d344 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..463d70cc221 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/service/internal/config": "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..cc4b4bfdbe9 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b8b2a88f1b0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..82f3531b4f0 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/service/internal/config": "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..5f5fb388849 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..16107ea3258 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..df36243bc1f 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/service/internal/config": "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..65e59fe8ae0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..ad66b63649e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8f9c1eecbc7 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/service/internal/config": "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..eae5df8abf7 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..57f8a2074f9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..cbafb90fa6c 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/service/internal/config": "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..173053dc0ca 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..31b32c9a122 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..41d152da826 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/service/internal/config": "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..5f783c23e06 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..942120d67d4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..39cb99b9e16 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/service/internal/config": "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..d5ab12eeff1 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..01bff2bf4a8 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..db91946629a 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/service/internal/config": "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..a2304079cbd 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..8f7cc75b9de 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..dee71686605 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/service/internal/config": "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..ef4113ee9d2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6677f0ae77f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7d70139776e 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/service/internal/config": "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..8f225062d5f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7ae84d0a6c6 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..25019fc93b4 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/service/internal/config": "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..5344b187d93 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c54d8b3f53e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..37f2c6ddf64 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/service/internal/config": "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..a4dd0390fe8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..578bc1711a7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a165cb7ca68 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/service/internal/config": "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..b59b1de5d52 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..242273bb88c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c33f33ddd4e 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/service/internal/config": "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..b1c049929a2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..89995244ea8 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bfb2332606a 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/service/internal/config": "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..22aa579a504 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..71bb16bc7ae 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f1212c5050f 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/service/internal/config": "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..695fe9ee68b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..becbdd5a5de 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3c600697bc7 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/service/internal/config": "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..f632c9fabb8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..be956143a24 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f511be2a53a 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/service/internal/config": "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..9be63ab4cca 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c0f4c28ef53 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..474ecaf1231 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/service/internal/config": "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..db6c195ebeb 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..063e6d98a91 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..472fa859d20 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/service/internal/config": "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..80fed871f7c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b49fb34ae51 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e6c80c9b9c1 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/service/internal/config": "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..1215427ed19 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..94c67c32d47 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..607a98e2624 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/service/internal/config": "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..16d1b0473d3 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3155bd5e5d0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..584c3d6ebf2 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/service/internal/config": "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..1df6c1f4928 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..a5c480789cb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..ab971a29e57 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/service/internal/config": "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..b52fe854cd4 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b4dcec1c256 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8e5b936bf6b 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/service/internal/config": "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..b4ab6f74781 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..8f3540fdafa 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f2de677e415 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/service/internal/config": "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..0f933136a70 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..32b06b402bb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0d16b3d575a 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/service/internal/config": "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..714370e41d8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..32d8dba72b9 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a50ca689365 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/service/internal/config": "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..537eebffb47 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..99900c1134f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8addc824c35 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/service/internal/config": "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..c2dfcc54380 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..fabf7a8647c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..7c1ffd4ffd1 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/service/internal/config": "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..c042e021b0f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..08ebe7ae97f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b255b04329c 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/service/internal/config": "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..8625354f5fc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..2c8cea63ed4 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..061461eff90 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/service/internal/config": "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..d99d93679fb 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b3ea108b8d1 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..52395ec0a99 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/service/internal/config": "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..0f1f0c40352 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..95f3c8b83a7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9f07922c974 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/service/internal/config": "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..98c40e35812 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e2a4931eb6d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0003659b4ef 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/service/internal/config": "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..841f092db8f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b249e7eff10 100644 --- a/service/s3/api_client.go +++ b/service/s3/api_client.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" s3sharedconfig "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config" @@ -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 := internalConfig.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualStack = EnableDualStackEndpoint + } else { + o.UseDualStack = DisableDualStackEndpoint + } + + } + 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..92d10f7f610 100644 --- a/service/s3/generated.json +++ b/service/s3/generated.json @@ -2,6 +2,7 @@ "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", + "github.com/aws/aws-sdk-go-v2/service/internal/config": "v0.0.0-00010101000000-000000000000", "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", "github.com/aws/smithy-go": "v1.4.0" diff --git a/service/s3/go.mod b/service/s3/go.mod index fed48d6e109..cba5487f314 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -5,6 +5,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 + github.com/aws/aws-sdk-go-v2/service/internal/config v0.0.0-00010101000000-000000000000 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 github.com/aws/smithy-go v1.4.0 @@ -15,6 +16,8 @@ replace github.com/aws/aws-sdk-go-v2 => ../../ 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/config => ../../service/internal/config/ + 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/internal/s3shared => ../../service/internal/s3shared/ diff --git a/service/s3/internal/configtesting/go.mod b/service/s3/internal/configtesting/go.mod index 0a5f936ca64..727afc40975 100644 --- a/service/s3/internal/configtesting/go.mod +++ b/service/s3/internal/configtesting/go.mod @@ -17,6 +17,8 @@ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2 replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ +replace github.com/aws/aws-sdk-go-v2/service/internal/config => ../../../../service/internal/config/ + 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/internal/s3shared => ../../../../service/internal/s3shared/ diff --git a/service/s3/internal/endpoints/endpoints.go b/service/s3/internal/endpoints/endpoints.go index 3acda91a3b7..6c83a6f8555 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}.aws", + 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}.amazonwebservices.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}.aws", + 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..1ee44fa9f8e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" "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 := internalConfig.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualStack = EnableDualStackEndpoint + } else { + o.UseDualStack = DisableDualStackEndpoint + } + + } + 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..02b45d8e28a 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/service/internal/config": "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..9710b9f745e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..3d060cc6809 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}.aws", + 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}.amazonwebservices.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}.aws", + 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..e4aa4a9c4aa 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}.aws", + 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}.amazonwebservices.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}.aws", + 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..79582f7927d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..40261e15a1b 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/service/internal/config": "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..49a2fc4eecc 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..2f2196ac910 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..67ecfe36970 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/service/internal/config": "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..b54758c56d5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..c3c6bfd9a7e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..08865e2ffa3 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/service/internal/config": "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..8974b71ca6d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..bfae5531204 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d111239a9c6 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/service/internal/config": "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..10481992a95 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..124baa18957 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e4c4c685b9a 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/service/internal/config": "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..ad7d2c68fc2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..611c6e2b718 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b9787679675 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/service/internal/config": "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..193af020966 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..49a7e3bb9c7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bd2c2fa037d 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/service/internal/config": "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..65677544261 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..85ed6db4e9a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1c57f0aecdc 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/service/internal/config": "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..9974bf3647f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..95a7958d580 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1277fe91ea0 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/service/internal/config": "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..73158dd984c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..fb6a655d69d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c5b71dbceb3 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/service/internal/config": "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..008eb2835e8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e348d3ee1ce 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e96d9502e3d 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/service/internal/config": "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..b0f60bb1214 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..832aab9ac17 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..8a6d2c78434 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/service/internal/config": "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..667aebdc368 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..46fd18eaedb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3e6ad9e74a5 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/service/internal/config": "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..2241b450810 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..44dc13cba7a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..17ef0f9ebc3 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/service/internal/config": "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..7f3abd9e4f7 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..3b546cd1d59 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..e961815915f 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/service/internal/config": "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..38e493179f2 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..964acf8990a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..eba37955180 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/service/internal/config": "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..d072c596d20 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..dc3ea91ac1e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..3026e08adc8 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/service/internal/config": "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..2043231339a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b43d11f43d7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..86918f434c6 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/service/internal/config": "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..12b847d2c7f 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9a63fd54338 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..68d94f22e85 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/service/internal/config": "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..fdb45ec125d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b89c5dbfa72 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..b46f55efd7f 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/service/internal/config": "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..89fd9fca378 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..b5cdfcfe6ea 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4e16d05b173 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/service/internal/config": "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..d1ff8ff14ec 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4f72857e01b 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..679bcbd46a2 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/service/internal/config": "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..82ef14c1ead 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..44d15430065 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..84b933c8696 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/service/internal/config": "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..c136527e62c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..4adf651ee99 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..1412ac05044 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/service/internal/config": "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..6b5493a8cf5 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f7efe7e8904 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..dac2a8df53c 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/service/internal/config": "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..e6d150317a6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..26edeb79acf 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..9e4c2cd394e 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/service/internal/config": "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..86698b3525d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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/sso/api_client.go b/service/sso/api_client.go index 7b8887b24c5..fc35aec51ad 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..da7eb2eec8a 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/service/internal/config": "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..ed4ad0a7f4a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..28e7f577125 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..4547a176789 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/service/internal/config": "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..59366820797 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..f4e128408e2 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0777811f761 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/service/internal/config": "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..a0edf5f6454 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7947420a538 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..0e5d27653f9 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/service/internal/config": "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..d4b900f06b8 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..d644fcb770e 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..25ed17341df 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/service/internal/config": "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..4639777af72 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ + 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..02ae9a897c3 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..74cf5741f52 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/service/internal/config": "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..f7fee1f0593 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..dabe9370612 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..584427c30a6 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/service/internal/config": "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..38e4f1fc409 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..2d4957bd3a0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..74d9d63cb9c 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/service/internal/config": "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..73c5cfa30cf 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..95c05fd799f 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..23461b0c642 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/service/internal/config": "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..7b9fc69c695 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..9be83ffe35c 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..96036286223 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/service/internal/config": "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..f86b7a7f274 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..2042fca4dc0 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..a845c612413 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/service/internal/config": "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..f336c134e52 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..7548b2798a7 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..c0e1456072e 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/service/internal/config": "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..1ff41d2216d 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..26bb7a495d3 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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 359b4709ec3..84c40897f8c 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/service/internal/config": "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..c1b649e3ba4 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..e572fe03748 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5efa0a0e35b 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/service/internal/config": "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..de18ae1692c 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..6cae467ef30 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..660e5565856 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/service/internal/config": "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..45c3c8ac452 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..43df5fa12bb 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..2e38995388c 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/service/internal/config": "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..a5738712807 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..59d9dab621d 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5fb4355d6e1 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/service/internal/config": "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..d5db9b0a06b 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..dc228a133d5 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..58275241c65 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/service/internal/config": "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..3eaaea9755e 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..95d88683783 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..dc5a0bd169e 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/service/internal/config": "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..20f90e3c22a 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..50fa5413c86 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..d5d27aaa953 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/service/internal/config": "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..26551f06541 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..49a884392e3 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f933f760032 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/service/internal/config": "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..b54838cc0a0 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..69e01af0e38 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..bf4b9fc326f 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/service/internal/config": "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..a411bf1e4de 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..cef8d539804 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..f5f29d46ecb 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/service/internal/config": "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..6342bb54574 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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..95354b58c1a 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" + internalConfig "github.com/aws/aws-sdk-go-v2/service/internal/config" 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 := internalConfig.ResolveUseDualStack(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..5799fd333c1 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/service/internal/config": "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..c839c81f7c6 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/service/internal/config 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/service/internal/config => ../../service/internal/config/ 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{