From 032aa97d54c3db92af0be55e63fa78aa7de32522 Mon Sep 17 00:00:00 2001 From: Sean McGrail Date: Wed, 26 May 2021 13:18:36 -0700 Subject: [PATCH] Regenerated Clients --- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- .../restxmlwithnamespace/api_client.go | 22 + .../restxmlwithnamespace/endpoints.go | 19 +- .../restxmlwithnamespace/generated.json | 1 + .../protocoltest/restxmlwithnamespace/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 46 +- 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 | 39 +- 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 | 53 ++- 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 | 39 +- service/apigatewaymanagementapi/api_client.go | 22 + service/apigatewaymanagementapi/endpoints.go | 19 +- .../apigatewaymanagementapi/generated.json | 1 + service/apigatewaymanagementapi/go.mod | 3 + .../internal/endpoints/endpoints.go | 72 ++-- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- service/applicationcostprofiler/api_client.go | 22 + service/applicationcostprofiler/endpoints.go | 19 +- .../applicationcostprofiler/generated.json | 1 + service/applicationcostprofiler/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- .../applicationdiscoveryservice/api_client.go | 22 + .../applicationdiscoveryservice/endpoints.go | 19 +- .../generated.json | 1 + service/applicationdiscoveryservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 61 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 51 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 51 ++- 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 | 44 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 85 +++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 42 +- 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 | 39 +- 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 | 40 +- 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 | 39 +- 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 | 51 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 59 ++- 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 | 39 +- service/cognitoidentityprovider/api_client.go | 22 + service/cognitoidentityprovider/endpoints.go | 19 +- .../cognitoidentityprovider/generated.json | 1 + service/cognitoidentityprovider/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 57 ++- 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 | 39 +- 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 | 39 +- 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 | 40 +- 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 | 39 +- .../costandusagereportservice/api_client.go | 22 + .../costandusagereportservice/endpoints.go | 19 +- .../costandusagereportservice/generated.json | 1 + service/costandusagereportservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- .../databasemigrationservice/api_client.go | 22 + service/databasemigrationservice/endpoints.go | 19 +- .../databasemigrationservice/generated.json | 1 + service/databasemigrationservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 70 +-- 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 | 39 +- 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 | 39 +- 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 | 112 ++++- 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 | 39 +- 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 | 125 ++++-- 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 | 39 +- 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 | 39 +- 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 | 47 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 46 +- 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 | 46 +- 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 | 42 +- 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 | 39 +- 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 | 55 ++- 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 | 39 +- 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 | 39 +- 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 | 47 ++- 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 | 39 +- 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 | 45 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 40 +- 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 | 49 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- service/internal/benchmark/go.mod | 2 + service/internal/integrationtest/go.mod | 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 | 39 +- service/iot1clickdevicesservice/api_client.go | 22 + service/iot1clickdevicesservice/endpoints.go | 19 +- .../iot1clickdevicesservice/generated.json | 1 + service/iot1clickdevicesservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 42 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 42 +- 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 | 39 +- 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 | 39 +- 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 | 44 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- .../kinesisvideoarchivedmedia/api_client.go | 22 + .../kinesisvideoarchivedmedia/endpoints.go | 19 +- .../kinesisvideoarchivedmedia/generated.json | 1 + service/kinesisvideoarchivedmedia/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 43 +- 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 | 39 +- service/lexmodelbuildingservice/api_client.go | 22 + service/lexmodelbuildingservice/endpoints.go | 19 +- .../lexmodelbuildingservice/generated.json | 1 + service/lexmodelbuildingservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 49 ++- 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 | 39 +- 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 | 49 ++- 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 | 40 +- 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 | 39 +- 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 | 39 +- 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 | 44 +- 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 | 50 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 40 +- 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 | 39 +- 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 | 39 +- .../api_client.go | 22 + .../marketplacecommerceanalytics/endpoints.go | 19 +- .../generated.json | 1 + service/marketplacecommerceanalytics/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- .../api_client.go | 22 + .../endpoints.go | 19 +- .../generated.json | 1 + service/marketplaceentitlementservice/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 55 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 43 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 49 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 62 +-- 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 | 39 +- 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 | 39 +- 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 | 47 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 40 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- .../resourcegroupstaggingapi/api_client.go | 22 + service/resourcegroupstaggingapi/endpoints.go | 19 +- .../resourcegroupstaggingapi/generated.json | 1 + service/resourcegroupstaggingapi/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 43 +- service/s3/api_client.go | 34 +- 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 | 399 ++++++++++-------- service/s3control/api_client.go | 34 +- service/s3control/endpoints.go | 27 +- service/s3control/generated.json | 1 + service/s3control/go.mod | 3 + .../s3control/internal/endpoints/endpoints.go | 345 ++++++++------- .../internal/endpoints/s3/endpoints.go | 399 ++++++++++-------- 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 | 61 ++- 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 | 39 +- 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 | 39 +- 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 | 39 +- .../api_client.go | 22 + .../sagemakerfeaturestoreruntime/endpoints.go | 19 +- .../generated.json | 1 + service/sagemakerfeaturestoreruntime/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- .../api_client.go | 22 + .../endpoints.go | 19 +- .../generated.json | 1 + .../serverlessapplicationrepository/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 40 +- .../servicecatalogappregistry/api_client.go | 22 + .../servicecatalogappregistry/endpoints.go | 19 +- .../servicecatalogappregistry/generated.json | 1 + service/servicecatalogappregistry/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 69 +-- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- service/ssmincidents/api_client.go | 22 + service/ssmincidents/endpoints.go | 19 +- service/ssmincidents/generated.json | 1 + service/ssmincidents/go.mod | 3 + .../internal/endpoints/endpoints.go | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 69 +-- 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 | 100 ++--- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 40 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 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 | 39 +- 1382 files changed, 23328 insertions(+), 1541 deletions(-) diff --git a/config/go.mod b/config/go.mod index 12e0b72250f..bfb2577685a 100644 --- a/config/go.mod +++ b/config/go.mod @@ -19,6 +19,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../service/internal/presigned-url/ diff --git a/credentials/go.mod b/credentials/go.mod index 9e88907273a..64e2981867a 100644 --- a/credentials/go.mod +++ b/credentials/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2 => ../ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../service/internal/presigned-url/ replace github.com/aws/aws-sdk-go-v2/service/sso => ../service/sso/ diff --git a/example/service/s3/listObjects/go.mod b/example/service/s3/listObjects/go.mod index e8219d20ef5..8f019afb6a7 100644 --- a/example/service/s3/listObjects/go.mod +++ b/example/service/s3/listObjects/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../../service/internal/accept-encoding/ diff --git a/example/service/s3/usingPrivateLink/go.mod b/example/service/s3/usingPrivateLink/go.mod index f5f32a899fc..48c4c9a4186 100644 --- a/example/service/s3/usingPrivateLink/go.mod +++ b/example/service/s3/usingPrivateLink/go.mod @@ -17,6 +17,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../../service/internal/accept-encoding/ diff --git a/feature/dynamodb/attributevalue/go.mod b/feature/dynamodb/attributevalue/go.mod index b249093fda6..169262ed08e 100644 --- a/feature/dynamodb/attributevalue/go.mod +++ b/feature/dynamodb/attributevalue/go.mod @@ -11,6 +11,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/dynamodb/expression/go.mod b/feature/dynamodb/expression/go.mod index 14e2914deb9..ae2c6208f4c 100644 --- a/feature/dynamodb/expression/go.mod +++ b/feature/dynamodb/expression/go.mod @@ -12,6 +12,8 @@ replace github.com/aws/aws-sdk-go-v2 => ../../../ replace github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue => ../../../feature/dynamodb/attributevalue/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/dynamodbstreams/attributevalue/go.mod b/feature/dynamodbstreams/attributevalue/go.mod index 832c9708cd7..9f9d5d973af 100644 --- a/feature/dynamodbstreams/attributevalue/go.mod +++ b/feature/dynamodbstreams/attributevalue/go.mod @@ -11,6 +11,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/dynamodbstreams => ../../../service/dynamodbstreams/ diff --git a/feature/s3/manager/go.mod b/feature/s3/manager/go.mod index 896dffba809..70b1da604e5 100644 --- a/feature/s3/manager/go.mod +++ b/feature/s3/manager/go.mod @@ -18,6 +18,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../service/internal/accept-encoding/ diff --git a/internal/protocoltest/awsrestjson/api_client.go b/internal/protocoltest/awsrestjson/api_client.go index f0fe5258307..9f6b786ec37 100644 --- a/internal/protocoltest/awsrestjson/api_client.go +++ b/internal/protocoltest/awsrestjson/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5802e1e09ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/awsrestjson/generated.json b/internal/protocoltest/awsrestjson/generated.json index adbf3595cbd..72e8aa11c26 100644 --- a/internal/protocoltest/awsrestjson/generated.json +++ b/internal/protocoltest/awsrestjson/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/awsrestjson/go.mod b/internal/protocoltest/awsrestjson/go.mod index f667057b59b..01e16f47184 100644 --- a/internal/protocoltest/awsrestjson/go.mod +++ b/internal/protocoltest/awsrestjson/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go b/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go index 957e7a6b44d..f84bf7bd8a0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4534e205632 100644 --- a/internal/protocoltest/ec2query/api_client.go +++ b/internal/protocoltest/ec2query/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..047cfae33f6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/ec2query/generated.json b/internal/protocoltest/ec2query/generated.json index 31e2f50517a..e7251475826 100644 --- a/internal/protocoltest/ec2query/generated.json +++ b/internal/protocoltest/ec2query/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/ec2query/go.mod b/internal/protocoltest/ec2query/go.mod index 496142fd4af..e447994af56 100644 --- a/internal/protocoltest/ec2query/go.mod +++ b/internal/protocoltest/ec2query/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/ec2query/internal/endpoints/endpoints.go b/internal/protocoltest/ec2query/internal/endpoints/endpoints.go index fd1298187c6..83b6e83ecfe 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..8e487a5e3af 100644 --- a/internal/protocoltest/jsonrpc/api_client.go +++ b/internal/protocoltest/jsonrpc/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3059eade5b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/jsonrpc/generated.json b/internal/protocoltest/jsonrpc/generated.json index 7f0b43a6249..cd595a5eeb7 100644 --- a/internal/protocoltest/jsonrpc/generated.json +++ b/internal/protocoltest/jsonrpc/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/jsonrpc/go.mod b/internal/protocoltest/jsonrpc/go.mod index b10d6973b72..cbb71a5398b 100644 --- a/internal/protocoltest/jsonrpc/go.mod +++ b/internal/protocoltest/jsonrpc/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go index 99e00b4aed7..b81054394b0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dafe0160550 100644 --- a/internal/protocoltest/jsonrpc10/api_client.go +++ b/internal/protocoltest/jsonrpc10/api_client.go @@ -8,6 +8,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -159,6 +160,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -202,6 +204,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c14e61b13b5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/jsonrpc10/generated.json b/internal/protocoltest/jsonrpc10/generated.json index 51bb72d6008..f1955c71d7b 100644 --- a/internal/protocoltest/jsonrpc10/generated.json +++ b/internal/protocoltest/jsonrpc10/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/jsonrpc10/go.mod b/internal/protocoltest/jsonrpc10/go.mod index 764c24a00f1..17bb36b6521 100644 --- a/internal/protocoltest/jsonrpc10/go.mod +++ b/internal/protocoltest/jsonrpc10/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go index 1b325caf10a..01d0d191319 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e628acaaf8b 100644 --- a/internal/protocoltest/query/api_client.go +++ b/internal/protocoltest/query/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..902bf5f3573 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/query/generated.json b/internal/protocoltest/query/generated.json index ae81eb67b1d..f4ca332d1f3 100644 --- a/internal/protocoltest/query/generated.json +++ b/internal/protocoltest/query/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/query/go.mod b/internal/protocoltest/query/go.mod index 13135976a9a..ae30b9c33c2 100644 --- a/internal/protocoltest/query/go.mod +++ b/internal/protocoltest/query/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/query/internal/endpoints/endpoints.go b/internal/protocoltest/query/internal/endpoints/endpoints.go index a49ff1e248f..29a61fa5196 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..651c68a1e3e 100644 --- a/internal/protocoltest/restxml/api_client.go +++ b/internal/protocoltest/restxml/api_client.go @@ -9,6 +9,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -167,6 +168,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -217,6 +219,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f75ca111386 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/restxml/generated.json b/internal/protocoltest/restxml/generated.json index 185c57825c6..0f0ad2fb62d 100644 --- a/internal/protocoltest/restxml/generated.json +++ b/internal/protocoltest/restxml/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/restxml/go.mod b/internal/protocoltest/restxml/go.mod index 01e860f9f2f..5099dc0af82 100644 --- a/internal/protocoltest/restxml/go.mod +++ b/internal/protocoltest/restxml/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/restxml/internal/endpoints/endpoints.go b/internal/protocoltest/restxml/internal/endpoints/endpoints.go index 46d9ed631bc..c427aee9eba 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..eabee76950e 100644 --- a/internal/protocoltest/restxmlwithnamespace/api_client.go +++ b/internal/protocoltest/restxmlwithnamespace/api_client.go @@ -8,6 +8,7 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -159,6 +160,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -202,6 +204,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1fe7ee5cb34 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/internal/protocoltest/restxmlwithnamespace/generated.json b/internal/protocoltest/restxmlwithnamespace/generated.json index ae698ac61da..a5cdcbc77ca 100644 --- a/internal/protocoltest/restxmlwithnamespace/generated.json +++ b/internal/protocoltest/restxmlwithnamespace/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/google/go-cmp": "v0.5.4" }, diff --git a/internal/protocoltest/restxmlwithnamespace/go.mod b/internal/protocoltest/restxmlwithnamespace/go.mod index 048398f5c0d..03a35a0209c 100644 --- a/internal/protocoltest/restxmlwithnamespace/go.mod +++ b/internal/protocoltest/restxmlwithnamespace/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/google/go-cmp v0.5.4 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ diff --git a/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go b/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go index 10a0a12d8d2..9e2942cdb93 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1785ae3cb0e 100644 --- a/service/accessanalyzer/api_client.go +++ b/service/accessanalyzer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..837525959d2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/accessanalyzer/generated.json b/service/accessanalyzer/generated.json index 9930250adb5..913fbf07374 100644 --- a/service/accessanalyzer/generated.json +++ b/service/accessanalyzer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/accessanalyzer/go.mod b/service/accessanalyzer/go.mod index 7a225277ffd..1ed4f2189f5 100644 --- a/service/accessanalyzer/go.mod +++ b/service/accessanalyzer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/accessanalyzer/internal/endpoints/endpoints.go b/service/accessanalyzer/internal/endpoints/endpoints.go index 7ef03239c31..7c6eba6da80 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1158f3334e8 100644 --- a/service/acm/api_client.go +++ b/service/acm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..df1829c1221 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/acm/generated.json b/service/acm/generated.json index 3d6d58d5bd4..783a7d1eaa1 100644 --- a/service/acm/generated.json +++ b/service/acm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/acm/go.mod b/service/acm/go.mod index 9144943a5b6..278a209f567 100644 --- a/service/acm/go.mod +++ b/service/acm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/acm/internal/endpoints/endpoints.go b/service/acm/internal/endpoints/endpoints.go index 669a9ee2194..a27de3b8fcb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6db10a6cc0d 100644 --- a/service/acmpca/api_client.go +++ b/service/acmpca/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..cd7e305d9f4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/acmpca/generated.json b/service/acmpca/generated.json index 87c96e4398e..6989b913886 100644 --- a/service/acmpca/generated.json +++ b/service/acmpca/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/acmpca/go.mod b/service/acmpca/go.mod index 35b4001fd30..49598d0b6bd 100644 --- a/service/acmpca/go.mod +++ b/service/acmpca/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/acmpca/internal/endpoints/endpoints.go b/service/acmpca/internal/endpoints/endpoints.go index dcc43ac15f8..f86fad365fb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2bd82895897 100644 --- a/service/alexaforbusiness/api_client.go +++ b/service/alexaforbusiness/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..4aa6d1f65b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/alexaforbusiness/generated.json b/service/alexaforbusiness/generated.json index faf886cfcd6..117b90f2303 100644 --- a/service/alexaforbusiness/generated.json +++ b/service/alexaforbusiness/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/alexaforbusiness/go.mod b/service/alexaforbusiness/go.mod index 88ffdc67c75..86ade19c423 100644 --- a/service/alexaforbusiness/go.mod +++ b/service/alexaforbusiness/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/alexaforbusiness/internal/endpoints/endpoints.go b/service/alexaforbusiness/internal/endpoints/endpoints.go index 9cacd85168b..b5f8c469d0a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..87bfadfd76b 100644 --- a/service/amp/api_client.go +++ b/service/amp/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..bf95166ae04 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amp/generated.json b/service/amp/generated.json index db8abe48ee9..767ca5092f4 100644 --- a/service/amp/generated.json +++ b/service/amp/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amp/go.mod b/service/amp/go.mod index f9dae74c7da..c1fead3378d 100644 --- a/service/amp/go.mod +++ b/service/amp/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amp/internal/endpoints/endpoints.go b/service/amp/internal/endpoints/endpoints.go index 87cb690b200..8185d700bbc 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..60283eab327 100644 --- a/service/amplify/api_client.go +++ b/service/amplify/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..389b4b56d38 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amplify/generated.json b/service/amplify/generated.json index 555eba53074..bdc286bfdbf 100644 --- a/service/amplify/generated.json +++ b/service/amplify/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amplify/go.mod b/service/amplify/go.mod index 77959a4501c..4635b36a993 100644 --- a/service/amplify/go.mod +++ b/service/amplify/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amplify/internal/endpoints/endpoints.go b/service/amplify/internal/endpoints/endpoints.go index 57a27174b2f..6511ce79565 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2c24423eb0c 100644 --- a/service/amplifybackend/api_client.go +++ b/service/amplifybackend/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b803484458e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/amplifybackend/generated.json b/service/amplifybackend/generated.json index ed1568a97fd..29450f7e694 100644 --- a/service/amplifybackend/generated.json +++ b/service/amplifybackend/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/amplifybackend/go.mod b/service/amplifybackend/go.mod index 6656c27ec9a..36f89ae99b5 100644 --- a/service/amplifybackend/go.mod +++ b/service/amplifybackend/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/amplifybackend/internal/endpoints/endpoints.go b/service/amplifybackend/internal/endpoints/endpoints.go index e83e96e2046..82b1669dbf8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..11339101e60 100644 --- a/service/apigateway/api_client.go +++ b/service/apigateway/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" agcust "github.com/aws/aws-sdk-go-v2/service/apigateway/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b96f97bbccd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigateway/generated.json b/service/apigateway/generated.json index 089e853c169..5d427b02d33 100644 --- a/service/apigateway/generated.json +++ b/service/apigateway/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigateway/go.mod b/service/apigateway/go.mod index 34745e39348..f9b7dbec6ad 100644 --- a/service/apigateway/go.mod +++ b/service/apigateway/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigateway/internal/endpoints/endpoints.go b/service/apigateway/internal/endpoints/endpoints.go index ec6be94b1b1..749c7a98093 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ffa69b12ec1 100644 --- a/service/apigatewaymanagementapi/api_client.go +++ b/service/apigatewaymanagementapi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..8fe110e73d0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigatewaymanagementapi/generated.json b/service/apigatewaymanagementapi/generated.json index 2bc3136f431..f0cd230e5d1 100644 --- a/service/apigatewaymanagementapi/generated.json +++ b/service/apigatewaymanagementapi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigatewaymanagementapi/go.mod b/service/apigatewaymanagementapi/go.mod index 0ab9f67dffd..0c31afd299c 100644 --- a/service/apigatewaymanagementapi/go.mod +++ b/service/apigatewaymanagementapi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigatewaymanagementapi/internal/endpoints/endpoints.go b/service/apigatewaymanagementapi/internal/endpoints/endpoints.go index ebbb86c388e..84abf965782 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4637074f2f7 100644 --- a/service/apigatewayv2/api_client.go +++ b/service/apigatewayv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..dd10c09dd54 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apigatewayv2/generated.json b/service/apigatewayv2/generated.json index 73b967b7586..60a1089c91a 100644 --- a/service/apigatewayv2/generated.json +++ b/service/apigatewayv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apigatewayv2/go.mod b/service/apigatewayv2/go.mod index 7fca10f53ff..bd3d40a178e 100644 --- a/service/apigatewayv2/go.mod +++ b/service/apigatewayv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apigatewayv2/internal/endpoints/endpoints.go b/service/apigatewayv2/internal/endpoints/endpoints.go index 25a2bead9db..cb32ffca5a5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a93160f1a5d 100644 --- a/service/appconfig/api_client.go +++ b/service/appconfig/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..75e2ec9f2ca 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appconfig/generated.json b/service/appconfig/generated.json index e25e7008baf..080c38ffae0 100644 --- a/service/appconfig/generated.json +++ b/service/appconfig/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appconfig/go.mod b/service/appconfig/go.mod index 494aba903f4..205c1ff18ac 100644 --- a/service/appconfig/go.mod +++ b/service/appconfig/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appconfig/internal/endpoints/endpoints.go b/service/appconfig/internal/endpoints/endpoints.go index 7610b669504..ce2075cad24 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9daa966238d 100644 --- a/service/appflow/api_client.go +++ b/service/appflow/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..cdded661a50 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appflow/generated.json b/service/appflow/generated.json index 055cd0c1c13..adcd5d6022c 100644 --- a/service/appflow/generated.json +++ b/service/appflow/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appflow/go.mod b/service/appflow/go.mod index 76438259646..bd5dabff5bf 100644 --- a/service/appflow/go.mod +++ b/service/appflow/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appflow/internal/endpoints/endpoints.go b/service/appflow/internal/endpoints/endpoints.go index 9746f944518..f4b3820db08 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6920313c90b 100644 --- a/service/appintegrations/api_client.go +++ b/service/appintegrations/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..abe9beae16f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appintegrations/generated.json b/service/appintegrations/generated.json index c95cb6ada84..51ac76eee5f 100644 --- a/service/appintegrations/generated.json +++ b/service/appintegrations/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appintegrations/go.mod b/service/appintegrations/go.mod index 0269e82b2b4..a47869b949a 100644 --- a/service/appintegrations/go.mod +++ b/service/appintegrations/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appintegrations/internal/endpoints/endpoints.go b/service/appintegrations/internal/endpoints/endpoints.go index 2ad7b1259b5..03061ebc748 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a843def4fd5 100644 --- a/service/applicationautoscaling/api_client.go +++ b/service/applicationautoscaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..688db724a29 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationautoscaling/generated.json b/service/applicationautoscaling/generated.json index 19b471cac16..a648466d7a1 100644 --- a/service/applicationautoscaling/generated.json +++ b/service/applicationautoscaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationautoscaling/go.mod b/service/applicationautoscaling/go.mod index 604e8ff4031..d0444dec17c 100644 --- a/service/applicationautoscaling/go.mod +++ b/service/applicationautoscaling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationautoscaling/internal/endpoints/endpoints.go b/service/applicationautoscaling/internal/endpoints/endpoints.go index 4e0b190e6c0..59d92c65612 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7b1b6252fd8 100644 --- a/service/applicationcostprofiler/api_client.go +++ b/service/applicationcostprofiler/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6449536338c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationcostprofiler/generated.json b/service/applicationcostprofiler/generated.json index 5748057b76e..a6e49df4f43 100644 --- a/service/applicationcostprofiler/generated.json +++ b/service/applicationcostprofiler/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationcostprofiler/go.mod b/service/applicationcostprofiler/go.mod index 1ccf2e76064..1ce9ddd5039 100644 --- a/service/applicationcostprofiler/go.mod +++ b/service/applicationcostprofiler/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationcostprofiler/internal/endpoints/endpoints.go b/service/applicationcostprofiler/internal/endpoints/endpoints.go index 2d07e7d5e15..3e403436dcb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f4bc29af352 100644 --- a/service/applicationdiscoveryservice/api_client.go +++ b/service/applicationdiscoveryservice/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7b005a648f9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationdiscoveryservice/generated.json b/service/applicationdiscoveryservice/generated.json index 3888c983989..06ad6bf4e63 100644 --- a/service/applicationdiscoveryservice/generated.json +++ b/service/applicationdiscoveryservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationdiscoveryservice/go.mod b/service/applicationdiscoveryservice/go.mod index e75f348fbdf..fe2d4f70aa7 100644 --- a/service/applicationdiscoveryservice/go.mod +++ b/service/applicationdiscoveryservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationdiscoveryservice/internal/endpoints/endpoints.go b/service/applicationdiscoveryservice/internal/endpoints/endpoints.go index 6da013b04a6..9f1bfffe033 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..417340a901f 100644 --- a/service/applicationinsights/api_client.go +++ b/service/applicationinsights/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..778ff527954 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/applicationinsights/generated.json b/service/applicationinsights/generated.json index fd66d09ac48..b9abb770bf4 100644 --- a/service/applicationinsights/generated.json +++ b/service/applicationinsights/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/applicationinsights/go.mod b/service/applicationinsights/go.mod index d66e3e3f43b..4bc04fae0f5 100644 --- a/service/applicationinsights/go.mod +++ b/service/applicationinsights/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/applicationinsights/internal/endpoints/endpoints.go b/service/applicationinsights/internal/endpoints/endpoints.go index e0b2f7bce8d..c07509155b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..87b806f2e9f 100644 --- a/service/appmesh/api_client.go +++ b/service/appmesh/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..68197ce2d3b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appmesh/generated.json b/service/appmesh/generated.json index 50e5c8918a1..baabacca5c1 100644 --- a/service/appmesh/generated.json +++ b/service/appmesh/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appmesh/go.mod b/service/appmesh/go.mod index f18f06016ab..0419075586b 100644 --- a/service/appmesh/go.mod +++ b/service/appmesh/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appmesh/internal/endpoints/endpoints.go b/service/appmesh/internal/endpoints/endpoints.go index 93ee60c76fb..d18e9103907 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..272bb10b2ca 100644 --- a/service/apprunner/api_client.go +++ b/service/apprunner/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3d941b504d5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/apprunner/generated.json b/service/apprunner/generated.json index 8444a344c49..ea9bd51368d 100644 --- a/service/apprunner/generated.json +++ b/service/apprunner/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/apprunner/go.mod b/service/apprunner/go.mod index 46c49d49b28..ad51b30c75a 100644 --- a/service/apprunner/go.mod +++ b/service/apprunner/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/apprunner/internal/endpoints/endpoints.go b/service/apprunner/internal/endpoints/endpoints.go index 79fd9da5930..95e38fd6410 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d88707f2233 100644 --- a/service/appstream/api_client.go +++ b/service/appstream/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7285a9a68c9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appstream/generated.json b/service/appstream/generated.json index a0a010d57b3..dde3a34c10c 100644 --- a/service/appstream/generated.json +++ b/service/appstream/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/appstream/go.mod b/service/appstream/go.mod index 65b602c6c06..2c06796efe8 100644 --- a/service/appstream/go.mod +++ b/service/appstream/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appstream/internal/endpoints/endpoints.go b/service/appstream/internal/endpoints/endpoints.go index af0172f9102..111abfc48e0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9671cae7074 100644 --- a/service/appsync/api_client.go +++ b/service/appsync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..05699e892f4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/appsync/generated.json b/service/appsync/generated.json index 7e1504bdb71..64bd6c13097 100644 --- a/service/appsync/generated.json +++ b/service/appsync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/appsync/go.mod b/service/appsync/go.mod index 03efe71bc7f..afa49680e94 100644 --- a/service/appsync/go.mod +++ b/service/appsync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/appsync/internal/endpoints/endpoints.go b/service/appsync/internal/endpoints/endpoints.go index 5096c541776..e87e9d354d7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..8d0690b96df 100644 --- a/service/athena/api_client.go +++ b/service/athena/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..286a25a8e66 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/athena/generated.json b/service/athena/generated.json index d2ac1848565..423b75a8d83 100644 --- a/service/athena/generated.json +++ b/service/athena/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/athena/go.mod b/service/athena/go.mod index e0c4d69ddb9..87776f84302 100644 --- a/service/athena/go.mod +++ b/service/athena/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/athena/internal/endpoints/endpoints.go b/service/athena/internal/endpoints/endpoints.go index e80044ca747..73adfad060a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a2af0c35ec8 100644 --- a/service/auditmanager/api_client.go +++ b/service/auditmanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..164c029ed21 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/auditmanager/generated.json b/service/auditmanager/generated.json index 508c8f6ff16..82362c5076c 100644 --- a/service/auditmanager/generated.json +++ b/service/auditmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/auditmanager/go.mod b/service/auditmanager/go.mod index d87c59000ac..bc5262c2d90 100644 --- a/service/auditmanager/go.mod +++ b/service/auditmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/auditmanager/internal/endpoints/endpoints.go b/service/auditmanager/internal/endpoints/endpoints.go index 765d7686205..c700dc062e1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..038c769ac06 100644 --- a/service/autoscaling/api_client.go +++ b/service/autoscaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f90bbc5529b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/autoscaling/generated.json b/service/autoscaling/generated.json index 99e692d4e87..76c17c7cce0 100644 --- a/service/autoscaling/generated.json +++ b/service/autoscaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/autoscaling/go.mod b/service/autoscaling/go.mod index efb2a039831..6665fc1cc6d 100644 --- a/service/autoscaling/go.mod +++ b/service/autoscaling/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/autoscaling/internal/endpoints/endpoints.go b/service/autoscaling/internal/endpoints/endpoints.go index f76d1bb2ab7..6e2f10ee862 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4f956a7684e 100644 --- a/service/autoscalingplans/api_client.go +++ b/service/autoscalingplans/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c7dce98c9c5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/autoscalingplans/generated.json b/service/autoscalingplans/generated.json index f1cde7f23ef..9fcb1f8ff1d 100644 --- a/service/autoscalingplans/generated.json +++ b/service/autoscalingplans/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/autoscalingplans/go.mod b/service/autoscalingplans/go.mod index d69fd567495..89907e54e40 100644 --- a/service/autoscalingplans/go.mod +++ b/service/autoscalingplans/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/autoscalingplans/internal/endpoints/endpoints.go b/service/autoscalingplans/internal/endpoints/endpoints.go index b05ee1f7b08..ac253a60b6d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ea86cdfad45 100644 --- a/service/backup/api_client.go +++ b/service/backup/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6d68ecca5bb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/backup/generated.json b/service/backup/generated.json index 6b8eba961c2..ae26bb98572 100644 --- a/service/backup/generated.json +++ b/service/backup/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/backup/go.mod b/service/backup/go.mod index 6bab2049a4d..26cc18e8fc4 100644 --- a/service/backup/go.mod +++ b/service/backup/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/backup/internal/endpoints/endpoints.go b/service/backup/internal/endpoints/endpoints.go index 088393e1b3a..405f2168dfb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..af5cde9b4dd 100644 --- a/service/batch/api_client.go +++ b/service/batch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3de074e2484 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/batch/generated.json b/service/batch/generated.json index f006b094c3f..e02bbc2c9f8 100644 --- a/service/batch/generated.json +++ b/service/batch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/batch/go.mod b/service/batch/go.mod index 9b76a4cdb98..baddf9dbe18 100644 --- a/service/batch/go.mod +++ b/service/batch/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/batch/internal/endpoints/endpoints.go b/service/batch/internal/endpoints/endpoints.go index e71d6732060..8056c5f4095 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1285f2de228 100644 --- a/service/braket/api_client.go +++ b/service/braket/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1d0bcc3f0da 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/braket/generated.json b/service/braket/generated.json index 1a04d91c4cd..c9278a26dd1 100644 --- a/service/braket/generated.json +++ b/service/braket/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/braket/go.mod b/service/braket/go.mod index 50e059b6870..e3a337d1601 100644 --- a/service/braket/go.mod +++ b/service/braket/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/braket/internal/endpoints/endpoints.go b/service/braket/internal/endpoints/endpoints.go index 59e35fe9988..5dece44cee9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9f7fce6d8af 100644 --- a/service/budgets/api_client.go +++ b/service/budgets/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..98fc1d934ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/budgets/generated.json b/service/budgets/generated.json index 947494004ea..4c3667d7715 100644 --- a/service/budgets/generated.json +++ b/service/budgets/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/budgets/go.mod b/service/budgets/go.mod index 7e65c7b9f63..e8037e57bdf 100644 --- a/service/budgets/go.mod +++ b/service/budgets/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/budgets/internal/endpoints/endpoints.go b/service/budgets/internal/endpoints/endpoints.go index b703951419d..24ce23fc226 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2061bb43947 100644 --- a/service/chime/api_client.go +++ b/service/chime/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..bc73ad4d048 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/chime/generated.json b/service/chime/generated.json index 9a53d952620..c14f09b6535 100644 --- a/service/chime/generated.json +++ b/service/chime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/chime/go.mod b/service/chime/go.mod index e63f4a3b8ae..83416a83e16 100644 --- a/service/chime/go.mod +++ b/service/chime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/chime/internal/endpoints/endpoints.go b/service/chime/internal/endpoints/endpoints.go index 354c011c1f3..254db3d3d92 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1329d723df7 100644 --- a/service/cloud9/api_client.go +++ b/service/cloud9/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..84c3e74e27a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloud9/generated.json b/service/cloud9/generated.json index eb5bc43d685..321b2a6197c 100644 --- a/service/cloud9/generated.json +++ b/service/cloud9/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloud9/go.mod b/service/cloud9/go.mod index f0e8ce7f5f8..3c41ee8e149 100644 --- a/service/cloud9/go.mod +++ b/service/cloud9/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloud9/internal/endpoints/endpoints.go b/service/cloud9/internal/endpoints/endpoints.go index d61bbbc02d8..2bd6e2a1240 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d6dc954bedb 100644 --- a/service/clouddirectory/api_client.go +++ b/service/clouddirectory/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f0e95a21574 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/clouddirectory/generated.json b/service/clouddirectory/generated.json index 90513542c45..869bcb2d8cd 100644 --- a/service/clouddirectory/generated.json +++ b/service/clouddirectory/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/clouddirectory/go.mod b/service/clouddirectory/go.mod index 4d2a4f8737e..e58fbee94f2 100644 --- a/service/clouddirectory/go.mod +++ b/service/clouddirectory/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/clouddirectory/internal/endpoints/endpoints.go b/service/clouddirectory/internal/endpoints/endpoints.go index 4baf5b24ad9..d304358b21b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a922e038a8f 100644 --- a/service/cloudformation/api_client.go +++ b/service/cloudformation/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b2302a07b90 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudformation/generated.json b/service/cloudformation/generated.json index f799af4a1b6..ab65568fe92 100644 --- a/service/cloudformation/generated.json +++ b/service/cloudformation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudformation/go.mod b/service/cloudformation/go.mod index 053de65bfa0..9e20d8ddd95 100644 --- a/service/cloudformation/go.mod +++ b/service/cloudformation/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudformation/internal/endpoints/endpoints.go b/service/cloudformation/internal/endpoints/endpoints.go index 219d3c08410..be58a3a309e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..af351402a5c 100644 --- a/service/cloudfront/api_client.go +++ b/service/cloudfront/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6bf60b0ab77 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudfront/generated.json b/service/cloudfront/generated.json index 2566ab6e439..eac182bb4e6 100644 --- a/service/cloudfront/generated.json +++ b/service/cloudfront/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudfront/go.mod b/service/cloudfront/go.mod index ea6378c5b12..00eabe32877 100644 --- a/service/cloudfront/go.mod +++ b/service/cloudfront/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudfront/internal/endpoints/endpoints.go b/service/cloudfront/internal/endpoints/endpoints.go index 0a6cf0f0e8d..aebb9a2ee41 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0c6e9002a40 100644 --- a/service/cloudhsm/api_client.go +++ b/service/cloudhsm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d91ec10d501 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudhsm/generated.json b/service/cloudhsm/generated.json index 54d8891a900..93b60fbbe64 100644 --- a/service/cloudhsm/generated.json +++ b/service/cloudhsm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudhsm/go.mod b/service/cloudhsm/go.mod index 5c29f92d661..480c3c9b185 100644 --- a/service/cloudhsm/go.mod +++ b/service/cloudhsm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudhsm/internal/endpoints/endpoints.go b/service/cloudhsm/internal/endpoints/endpoints.go index 56b90bf2cab..632444acc88 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6be9a4e4add 100644 --- a/service/cloudhsmv2/api_client.go +++ b/service/cloudhsmv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..230f984e406 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudhsmv2/generated.json b/service/cloudhsmv2/generated.json index eba18fa4c76..3dc82e31979 100644 --- a/service/cloudhsmv2/generated.json +++ b/service/cloudhsmv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudhsmv2/go.mod b/service/cloudhsmv2/go.mod index f2569ef01fb..98f996ae360 100644 --- a/service/cloudhsmv2/go.mod +++ b/service/cloudhsmv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudhsmv2/internal/endpoints/endpoints.go b/service/cloudhsmv2/internal/endpoints/endpoints.go index abc838baf65..6363e51168f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ca5c4a44adb 100644 --- a/service/cloudsearch/api_client.go +++ b/service/cloudsearch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e2ca0c61bda 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudsearch/generated.json b/service/cloudsearch/generated.json index 244ab1ded26..6b9699cd1d9 100644 --- a/service/cloudsearch/generated.json +++ b/service/cloudsearch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudsearch/go.mod b/service/cloudsearch/go.mod index 21bd9346101..a29803d51a3 100644 --- a/service/cloudsearch/go.mod +++ b/service/cloudsearch/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudsearch/internal/endpoints/endpoints.go b/service/cloudsearch/internal/endpoints/endpoints.go index db302055ec8..29f89efafd4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f6863a29edd 100644 --- a/service/cloudsearchdomain/api_client.go +++ b/service/cloudsearchdomain/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ad31a5c49df 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudsearchdomain/generated.json b/service/cloudsearchdomain/generated.json index 6fce1eae492..2372c462dfc 100644 --- a/service/cloudsearchdomain/generated.json +++ b/service/cloudsearchdomain/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudsearchdomain/go.mod b/service/cloudsearchdomain/go.mod index 51078a48f52..6dede6274df 100644 --- a/service/cloudsearchdomain/go.mod +++ b/service/cloudsearchdomain/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudsearchdomain/internal/endpoints/endpoints.go b/service/cloudsearchdomain/internal/endpoints/endpoints.go index 9c9c4ac6eb0..0949ce23685 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ff8e5ec49f4 100644 --- a/service/cloudtrail/api_client.go +++ b/service/cloudtrail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ac8b0e1809d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudtrail/generated.json b/service/cloudtrail/generated.json index c7bbe93e42d..219ef69fee6 100644 --- a/service/cloudtrail/generated.json +++ b/service/cloudtrail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudtrail/go.mod b/service/cloudtrail/go.mod index d4610bbec3c..8796c216c76 100644 --- a/service/cloudtrail/go.mod +++ b/service/cloudtrail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudtrail/internal/endpoints/endpoints.go b/service/cloudtrail/internal/endpoints/endpoints.go index 85c542dcd6a..790285469e6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..08ddebadb25 100644 --- a/service/cloudwatch/api_client.go +++ b/service/cloudwatch/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d790645f96b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatch/generated.json b/service/cloudwatch/generated.json index 840046217b6..ba6c409a046 100644 --- a/service/cloudwatch/generated.json +++ b/service/cloudwatch/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/cloudwatch/go.mod b/service/cloudwatch/go.mod index a81e5a66a5b..5af1f521aeb 100644 --- a/service/cloudwatch/go.mod +++ b/service/cloudwatch/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatch/internal/endpoints/endpoints.go b/service/cloudwatch/internal/endpoints/endpoints.go index 71f2a46e039..f9a58b28bd6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1477143032b 100644 --- a/service/cloudwatchevents/api_client.go +++ b/service/cloudwatchevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9bb0d13e1d0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatchevents/generated.json b/service/cloudwatchevents/generated.json index 60acae12cb8..da802e43705 100644 --- a/service/cloudwatchevents/generated.json +++ b/service/cloudwatchevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudwatchevents/go.mod b/service/cloudwatchevents/go.mod index d0ec6f4f459..b470b2d1556 100644 --- a/service/cloudwatchevents/go.mod +++ b/service/cloudwatchevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatchevents/internal/endpoints/endpoints.go b/service/cloudwatchevents/internal/endpoints/endpoints.go index 6ae66cfe7d9..25d20b35c52 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d2e6b4da4c2 100644 --- a/service/cloudwatchlogs/api_client.go +++ b/service/cloudwatchlogs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..73470d26457 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cloudwatchlogs/generated.json b/service/cloudwatchlogs/generated.json index 287ac2d99a5..e933b1ceda2 100644 --- a/service/cloudwatchlogs/generated.json +++ b/service/cloudwatchlogs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cloudwatchlogs/go.mod b/service/cloudwatchlogs/go.mod index ca24aaab951..339d2fc8a0a 100644 --- a/service/cloudwatchlogs/go.mod +++ b/service/cloudwatchlogs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cloudwatchlogs/internal/endpoints/endpoints.go b/service/cloudwatchlogs/internal/endpoints/endpoints.go index e5656cc5352..aa076cdf7aa 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..52f9ab994a4 100644 --- a/service/codeartifact/api_client.go +++ b/service/codeartifact/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c5aa1aafe77 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codeartifact/generated.json b/service/codeartifact/generated.json index 2d82f271963..6973558b51f 100644 --- a/service/codeartifact/generated.json +++ b/service/codeartifact/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codeartifact/go.mod b/service/codeartifact/go.mod index 0ac27b1b4d9..ed3580a0ea2 100644 --- a/service/codeartifact/go.mod +++ b/service/codeartifact/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codeartifact/internal/endpoints/endpoints.go b/service/codeartifact/internal/endpoints/endpoints.go index 2b3df152f79..7a1a2a85058 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c853ac29a58 100644 --- a/service/codebuild/api_client.go +++ b/service/codebuild/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c9dca7f7ee9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codebuild/generated.json b/service/codebuild/generated.json index 7460301b047..c2aadebc6e4 100644 --- a/service/codebuild/generated.json +++ b/service/codebuild/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codebuild/go.mod b/service/codebuild/go.mod index 1e28ba2a289..aee2798c5b6 100644 --- a/service/codebuild/go.mod +++ b/service/codebuild/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codebuild/internal/endpoints/endpoints.go b/service/codebuild/internal/endpoints/endpoints.go index 97c1dab3f07..10b17b409a0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a376f61fc89 100644 --- a/service/codecommit/api_client.go +++ b/service/codecommit/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b2bf5b5c97f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codecommit/generated.json b/service/codecommit/generated.json index f3e87f0ea5c..f1afa114fa6 100644 --- a/service/codecommit/generated.json +++ b/service/codecommit/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codecommit/go.mod b/service/codecommit/go.mod index d2c70634add..b19efaddbad 100644 --- a/service/codecommit/go.mod +++ b/service/codecommit/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codecommit/internal/endpoints/endpoints.go b/service/codecommit/internal/endpoints/endpoints.go index 934fdb3c7f6..574ad84be6e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a9be6f23a60 100644 --- a/service/codedeploy/api_client.go +++ b/service/codedeploy/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6cbfed0724f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codedeploy/generated.json b/service/codedeploy/generated.json index 7408f67ad46..1674f7146a4 100644 --- a/service/codedeploy/generated.json +++ b/service/codedeploy/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/codedeploy/go.mod b/service/codedeploy/go.mod index b12016d8dc3..146a2628f72 100644 --- a/service/codedeploy/go.mod +++ b/service/codedeploy/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codedeploy/internal/endpoints/endpoints.go b/service/codedeploy/internal/endpoints/endpoints.go index 5a9237a04da..559a4918041 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0da7275c6ec 100644 --- a/service/codeguruprofiler/api_client.go +++ b/service/codeguruprofiler/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..fcb26f6b8ad 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codeguruprofiler/generated.json b/service/codeguruprofiler/generated.json index 5bc52f1cb8d..328da329492 100644 --- a/service/codeguruprofiler/generated.json +++ b/service/codeguruprofiler/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codeguruprofiler/go.mod b/service/codeguruprofiler/go.mod index fd5824df8b0..de103990e4a 100644 --- a/service/codeguruprofiler/go.mod +++ b/service/codeguruprofiler/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codeguruprofiler/internal/endpoints/endpoints.go b/service/codeguruprofiler/internal/endpoints/endpoints.go index e16158b8bba..fd901fc8871 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..82e60ae5f31 100644 --- a/service/codegurureviewer/api_client.go +++ b/service/codegurureviewer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..47466e56e25 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codegurureviewer/generated.json b/service/codegurureviewer/generated.json index 1b22f1ed3fb..faec0ef5b1e 100644 --- a/service/codegurureviewer/generated.json +++ b/service/codegurureviewer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codegurureviewer/go.mod b/service/codegurureviewer/go.mod index 6fc209e31a2..498cc017fd2 100644 --- a/service/codegurureviewer/go.mod +++ b/service/codegurureviewer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codegurureviewer/internal/endpoints/endpoints.go b/service/codegurureviewer/internal/endpoints/endpoints.go index 015d20f2c5b..7fed5f8c275 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..cf1a6deb32b 100644 --- a/service/codepipeline/api_client.go +++ b/service/codepipeline/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c232377f41d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codepipeline/generated.json b/service/codepipeline/generated.json index 0d3578f9f25..fa43cf7f01f 100644 --- a/service/codepipeline/generated.json +++ b/service/codepipeline/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codepipeline/go.mod b/service/codepipeline/go.mod index 3b19fb08a3f..f689aa67b6a 100644 --- a/service/codepipeline/go.mod +++ b/service/codepipeline/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codepipeline/internal/endpoints/endpoints.go b/service/codepipeline/internal/endpoints/endpoints.go index ac052a6cc69..5025a71b9fb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2704893169d 100644 --- a/service/codestar/api_client.go +++ b/service/codestar/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ca374c6705a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestar/generated.json b/service/codestar/generated.json index afc939df783..fb90e8ac9de 100644 --- a/service/codestar/generated.json +++ b/service/codestar/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestar/go.mod b/service/codestar/go.mod index 2478f4dbd96..49e523b6b63 100644 --- a/service/codestar/go.mod +++ b/service/codestar/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestar/internal/endpoints/endpoints.go b/service/codestar/internal/endpoints/endpoints.go index 6b51a45195c..b3d1b6b9f09 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..44a2dc10cb6 100644 --- a/service/codestarconnections/api_client.go +++ b/service/codestarconnections/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..54c71aa39fe 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestarconnections/generated.json b/service/codestarconnections/generated.json index 85a193bec07..bffc8fb8983 100644 --- a/service/codestarconnections/generated.json +++ b/service/codestarconnections/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestarconnections/go.mod b/service/codestarconnections/go.mod index 150258e39c5..3d9823913cf 100644 --- a/service/codestarconnections/go.mod +++ b/service/codestarconnections/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestarconnections/internal/endpoints/endpoints.go b/service/codestarconnections/internal/endpoints/endpoints.go index f335bab68cc..139ac6be433 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..aea422fbfe3 100644 --- a/service/codestarnotifications/api_client.go +++ b/service/codestarnotifications/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6aea987e3f4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/codestarnotifications/generated.json b/service/codestarnotifications/generated.json index 572c6f9a13a..5d0d6fba77d 100644 --- a/service/codestarnotifications/generated.json +++ b/service/codestarnotifications/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/codestarnotifications/go.mod b/service/codestarnotifications/go.mod index a5362d8ee40..459d3222936 100644 --- a/service/codestarnotifications/go.mod +++ b/service/codestarnotifications/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/codestarnotifications/internal/endpoints/endpoints.go b/service/codestarnotifications/internal/endpoints/endpoints.go index cef3e8a42f3..ad5e2b4eab0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..606b0965417 100644 --- a/service/cognitoidentity/api_client.go +++ b/service/cognitoidentity/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e1052c3885b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitoidentity/generated.json b/service/cognitoidentity/generated.json index d522158734a..f2eb0e8c913 100644 --- a/service/cognitoidentity/generated.json +++ b/service/cognitoidentity/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitoidentity/go.mod b/service/cognitoidentity/go.mod index 15b8c5c49df..c1b4dbb3d56 100644 --- a/service/cognitoidentity/go.mod +++ b/service/cognitoidentity/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitoidentity/internal/endpoints/endpoints.go b/service/cognitoidentity/internal/endpoints/endpoints.go index 44d82c07be7..7a011d0d210 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5c68c739e4a 100644 --- a/service/cognitoidentityprovider/api_client.go +++ b/service/cognitoidentityprovider/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7bb2aea5d17 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitoidentityprovider/generated.json b/service/cognitoidentityprovider/generated.json index 5ae34cd8976..6261460f52f 100644 --- a/service/cognitoidentityprovider/generated.json +++ b/service/cognitoidentityprovider/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitoidentityprovider/go.mod b/service/cognitoidentityprovider/go.mod index e2eea70483a..efc735d8190 100644 --- a/service/cognitoidentityprovider/go.mod +++ b/service/cognitoidentityprovider/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitoidentityprovider/internal/endpoints/endpoints.go b/service/cognitoidentityprovider/internal/endpoints/endpoints.go index 6d26e1980d3..6d5a04beb7e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0cd870d6b2e 100644 --- a/service/cognitosync/api_client.go +++ b/service/cognitosync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..14abb0434ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/cognitosync/generated.json b/service/cognitosync/generated.json index 69e470c50de..b23fc1af6f5 100644 --- a/service/cognitosync/generated.json +++ b/service/cognitosync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/cognitosync/go.mod b/service/cognitosync/go.mod index 04966d453b9..ed22c49e190 100644 --- a/service/cognitosync/go.mod +++ b/service/cognitosync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/cognitosync/internal/endpoints/endpoints.go b/service/cognitosync/internal/endpoints/endpoints.go index 66418eb2a3e..f64317db25d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -83,6 +110,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -113,6 +145,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "cognito-sync.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/comprehend/api_client.go b/service/comprehend/api_client.go index 564ab679775..b4833448376 100644 --- a/service/comprehend/api_client.go +++ b/service/comprehend/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f843c227598 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/comprehend/generated.json b/service/comprehend/generated.json index 225192b6d0f..ddc43601cf2 100644 --- a/service/comprehend/generated.json +++ b/service/comprehend/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/comprehend/go.mod b/service/comprehend/go.mod index 52689925f63..39303882464 100644 --- a/service/comprehend/go.mod +++ b/service/comprehend/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/comprehend/internal/endpoints/endpoints.go b/service/comprehend/internal/endpoints/endpoints.go index f10e610913f..5f29e39620b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..30bc2f58f27 100644 --- a/service/comprehendmedical/api_client.go +++ b/service/comprehendmedical/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..39ff3270a88 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/comprehendmedical/generated.json b/service/comprehendmedical/generated.json index 4ace1874818..a8a8825584e 100644 --- a/service/comprehendmedical/generated.json +++ b/service/comprehendmedical/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/comprehendmedical/go.mod b/service/comprehendmedical/go.mod index 51f63c2026e..c9d1b28f3a1 100644 --- a/service/comprehendmedical/go.mod +++ b/service/comprehendmedical/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/comprehendmedical/internal/endpoints/endpoints.go b/service/comprehendmedical/internal/endpoints/endpoints.go index 378c4f4c843..06fc9d91abf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9ac130356c8 100644 --- a/service/computeoptimizer/api_client.go +++ b/service/computeoptimizer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d82024b5c97 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/computeoptimizer/generated.json b/service/computeoptimizer/generated.json index fd6e34f6bba..46f10eef869 100644 --- a/service/computeoptimizer/generated.json +++ b/service/computeoptimizer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/computeoptimizer/go.mod b/service/computeoptimizer/go.mod index cee66794dd0..48c67b5546a 100644 --- a/service/computeoptimizer/go.mod +++ b/service/computeoptimizer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/computeoptimizer/internal/endpoints/endpoints.go b/service/computeoptimizer/internal/endpoints/endpoints.go index 27311acaeed..a3fc3e6c2ac 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..411878c6623 100644 --- a/service/configservice/api_client.go +++ b/service/configservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..300d45b577c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/configservice/generated.json b/service/configservice/generated.json index b7e23312df4..34868153eb5 100644 --- a/service/configservice/generated.json +++ b/service/configservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/configservice/go.mod b/service/configservice/go.mod index 32971f7b00e..dfbeeb6747b 100644 --- a/service/configservice/go.mod +++ b/service/configservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/configservice/internal/endpoints/endpoints.go b/service/configservice/internal/endpoints/endpoints.go index c4e1b3f1c3e..afe72eb261f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..3afa40a3995 100644 --- a/service/connect/api_client.go +++ b/service/connect/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..13bd72a3362 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connect/generated.json b/service/connect/generated.json index 35c4a411e4b..79989a4fcbf 100644 --- a/service/connect/generated.json +++ b/service/connect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connect/go.mod b/service/connect/go.mod index f086b985446..dc8f9cb64b5 100644 --- a/service/connect/go.mod +++ b/service/connect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connect/internal/endpoints/endpoints.go b/service/connect/internal/endpoints/endpoints.go index 371f57361df..152275fbf81 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..fa0099c6a86 100644 --- a/service/connectcontactlens/api_client.go +++ b/service/connectcontactlens/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..caa55638602 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connectcontactlens/generated.json b/service/connectcontactlens/generated.json index 135dd6d07d8..3c9fcd0bb00 100644 --- a/service/connectcontactlens/generated.json +++ b/service/connectcontactlens/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connectcontactlens/go.mod b/service/connectcontactlens/go.mod index 93a73d0c251..8db9482d7ab 100644 --- a/service/connectcontactlens/go.mod +++ b/service/connectcontactlens/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connectcontactlens/internal/endpoints/endpoints.go b/service/connectcontactlens/internal/endpoints/endpoints.go index 84f2c8f9cf8..e5d9fe9f731 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..07094c95c25 100644 --- a/service/connectparticipant/api_client.go +++ b/service/connectparticipant/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c5d8bca43c3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/connectparticipant/generated.json b/service/connectparticipant/generated.json index 4208f5d102e..34b2ee70e09 100644 --- a/service/connectparticipant/generated.json +++ b/service/connectparticipant/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/connectparticipant/go.mod b/service/connectparticipant/go.mod index a6e41051677..74a97f68f00 100644 --- a/service/connectparticipant/go.mod +++ b/service/connectparticipant/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/connectparticipant/internal/endpoints/endpoints.go b/service/connectparticipant/internal/endpoints/endpoints.go index ed9a038e8e3..1fb339d3d17 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..40f20d25a19 100644 --- a/service/costandusagereportservice/api_client.go +++ b/service/costandusagereportservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e1008c9e3f9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/costandusagereportservice/generated.json b/service/costandusagereportservice/generated.json index fe03c60378b..512b80bd383 100644 --- a/service/costandusagereportservice/generated.json +++ b/service/costandusagereportservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/costandusagereportservice/go.mod b/service/costandusagereportservice/go.mod index 61bc7b26542..8fa7bbfef1e 100644 --- a/service/costandusagereportservice/go.mod +++ b/service/costandusagereportservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/costandusagereportservice/internal/endpoints/endpoints.go b/service/costandusagereportservice/internal/endpoints/endpoints.go index e4e9fb51af7..74b6dd78897 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..bad3d391336 100644 --- a/service/costexplorer/api_client.go +++ b/service/costexplorer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..fd0a976e371 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/costexplorer/generated.json b/service/costexplorer/generated.json index b2bd04e8ce6..6105c4cca9b 100644 --- a/service/costexplorer/generated.json +++ b/service/costexplorer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/costexplorer/go.mod b/service/costexplorer/go.mod index cfb37918675..4567a5efb30 100644 --- a/service/costexplorer/go.mod +++ b/service/costexplorer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/costexplorer/internal/endpoints/endpoints.go b/service/costexplorer/internal/endpoints/endpoints.go index 4d6bb582d1f..be896138823 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..934af1a36d0 100644 --- a/service/customerprofiles/api_client.go +++ b/service/customerprofiles/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1fd7cfd15bd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/customerprofiles/generated.json b/service/customerprofiles/generated.json index 93d6381c679..9ef1ac5596b 100644 --- a/service/customerprofiles/generated.json +++ b/service/customerprofiles/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/customerprofiles/go.mod b/service/customerprofiles/go.mod index 04d8473be7c..04328c3946b 100644 --- a/service/customerprofiles/go.mod +++ b/service/customerprofiles/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/customerprofiles/internal/endpoints/endpoints.go b/service/customerprofiles/internal/endpoints/endpoints.go index cf1cb364644..dba7176c356 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..481ca38fe90 100644 --- a/service/databasemigrationservice/api_client.go +++ b/service/databasemigrationservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..22440b8747f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/databasemigrationservice/generated.json b/service/databasemigrationservice/generated.json index f0da7859ab8..92707c6e7cd 100644 --- a/service/databasemigrationservice/generated.json +++ b/service/databasemigrationservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/databasemigrationservice/go.mod b/service/databasemigrationservice/go.mod index e3837f7a69c..00f7e9193b4 100644 --- a/service/databasemigrationservice/go.mod +++ b/service/databasemigrationservice/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/databasemigrationservice/internal/endpoints/endpoints.go b/service/databasemigrationservice/internal/endpoints/endpoints.go index 6dd5ff8cb37..97b7baab4bc 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b39042265d5 100644 --- a/service/databrew/api_client.go +++ b/service/databrew/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..83bf1c79bb0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/databrew/generated.json b/service/databrew/generated.json index e5808d746bc..0a87068d220 100644 --- a/service/databrew/generated.json +++ b/service/databrew/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/databrew/go.mod b/service/databrew/go.mod index 94ba6044e4c..c0fa947b289 100644 --- a/service/databrew/go.mod +++ b/service/databrew/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/databrew/internal/endpoints/endpoints.go b/service/databrew/internal/endpoints/endpoints.go index c5e04d5b426..aa358695c76 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9f202be1c70 100644 --- a/service/dataexchange/api_client.go +++ b/service/dataexchange/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..baf6420ef91 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dataexchange/generated.json b/service/dataexchange/generated.json index edb8d0e25ba..f27f800f3ca 100644 --- a/service/dataexchange/generated.json +++ b/service/dataexchange/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dataexchange/go.mod b/service/dataexchange/go.mod index e9c45979330..9adc28bd67c 100644 --- a/service/dataexchange/go.mod +++ b/service/dataexchange/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dataexchange/internal/endpoints/endpoints.go b/service/dataexchange/internal/endpoints/endpoints.go index d8bf505936a..80b321b3c58 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..8123b30246a 100644 --- a/service/datapipeline/api_client.go +++ b/service/datapipeline/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a2a3c10a6d3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/datapipeline/generated.json b/service/datapipeline/generated.json index 2cd6d13f467..0df15036569 100644 --- a/service/datapipeline/generated.json +++ b/service/datapipeline/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/datapipeline/go.mod b/service/datapipeline/go.mod index b85eaf17951..9daa5295fd0 100644 --- a/service/datapipeline/go.mod +++ b/service/datapipeline/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/datapipeline/internal/endpoints/endpoints.go b/service/datapipeline/internal/endpoints/endpoints.go index e6494bd00a8..4ef2f6bf5d8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f67442f51be 100644 --- a/service/datasync/api_client.go +++ b/service/datasync/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..80860d58fa0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/datasync/generated.json b/service/datasync/generated.json index 16132dbea42..05b00f13993 100644 --- a/service/datasync/generated.json +++ b/service/datasync/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/datasync/go.mod b/service/datasync/go.mod index 4af30ead0e0..a77aab47595 100644 --- a/service/datasync/go.mod +++ b/service/datasync/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/datasync/internal/endpoints/endpoints.go b/service/datasync/internal/endpoints/endpoints.go index bb16024d794..5dcc803b398 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dcd5cb03a23 100644 --- a/service/dax/api_client.go +++ b/service/dax/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e310382fce5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dax/generated.json b/service/dax/generated.json index 347c49af62e..00cdc4f041f 100644 --- a/service/dax/generated.json +++ b/service/dax/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dax/go.mod b/service/dax/go.mod index f5aeeb073eb..d361cf754fa 100644 --- a/service/dax/go.mod +++ b/service/dax/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dax/internal/endpoints/endpoints.go b/service/dax/internal/endpoints/endpoints.go index 9e39bc9fdad..2e7639c8703 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..3ee2811e0bd 100644 --- a/service/detective/api_client.go +++ b/service/detective/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..22ef32133dd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/detective/generated.json b/service/detective/generated.json index f5facb79698..46e70299e8e 100644 --- a/service/detective/generated.json +++ b/service/detective/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/detective/go.mod b/service/detective/go.mod index f3f6c0fb193..52e3862e360 100644 --- a/service/detective/go.mod +++ b/service/detective/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/detective/internal/endpoints/endpoints.go b/service/detective/internal/endpoints/endpoints.go index 9fbd5ecf372..49dbc42f063 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7be7dbd88e2 100644 --- a/service/devicefarm/api_client.go +++ b/service/devicefarm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a340c68d814 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/devicefarm/generated.json b/service/devicefarm/generated.json index 24dc6ed9bf5..768627685a4 100644 --- a/service/devicefarm/generated.json +++ b/service/devicefarm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/devicefarm/go.mod b/service/devicefarm/go.mod index 8e45ba254af..310ecbfb932 100644 --- a/service/devicefarm/go.mod +++ b/service/devicefarm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/devicefarm/internal/endpoints/endpoints.go b/service/devicefarm/internal/endpoints/endpoints.go index 40073ae13fe..9af051ca862 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a0aee68bdd3 100644 --- a/service/devopsguru/api_client.go +++ b/service/devopsguru/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..07da21d5998 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/devopsguru/generated.json b/service/devopsguru/generated.json index 89b4944cabb..19a7735a3e8 100644 --- a/service/devopsguru/generated.json +++ b/service/devopsguru/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/devopsguru/go.mod b/service/devopsguru/go.mod index 020c75945d8..5447c45cdb7 100644 --- a/service/devopsguru/go.mod +++ b/service/devopsguru/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/devopsguru/internal/endpoints/endpoints.go b/service/devopsguru/internal/endpoints/endpoints.go index f2e191cb49c..477562e50bd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e04d4afd506 100644 --- a/service/directconnect/api_client.go +++ b/service/directconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..dffe149b2b6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/directconnect/generated.json b/service/directconnect/generated.json index baf64e95ab8..0cf810d17b7 100644 --- a/service/directconnect/generated.json +++ b/service/directconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/directconnect/go.mod b/service/directconnect/go.mod index 93c0e389c14..c07da97e462 100644 --- a/service/directconnect/go.mod +++ b/service/directconnect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/directconnect/internal/endpoints/endpoints.go b/service/directconnect/internal/endpoints/endpoints.go index 23242ed01cf..05dbf9dcc9f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1c5c5436bc3 100644 --- a/service/directoryservice/api_client.go +++ b/service/directoryservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3ad05ba6c99 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/directoryservice/generated.json b/service/directoryservice/generated.json index 30ffa995826..19da8c9d69c 100644 --- a/service/directoryservice/generated.json +++ b/service/directoryservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/directoryservice/go.mod b/service/directoryservice/go.mod index 903cf45406a..55787f35282 100644 --- a/service/directoryservice/go.mod +++ b/service/directoryservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/directoryservice/internal/endpoints/endpoints.go b/service/directoryservice/internal/endpoints/endpoints.go index 75038511820..345d79076cd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..71785365906 100644 --- a/service/dlm/api_client.go +++ b/service/dlm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..93857b1c50a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dlm/generated.json b/service/dlm/generated.json index 02fecf7da08..5538251bbff 100644 --- a/service/dlm/generated.json +++ b/service/dlm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dlm/go.mod b/service/dlm/go.mod index bd080769a95..550afa106b7 100644 --- a/service/dlm/go.mod +++ b/service/dlm/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dlm/internal/endpoints/endpoints.go b/service/dlm/internal/endpoints/endpoints.go index e8763adcc88..cb6fd3cd659 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..50a6683ee6d 100644 --- a/service/docdb/api_client.go +++ b/service/docdb/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d2f794fbbaf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/docdb/generated.json b/service/docdb/generated.json index bfd9f5afec1..e73ad02d847 100644 --- a/service/docdb/generated.json +++ b/service/docdb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/docdb/go.mod b/service/docdb/go.mod index 6a1627694ec..e2416bdd32b 100644 --- a/service/docdb/go.mod +++ b/service/docdb/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/docdb/internal/endpoints/endpoints.go b/service/docdb/internal/endpoints/endpoints.go index 5644a75810e..c1296616d94 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..41e1f8bcf2a 100644 --- a/service/dynamodb/api_client.go +++ b/service/dynamodb/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" ddbcust "github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/customizations" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" smithy "github.com/aws/smithy-go" @@ -188,6 +189,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -265,6 +267,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1e89dc75a39 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dynamodb/generated.json b/service/dynamodb/generated.json index c9ce02ba94c..66beb0d67c2 100644 --- a/service/dynamodb/generated.json +++ b/service/dynamodb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/dynamodb/go.mod b/service/dynamodb/go.mod index c82308d8a0d..d2e9f28fca3 100644 --- a/service/dynamodb/go.mod +++ b/service/dynamodb/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../service/internal/accept-encoding/ diff --git a/service/dynamodb/internal/endpoints/endpoints.go b/service/dynamodb/internal/endpoints/endpoints.go index 4775744b70c..c8078801317 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..bd6277f6bc5 100644 --- a/service/dynamodbstreams/api_client.go +++ b/service/dynamodbstreams/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f48844453bd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/dynamodbstreams/generated.json b/service/dynamodbstreams/generated.json index 03c95f60c5d..496d4a0931a 100644 --- a/service/dynamodbstreams/generated.json +++ b/service/dynamodbstreams/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/dynamodbstreams/go.mod b/service/dynamodbstreams/go.mod index c01661c0f2a..cbca0cf3cda 100644 --- a/service/dynamodbstreams/go.mod +++ b/service/dynamodbstreams/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/dynamodbstreams/internal/endpoints/endpoints.go b/service/dynamodbstreams/internal/endpoints/endpoints.go index 0055a5e504c..66ce8064e47 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5c929ee3f5f 100644 --- a/service/ebs/api_client.go +++ b/service/ebs/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a44f7453996 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ebs/generated.json b/service/ebs/generated.json index 4409d7c3bc5..78677a9fd0e 100644 --- a/service/ebs/generated.json +++ b/service/ebs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ebs/go.mod b/service/ebs/go.mod index 8c3d2357be7..dc5cbf0db66 100644 --- a/service/ebs/go.mod +++ b/service/ebs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ebs/internal/endpoints/endpoints.go b/service/ebs/internal/endpoints/endpoints.go index 927f2add75a..5cf9654aefe 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b4723895ad2 100644 --- a/service/ec2/api_client.go +++ b/service/ec2/api_client.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -181,6 +182,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -258,6 +260,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..71af2a3c707 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ec2/generated.json b/service/ec2/generated.json index 695b0f68eab..24d60fb93a0 100644 --- a/service/ec2/generated.json +++ b/service/ec2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/ec2/go.mod b/service/ec2/go.mod index 772f156e252..a14a80eb45b 100644 --- a/service/ec2/go.mod +++ b/service/ec2/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/ec2/internal/endpoints/endpoints.go b/service/ec2/internal/endpoints/endpoints.go index 662abcfe69a..b2377e97bc9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7f7646777a8 100644 --- a/service/ec2instanceconnect/api_client.go +++ b/service/ec2instanceconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7a934e62698 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ec2instanceconnect/generated.json b/service/ec2instanceconnect/generated.json index b09db2451ae..8ffb4fc8748 100644 --- a/service/ec2instanceconnect/generated.json +++ b/service/ec2instanceconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ec2instanceconnect/go.mod b/service/ec2instanceconnect/go.mod index 147108ffe87..6f13214f25d 100644 --- a/service/ec2instanceconnect/go.mod +++ b/service/ec2instanceconnect/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ec2instanceconnect/internal/endpoints/endpoints.go b/service/ec2instanceconnect/internal/endpoints/endpoints.go index 7f0f654966e..2fb475b7b3e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..22219a30790 100644 --- a/service/ecr/api_client.go +++ b/service/ecr/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b4405a0440d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecr/generated.json b/service/ecr/generated.json index 5c4d5aa642d..6204485ba28 100644 --- a/service/ecr/generated.json +++ b/service/ecr/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ecr/go.mod b/service/ecr/go.mod index fefd915d9e7..287f04faaad 100644 --- a/service/ecr/go.mod +++ b/service/ecr/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecr/internal/endpoints/endpoints.go b/service/ecr/internal/endpoints/endpoints.go index 2cdc06963b8..d135ed7bb52 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b663e1fae80 100644 --- a/service/ecrpublic/api_client.go +++ b/service/ecrpublic/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..bd9116aa672 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecrpublic/generated.json b/service/ecrpublic/generated.json index b62a2747792..ae500454307 100644 --- a/service/ecrpublic/generated.json +++ b/service/ecrpublic/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ecrpublic/go.mod b/service/ecrpublic/go.mod index 1dbe8489202..2f7cb7db86d 100644 --- a/service/ecrpublic/go.mod +++ b/service/ecrpublic/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecrpublic/internal/endpoints/endpoints.go b/service/ecrpublic/internal/endpoints/endpoints.go index 35d866b09b9..9ff2213894b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a7dbab58e9a 100644 --- a/service/ecs/api_client.go +++ b/service/ecs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3ebb5a660b7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ecs/generated.json b/service/ecs/generated.json index e893edbcfb0..aeb75fb8400 100644 --- a/service/ecs/generated.json +++ b/service/ecs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ecs/go.mod b/service/ecs/go.mod index 2f5e1775241..de1a1550ec0 100644 --- a/service/ecs/go.mod +++ b/service/ecs/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ecs/internal/endpoints/endpoints.go b/service/ecs/internal/endpoints/endpoints.go index 41cfa9db7ed..9fcfca2a5ef 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c6433ef8c01 100644 --- a/service/efs/api_client.go +++ b/service/efs/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..caa9aa18a1a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/efs/generated.json b/service/efs/generated.json index ad802774bf9..c8c3f7cfd12 100644 --- a/service/efs/generated.json +++ b/service/efs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/efs/go.mod b/service/efs/go.mod index 88bf95a0202..317530595a2 100644 --- a/service/efs/go.mod +++ b/service/efs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/efs/internal/endpoints/endpoints.go b/service/efs/internal/endpoints/endpoints.go index 14686231323..3045785e542 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c233b995031 100644 --- a/service/eks/api_client.go +++ b/service/eks/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1ff86024a36 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/eks/generated.json b/service/eks/generated.json index 70dcc48430d..22c1dddc853 100644 --- a/service/eks/generated.json +++ b/service/eks/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/eks/go.mod b/service/eks/go.mod index 100b210f28b..cd4b9f37bcc 100644 --- a/service/eks/go.mod +++ b/service/eks/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/eks/internal/endpoints/endpoints.go b/service/eks/internal/endpoints/endpoints.go index 6ba0ee37d9f..bde6ea5a85c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..06b6956e2b3 100644 --- a/service/elasticache/api_client.go +++ b/service/elasticache/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..fdbe45f5a93 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticache/generated.json b/service/elasticache/generated.json index e7e6b1c6705..4411a1930f9 100644 --- a/service/elasticache/generated.json +++ b/service/elasticache/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticache/go.mod b/service/elasticache/go.mod index 05d5de63b24..1e75ac3372d 100644 --- a/service/elasticache/go.mod +++ b/service/elasticache/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticache/internal/endpoints/endpoints.go b/service/elasticache/internal/endpoints/endpoints.go index c6f6ac58c29..bd9ebdb34ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..bb92c406566 100644 --- a/service/elasticbeanstalk/api_client.go +++ b/service/elasticbeanstalk/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..17feeb37276 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticbeanstalk/generated.json b/service/elasticbeanstalk/generated.json index 70a46a1a3fb..d91e0498829 100644 --- a/service/elasticbeanstalk/generated.json +++ b/service/elasticbeanstalk/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticbeanstalk/go.mod b/service/elasticbeanstalk/go.mod index f0fc4bde743..04221025197 100644 --- a/service/elasticbeanstalk/go.mod +++ b/service/elasticbeanstalk/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticbeanstalk/internal/endpoints/endpoints.go b/service/elasticbeanstalk/internal/endpoints/endpoints.go index 1cba36fc02b..53206407413 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b8a59bd57be 100644 --- a/service/elasticinference/api_client.go +++ b/service/elasticinference/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..35ca542ce9e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticinference/generated.json b/service/elasticinference/generated.json index c65c605f092..0295254bb15 100644 --- a/service/elasticinference/generated.json +++ b/service/elasticinference/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticinference/go.mod b/service/elasticinference/go.mod index e9b3dafab22..8797ff76d35 100644 --- a/service/elasticinference/go.mod +++ b/service/elasticinference/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticinference/internal/endpoints/endpoints.go b/service/elasticinference/internal/endpoints/endpoints.go index 7eb758057ed..79fe3dcca5d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b981387ac2d 100644 --- a/service/elasticloadbalancing/api_client.go +++ b/service/elasticloadbalancing/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2635581326f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticloadbalancing/generated.json b/service/elasticloadbalancing/generated.json index b51aa0195a1..3d0825504c0 100644 --- a/service/elasticloadbalancing/generated.json +++ b/service/elasticloadbalancing/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elasticloadbalancing/go.mod b/service/elasticloadbalancing/go.mod index e2bface1677..d97be9ab814 100644 --- a/service/elasticloadbalancing/go.mod +++ b/service/elasticloadbalancing/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticloadbalancing/internal/endpoints/endpoints.go b/service/elasticloadbalancing/internal/endpoints/endpoints.go index 8d48240d18d..2578cc8e351 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a84434eb6b7 100644 --- a/service/elasticloadbalancingv2/api_client.go +++ b/service/elasticloadbalancingv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..53fb08f5e3f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticloadbalancingv2/generated.json b/service/elasticloadbalancingv2/generated.json index 411ceb1c549..46331460c43 100644 --- a/service/elasticloadbalancingv2/generated.json +++ b/service/elasticloadbalancingv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticloadbalancingv2/go.mod b/service/elasticloadbalancingv2/go.mod index 32ed9b9f5cf..210579bb568 100644 --- a/service/elasticloadbalancingv2/go.mod +++ b/service/elasticloadbalancingv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticloadbalancingv2/internal/endpoints/endpoints.go b/service/elasticloadbalancingv2/internal/endpoints/endpoints.go index 75b3938cd28..5e4ac476402 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..570f8eb3072 100644 --- a/service/elasticsearchservice/api_client.go +++ b/service/elasticsearchservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..050039eb19e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elasticsearchservice/generated.json b/service/elasticsearchservice/generated.json index 3034bc0c95f..dfab0347ca0 100644 --- a/service/elasticsearchservice/generated.json +++ b/service/elasticsearchservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/elasticsearchservice/go.mod b/service/elasticsearchservice/go.mod index eb2e2499657..25b80791411 100644 --- a/service/elasticsearchservice/go.mod +++ b/service/elasticsearchservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elasticsearchservice/internal/endpoints/endpoints.go b/service/elasticsearchservice/internal/endpoints/endpoints.go index 7899165ffd8..6811fee0a55 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..99609eae942 100644 --- a/service/elastictranscoder/api_client.go +++ b/service/elastictranscoder/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1a58f1e8005 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/elastictranscoder/generated.json b/service/elastictranscoder/generated.json index b5215913e23..f5418a696b6 100644 --- a/service/elastictranscoder/generated.json +++ b/service/elastictranscoder/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/elastictranscoder/go.mod b/service/elastictranscoder/go.mod index a2d293366f8..d415f5e4a09 100644 --- a/service/elastictranscoder/go.mod +++ b/service/elastictranscoder/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/elastictranscoder/internal/endpoints/endpoints.go b/service/elastictranscoder/internal/endpoints/endpoints.go index f3f8500a3d8..9568b90f6f7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6cf5ba58612 100644 --- a/service/emr/api_client.go +++ b/service/emr/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d79266b6b4e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/emr/generated.json b/service/emr/generated.json index 0bbc313259f..8dc05a8111b 100644 --- a/service/emr/generated.json +++ b/service/emr/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/emr/go.mod b/service/emr/go.mod index e14f6c7c431..e3c8a190a75 100644 --- a/service/emr/go.mod +++ b/service/emr/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/emr/internal/endpoints/endpoints.go b/service/emr/internal/endpoints/endpoints.go index 81141593b53..76594caaf67 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a7adb22e2d0 100644 --- a/service/emrcontainers/api_client.go +++ b/service/emrcontainers/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3e8a8f8a76c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/emrcontainers/generated.json b/service/emrcontainers/generated.json index 715e8ab45ae..9174e042826 100644 --- a/service/emrcontainers/generated.json +++ b/service/emrcontainers/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/emrcontainers/go.mod b/service/emrcontainers/go.mod index 3d2aec325b2..6ccf6ffcbf0 100644 --- a/service/emrcontainers/go.mod +++ b/service/emrcontainers/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/emrcontainers/internal/endpoints/endpoints.go b/service/emrcontainers/internal/endpoints/endpoints.go index 7fcc744fdd4..bbba9110803 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e3716274f30 100644 --- a/service/eventbridge/api_client.go +++ b/service/eventbridge/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ae2a6dfbf37 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/eventbridge/generated.json b/service/eventbridge/generated.json index dde8d327c48..b5f9f235660 100644 --- a/service/eventbridge/generated.json +++ b/service/eventbridge/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/eventbridge/go.mod b/service/eventbridge/go.mod index ccbc3e6ceba..065ff6862f3 100644 --- a/service/eventbridge/go.mod +++ b/service/eventbridge/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/eventbridge/internal/endpoints/endpoints.go b/service/eventbridge/internal/endpoints/endpoints.go index aa3949eb443..eeeca5536f2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2fd5c8aca68 100644 --- a/service/finspace/api_client.go +++ b/service/finspace/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + return nil +} + type customizeRestJsonContentType struct { } diff --git a/service/finspace/endpoints.go b/service/finspace/endpoints.go index fdba9b27cbb..e83793deb44 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/finspace/generated.json b/service/finspace/generated.json index 2fd8f1b0ce3..07e19021310 100644 --- a/service/finspace/generated.json +++ b/service/finspace/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/finspace/go.mod b/service/finspace/go.mod index b0b41e4e658..8efabb75a6f 100644 --- a/service/finspace/go.mod +++ b/service/finspace/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/finspace/internal/endpoints/endpoints.go b/service/finspace/internal/endpoints/endpoints.go index 2b17ed5db17..64b579f54fe 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0fbef899bb7 100644 --- a/service/finspacedata/api_client.go +++ b/service/finspacedata/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + return nil +} + type customizeRestJsonContentType struct { } diff --git a/service/finspacedata/endpoints.go b/service/finspacedata/endpoints.go index 713b3b5324f..6a010e5fb09 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/finspacedata/generated.json b/service/finspacedata/generated.json index 8633315d9b5..8db2054d0da 100644 --- a/service/finspacedata/generated.json +++ b/service/finspacedata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/finspacedata/go.mod b/service/finspacedata/go.mod index d0666c27f33..d471c20f263 100644 --- a/service/finspacedata/go.mod +++ b/service/finspacedata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/finspacedata/internal/endpoints/endpoints.go b/service/finspacedata/internal/endpoints/endpoints.go index 88ed180d996..b4a2185f911 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2992570d4ed 100644 --- a/service/firehose/api_client.go +++ b/service/firehose/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b7ed1c183ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/firehose/generated.json b/service/firehose/generated.json index c76257f824a..983dcc39085 100644 --- a/service/firehose/generated.json +++ b/service/firehose/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/firehose/go.mod b/service/firehose/go.mod index 1936fc94e07..c7a47623093 100644 --- a/service/firehose/go.mod +++ b/service/firehose/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/firehose/internal/endpoints/endpoints.go b/service/firehose/internal/endpoints/endpoints.go index 54d67917f09..46a975957b8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..224c23dcc72 100644 --- a/service/fis/api_client.go +++ b/service/fis/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..103fc0e68c0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fis/generated.json b/service/fis/generated.json index 2259f9fcda3..00e1ac98b94 100644 --- a/service/fis/generated.json +++ b/service/fis/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fis/go.mod b/service/fis/go.mod index be3e98f341f..ed0b5cb4a66 100644 --- a/service/fis/go.mod +++ b/service/fis/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fis/internal/endpoints/endpoints.go b/service/fis/internal/endpoints/endpoints.go index 65127706ea1..5746e062954 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..43bf9bc0cf9 100644 --- a/service/fms/api_client.go +++ b/service/fms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1eb59760298 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fms/generated.json b/service/fms/generated.json index a0879eed409..08f6826b7b8 100644 --- a/service/fms/generated.json +++ b/service/fms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fms/go.mod b/service/fms/go.mod index 0e027f3a7ed..b639ace5586 100644 --- a/service/fms/go.mod +++ b/service/fms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fms/internal/endpoints/endpoints.go b/service/fms/internal/endpoints/endpoints.go index 15230a5d756..3be99b46821 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0a34beeab69 100644 --- a/service/forecast/api_client.go +++ b/service/forecast/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ee3230070e4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/forecast/generated.json b/service/forecast/generated.json index 1bd8c9ad6ac..7ba793e893b 100644 --- a/service/forecast/generated.json +++ b/service/forecast/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/forecast/go.mod b/service/forecast/go.mod index 398a9a5cc12..c839e1e6b57 100644 --- a/service/forecast/go.mod +++ b/service/forecast/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/forecast/internal/endpoints/endpoints.go b/service/forecast/internal/endpoints/endpoints.go index 93fe94a5c2e..19e74f1c291 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..08881ff7a93 100644 --- a/service/forecastquery/api_client.go +++ b/service/forecastquery/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..8b99022bee7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/forecastquery/generated.json b/service/forecastquery/generated.json index 850fe6b541f..ce54b2d6eb5 100644 --- a/service/forecastquery/generated.json +++ b/service/forecastquery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/forecastquery/go.mod b/service/forecastquery/go.mod index 3b5d6790d63..2a066996060 100644 --- a/service/forecastquery/go.mod +++ b/service/forecastquery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/forecastquery/internal/endpoints/endpoints.go b/service/forecastquery/internal/endpoints/endpoints.go index 537f74b2ec0..f953d1a62a8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dc4230ab8ab 100644 --- a/service/frauddetector/api_client.go +++ b/service/frauddetector/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1ed90555b50 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/frauddetector/generated.json b/service/frauddetector/generated.json index e4d8181b2fc..890f3bec1ab 100644 --- a/service/frauddetector/generated.json +++ b/service/frauddetector/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/frauddetector/go.mod b/service/frauddetector/go.mod index fcd69584a4f..7e15ed6f26a 100644 --- a/service/frauddetector/go.mod +++ b/service/frauddetector/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/frauddetector/internal/endpoints/endpoints.go b/service/frauddetector/internal/endpoints/endpoints.go index 15064bd22f7..24aa458ef72 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5f2d9957ac7 100644 --- a/service/fsx/api_client.go +++ b/service/fsx/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d860da616f1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/fsx/generated.json b/service/fsx/generated.json index fb5258c96b3..826ea8b57b4 100644 --- a/service/fsx/generated.json +++ b/service/fsx/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/fsx/go.mod b/service/fsx/go.mod index f45eee0f70d..d59f27f41b8 100644 --- a/service/fsx/go.mod +++ b/service/fsx/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/fsx/internal/endpoints/endpoints.go b/service/fsx/internal/endpoints/endpoints.go index f65d7846aa4..4e7ed04d188 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e904d2ebf38 100644 --- a/service/gamelift/api_client.go +++ b/service/gamelift/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..de6773b41e4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/gamelift/generated.json b/service/gamelift/generated.json index 442b5faa537..f7c5aa73c4a 100644 --- a/service/gamelift/generated.json +++ b/service/gamelift/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/gamelift/go.mod b/service/gamelift/go.mod index 2c7ee40386b..2ddd3ffb7f5 100644 --- a/service/gamelift/go.mod +++ b/service/gamelift/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/gamelift/internal/endpoints/endpoints.go b/service/gamelift/internal/endpoints/endpoints.go index 119284ceef7..11ef4a00084 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7c12d294b21 100644 --- a/service/glacier/api_client.go +++ b/service/glacier/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..00dd66f1b4a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/glacier/generated.json b/service/glacier/generated.json index cf5b32b159a..c9fe7118b07 100644 --- a/service/glacier/generated.json +++ b/service/glacier/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/glacier/go.mod b/service/glacier/go.mod index 00737a1fc10..16f0883e025 100644 --- a/service/glacier/go.mod +++ b/service/glacier/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/glacier/internal/endpoints/endpoints.go b/service/glacier/internal/endpoints/endpoints.go index 464ba7b2a8a..8e1c7965d3f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..da259dc7e67 100644 --- a/service/globalaccelerator/api_client.go +++ b/service/globalaccelerator/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f8ea0df799a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/globalaccelerator/generated.json b/service/globalaccelerator/generated.json index cf3353f06f0..d540d94bf10 100644 --- a/service/globalaccelerator/generated.json +++ b/service/globalaccelerator/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/globalaccelerator/go.mod b/service/globalaccelerator/go.mod index 1d7f8713ff9..48ee12c3fc9 100644 --- a/service/globalaccelerator/go.mod +++ b/service/globalaccelerator/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/globalaccelerator/internal/endpoints/endpoints.go b/service/globalaccelerator/internal/endpoints/endpoints.go index af477d74ca9..edd5539deb2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..eaf92fc9144 100644 --- a/service/glue/api_client.go +++ b/service/glue/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a60f1bbd3de 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/glue/generated.json b/service/glue/generated.json index 005b9533271..c67e6881eb2 100644 --- a/service/glue/generated.json +++ b/service/glue/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/glue/go.mod b/service/glue/go.mod index e521be411a6..3449fddf65a 100644 --- a/service/glue/go.mod +++ b/service/glue/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/glue/internal/endpoints/endpoints.go b/service/glue/internal/endpoints/endpoints.go index 8087602acbf..257b1b8bd84 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5b867ec7645 100644 --- a/service/greengrass/api_client.go +++ b/service/greengrass/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2fa1927c246 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/greengrass/generated.json b/service/greengrass/generated.json index da06b23ef0d..dbe08f01aae 100644 --- a/service/greengrass/generated.json +++ b/service/greengrass/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/greengrass/go.mod b/service/greengrass/go.mod index 4fbba4c123e..db83be09faa 100644 --- a/service/greengrass/go.mod +++ b/service/greengrass/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/greengrass/internal/endpoints/endpoints.go b/service/greengrass/internal/endpoints/endpoints.go index e8f20ad2f75..27cca10f1ee 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..50f68725f94 100644 --- a/service/greengrassv2/api_client.go +++ b/service/greengrassv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5466202607d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/greengrassv2/generated.json b/service/greengrassv2/generated.json index 51ab3303ad7..3d00e5e30d9 100644 --- a/service/greengrassv2/generated.json +++ b/service/greengrassv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/greengrassv2/go.mod b/service/greengrassv2/go.mod index cd38835e02f..f4d4e9b63cb 100644 --- a/service/greengrassv2/go.mod +++ b/service/greengrassv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/greengrassv2/internal/endpoints/endpoints.go b/service/greengrassv2/internal/endpoints/endpoints.go index 15b34cb3e73..69bc7179f71 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..fed735e665a 100644 --- a/service/groundstation/api_client.go +++ b/service/groundstation/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1c735365c55 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/groundstation/generated.json b/service/groundstation/generated.json index 9d7a6da591e..0f8ac4d1230 100644 --- a/service/groundstation/generated.json +++ b/service/groundstation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/groundstation/go.mod b/service/groundstation/go.mod index ae6dc143b89..1a17f7aff15 100644 --- a/service/groundstation/go.mod +++ b/service/groundstation/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/groundstation/internal/endpoints/endpoints.go b/service/groundstation/internal/endpoints/endpoints.go index c932a500060..96314630b3d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..72a028efad7 100644 --- a/service/guardduty/api_client.go +++ b/service/guardduty/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2e671f2bb18 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/guardduty/generated.json b/service/guardduty/generated.json index ed34ee9e746..c626519e24d 100644 --- a/service/guardduty/generated.json +++ b/service/guardduty/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/guardduty/go.mod b/service/guardduty/go.mod index aedddf97352..72a3287046a 100644 --- a/service/guardduty/go.mod +++ b/service/guardduty/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/guardduty/internal/endpoints/endpoints.go b/service/guardduty/internal/endpoints/endpoints.go index e6dccdade4d..b18333dab35 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..40843d6b06d 100644 --- a/service/health/api_client.go +++ b/service/health/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b34444f56cd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/health/generated.json b/service/health/generated.json index bef4b99d5a3..ddaa4e3bc14 100644 --- a/service/health/generated.json +++ b/service/health/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/health/go.mod b/service/health/go.mod index 7b9401e984e..c6b946076ab 100644 --- a/service/health/go.mod +++ b/service/health/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/health/internal/endpoints/endpoints.go b/service/health/internal/endpoints/endpoints.go index 22b5bcbf18f..4a112174abb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..72551aa39d9 100644 --- a/service/healthlake/api_client.go +++ b/service/healthlake/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f7cab66845d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/healthlake/generated.json b/service/healthlake/generated.json index 2e38506da96..2248ed3ee0e 100644 --- a/service/healthlake/generated.json +++ b/service/healthlake/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/healthlake/go.mod b/service/healthlake/go.mod index 0bd430315eb..d8a6e330f63 100644 --- a/service/healthlake/go.mod +++ b/service/healthlake/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/healthlake/internal/endpoints/endpoints.go b/service/healthlake/internal/endpoints/endpoints.go index b71767b9b8e..c5081770654 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b362c6aa7d6 100644 --- a/service/honeycode/api_client.go +++ b/service/honeycode/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c06d6f887f3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/honeycode/generated.json b/service/honeycode/generated.json index 90ac648d0c5..81b882f14aa 100644 --- a/service/honeycode/generated.json +++ b/service/honeycode/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/honeycode/go.mod b/service/honeycode/go.mod index 2ce82eae2c8..fec96f9b280 100644 --- a/service/honeycode/go.mod +++ b/service/honeycode/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/honeycode/internal/endpoints/endpoints.go b/service/honeycode/internal/endpoints/endpoints.go index 3301bdd0ea0..e9602af35d1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5187b9f2429 100644 --- a/service/iam/api_client.go +++ b/service/iam/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a7cb92ad346 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iam/generated.json b/service/iam/generated.json index b982aa97fe6..0a14b6dde1c 100644 --- a/service/iam/generated.json +++ b/service/iam/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iam/go.mod b/service/iam/go.mod index d00f6effd17..a371b288f4f 100644 --- a/service/iam/go.mod +++ b/service/iam/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iam/internal/endpoints/endpoints.go b/service/iam/internal/endpoints/endpoints.go index feacfef9e17..351bb9db710 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c007a8e9499 100644 --- a/service/identitystore/api_client.go +++ b/service/identitystore/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5e67b2ccd70 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/identitystore/generated.json b/service/identitystore/generated.json index 3252efa1895..5137f2d00e0 100644 --- a/service/identitystore/generated.json +++ b/service/identitystore/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/identitystore/go.mod b/service/identitystore/go.mod index 47fc7c00d99..0cc736ddb13 100644 --- a/service/identitystore/go.mod +++ b/service/identitystore/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/identitystore/internal/endpoints/endpoints.go b/service/identitystore/internal/endpoints/endpoints.go index 9a5366f36de..503b2b49760 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..973d00c290f 100644 --- a/service/imagebuilder/api_client.go +++ b/service/imagebuilder/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1fd10672f19 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/imagebuilder/generated.json b/service/imagebuilder/generated.json index 028cd21bf69..2f5bc776dd1 100644 --- a/service/imagebuilder/generated.json +++ b/service/imagebuilder/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/imagebuilder/go.mod b/service/imagebuilder/go.mod index f8fa4debaa6..aa25f9cb1bc 100644 --- a/service/imagebuilder/go.mod +++ b/service/imagebuilder/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/imagebuilder/internal/endpoints/endpoints.go b/service/imagebuilder/internal/endpoints/endpoints.go index 8f748643cf0..397ee6e9ee7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d555fe55418 100644 --- a/service/inspector/api_client.go +++ b/service/inspector/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f0fe24ded35 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/inspector/generated.json b/service/inspector/generated.json index 1153e8d29bf..202541592e0 100644 --- a/service/inspector/generated.json +++ b/service/inspector/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/inspector/go.mod b/service/inspector/go.mod index a5081b91d17..31616c2d2d3 100644 --- a/service/inspector/go.mod +++ b/service/inspector/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/inspector/internal/endpoints/endpoints.go b/service/inspector/internal/endpoints/endpoints.go index 9dcbe617859..bcb3f65b9ec 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -108,6 +135,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -138,6 +170,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "inspector.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ diff --git a/service/internal/benchmark/go.mod b/service/internal/benchmark/go.mod index 4f24de58c36..15ac8baac74 100644 --- a/service/internal/benchmark/go.mod +++ b/service/internal/benchmark/go.mod @@ -12,6 +12,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/dynamodb => ../../../service/dynamodb/ replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../../service/internal/accept-encoding/ diff --git a/service/internal/integrationtest/go.mod b/service/internal/integrationtest/go.mod index 929e85e7f3e..7046804c022 100644 --- a/service/internal/integrationtest/go.mod +++ b/service/internal/integrationtest/go.mod @@ -98,6 +98,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/acm => ../../../service/acm/ diff --git a/service/iot/api_client.go b/service/iot/api_client.go index c7fb40ea0c9..7b13f490eb4 100644 --- a/service/iot/api_client.go +++ b/service/iot/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..8f55db4ca79 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot/generated.json b/service/iot/generated.json index 2b25154c46a..de8d66b76af 100644 --- a/service/iot/generated.json +++ b/service/iot/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot/go.mod b/service/iot/go.mod index d75ea2c356d..55a9d923575 100644 --- a/service/iot/go.mod +++ b/service/iot/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot/internal/endpoints/endpoints.go b/service/iot/internal/endpoints/endpoints.go index e3e7a8fdb6b..5bf79d7799c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c6fd237512c 100644 --- a/service/iot1clickdevicesservice/api_client.go +++ b/service/iot1clickdevicesservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2c4708121a6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot1clickdevicesservice/generated.json b/service/iot1clickdevicesservice/generated.json index 4436eb6d804..8fcf111ae9b 100644 --- a/service/iot1clickdevicesservice/generated.json +++ b/service/iot1clickdevicesservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot1clickdevicesservice/go.mod b/service/iot1clickdevicesservice/go.mod index 06707016102..4ab17aef7e6 100644 --- a/service/iot1clickdevicesservice/go.mod +++ b/service/iot1clickdevicesservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot1clickdevicesservice/internal/endpoints/endpoints.go b/service/iot1clickdevicesservice/internal/endpoints/endpoints.go index fc324bd7f57..5155f62d788 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..59bfdeb28ad 100644 --- a/service/iot1clickprojects/api_client.go +++ b/service/iot1clickprojects/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ad33db5c435 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iot1clickprojects/generated.json b/service/iot1clickprojects/generated.json index 9680e1955c0..f2c68b7f399 100644 --- a/service/iot1clickprojects/generated.json +++ b/service/iot1clickprojects/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iot1clickprojects/go.mod b/service/iot1clickprojects/go.mod index 30de797ed66..0d25f8ec792 100644 --- a/service/iot1clickprojects/go.mod +++ b/service/iot1clickprojects/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iot1clickprojects/internal/endpoints/endpoints.go b/service/iot1clickprojects/internal/endpoints/endpoints.go index dc31a8d8f53..812394b9b23 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dd74fffebae 100644 --- a/service/iotanalytics/api_client.go +++ b/service/iotanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7488f9f16b5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotanalytics/generated.json b/service/iotanalytics/generated.json index 3f324c3985c..b07f16111e7 100644 --- a/service/iotanalytics/generated.json +++ b/service/iotanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotanalytics/go.mod b/service/iotanalytics/go.mod index aea9e897766..67a7b9d3d45 100644 --- a/service/iotanalytics/go.mod +++ b/service/iotanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotanalytics/internal/endpoints/endpoints.go b/service/iotanalytics/internal/endpoints/endpoints.go index 66b3ce80052..6e1dc380eeb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..84dc45ee0fe 100644 --- a/service/iotdataplane/api_client.go +++ b/service/iotdataplane/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7790e5ff300 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotdataplane/generated.json b/service/iotdataplane/generated.json index 788763c4648..30f762713f9 100644 --- a/service/iotdataplane/generated.json +++ b/service/iotdataplane/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotdataplane/go.mod b/service/iotdataplane/go.mod index bda8d521bff..e9f105cda72 100644 --- a/service/iotdataplane/go.mod +++ b/service/iotdataplane/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotdataplane/internal/endpoints/endpoints.go b/service/iotdataplane/internal/endpoints/endpoints.go index fc5aed39f9b..d1998314993 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9eac3a8d7b5 100644 --- a/service/iotdeviceadvisor/api_client.go +++ b/service/iotdeviceadvisor/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..84c8cd0c8cc 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotdeviceadvisor/generated.json b/service/iotdeviceadvisor/generated.json index 437302ae6f2..5f4b9b0362c 100644 --- a/service/iotdeviceadvisor/generated.json +++ b/service/iotdeviceadvisor/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotdeviceadvisor/go.mod b/service/iotdeviceadvisor/go.mod index 513f78aa2fc..77187a172d5 100644 --- a/service/iotdeviceadvisor/go.mod +++ b/service/iotdeviceadvisor/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotdeviceadvisor/internal/endpoints/endpoints.go b/service/iotdeviceadvisor/internal/endpoints/endpoints.go index 1dba70617a3..9337b81b3df 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..90f9b4285e3 100644 --- a/service/iotevents/api_client.go +++ b/service/iotevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..59f60247291 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotevents/generated.json b/service/iotevents/generated.json index 03b63cda66f..cd2f14de8a2 100644 --- a/service/iotevents/generated.json +++ b/service/iotevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotevents/go.mod b/service/iotevents/go.mod index baa39b5aa33..9a657746fd7 100644 --- a/service/iotevents/go.mod +++ b/service/iotevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotevents/internal/endpoints/endpoints.go b/service/iotevents/internal/endpoints/endpoints.go index e88731d6714..6c46c9a5cfc 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0af7046df2d 100644 --- a/service/ioteventsdata/api_client.go +++ b/service/ioteventsdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..20540650529 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ioteventsdata/generated.json b/service/ioteventsdata/generated.json index fbeed01403e..e6745ab7fae 100644 --- a/service/ioteventsdata/generated.json +++ b/service/ioteventsdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ioteventsdata/go.mod b/service/ioteventsdata/go.mod index d68c52c2071..56257a197b4 100644 --- a/service/ioteventsdata/go.mod +++ b/service/ioteventsdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ioteventsdata/internal/endpoints/endpoints.go b/service/ioteventsdata/internal/endpoints/endpoints.go index ad53cf92baa..9c898fc8c07 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..20bbbc12f70 100644 --- a/service/iotfleethub/api_client.go +++ b/service/iotfleethub/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..51b276a944e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotfleethub/generated.json b/service/iotfleethub/generated.json index 60815ad1266..df22ae60de1 100644 --- a/service/iotfleethub/generated.json +++ b/service/iotfleethub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotfleethub/go.mod b/service/iotfleethub/go.mod index 2fac20a2297..d97c722cd83 100644 --- a/service/iotfleethub/go.mod +++ b/service/iotfleethub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotfleethub/internal/endpoints/endpoints.go b/service/iotfleethub/internal/endpoints/endpoints.go index 26ea45900f1..60123af8aee 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..cc900c88598 100644 --- a/service/iotjobsdataplane/api_client.go +++ b/service/iotjobsdataplane/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..af04a9c6589 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotjobsdataplane/generated.json b/service/iotjobsdataplane/generated.json index 9eb71ea9377..5a698431729 100644 --- a/service/iotjobsdataplane/generated.json +++ b/service/iotjobsdataplane/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotjobsdataplane/go.mod b/service/iotjobsdataplane/go.mod index 145a53ab0a7..1563709f806 100644 --- a/service/iotjobsdataplane/go.mod +++ b/service/iotjobsdataplane/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotjobsdataplane/internal/endpoints/endpoints.go b/service/iotjobsdataplane/internal/endpoints/endpoints.go index 24a2db37bae..901906340f2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9436706041d 100644 --- a/service/iotsecuretunneling/api_client.go +++ b/service/iotsecuretunneling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1f0bfb92c1d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotsecuretunneling/generated.json b/service/iotsecuretunneling/generated.json index 8b2e89285c2..d58a7b75698 100644 --- a/service/iotsecuretunneling/generated.json +++ b/service/iotsecuretunneling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotsecuretunneling/go.mod b/service/iotsecuretunneling/go.mod index 5e9fa182b91..2010cfd24b9 100644 --- a/service/iotsecuretunneling/go.mod +++ b/service/iotsecuretunneling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotsecuretunneling/internal/endpoints/endpoints.go b/service/iotsecuretunneling/internal/endpoints/endpoints.go index 212fe083de8..ebef0584cee 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..41990163f6d 100644 --- a/service/iotsitewise/api_client.go +++ b/service/iotsitewise/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..61dd31020aa 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotsitewise/generated.json b/service/iotsitewise/generated.json index 5d778194d94..e6c38a02abe 100644 --- a/service/iotsitewise/generated.json +++ b/service/iotsitewise/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/iotsitewise/go.mod b/service/iotsitewise/go.mod index bd2a3d79f38..d70f0d96d8d 100644 --- a/service/iotsitewise/go.mod +++ b/service/iotsitewise/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotsitewise/internal/endpoints/endpoints.go b/service/iotsitewise/internal/endpoints/endpoints.go index 128bfefbf5b..da3e50a3f5f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b85db056b3f 100644 --- a/service/iotthingsgraph/api_client.go +++ b/service/iotthingsgraph/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..59202a8620e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotthingsgraph/generated.json b/service/iotthingsgraph/generated.json index 4cd5331580f..6c2ae6579b4 100644 --- a/service/iotthingsgraph/generated.json +++ b/service/iotthingsgraph/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotthingsgraph/go.mod b/service/iotthingsgraph/go.mod index 99b64070532..c4413d55687 100644 --- a/service/iotthingsgraph/go.mod +++ b/service/iotthingsgraph/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotthingsgraph/internal/endpoints/endpoints.go b/service/iotthingsgraph/internal/endpoints/endpoints.go index 3a3132cc83f..e41d5676869 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..649fa8fe097 100644 --- a/service/iotwireless/api_client.go +++ b/service/iotwireless/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..4313d293274 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/iotwireless/generated.json b/service/iotwireless/generated.json index 98f8f624da8..2c11b6b2646 100644 --- a/service/iotwireless/generated.json +++ b/service/iotwireless/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/iotwireless/go.mod b/service/iotwireless/go.mod index 732ae59e9d0..10589a8971c 100644 --- a/service/iotwireless/go.mod +++ b/service/iotwireless/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/iotwireless/internal/endpoints/endpoints.go b/service/iotwireless/internal/endpoints/endpoints.go index 715993c60e6..eea592b28b2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4f32f360a68 100644 --- a/service/ivs/api_client.go +++ b/service/ivs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..65338300f98 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ivs/generated.json b/service/ivs/generated.json index 333c51a7f18..d256d68b6ff 100644 --- a/service/ivs/generated.json +++ b/service/ivs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ivs/go.mod b/service/ivs/go.mod index c7e454ef4ab..aa9a7662ade 100644 --- a/service/ivs/go.mod +++ b/service/ivs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ivs/internal/endpoints/endpoints.go b/service/ivs/internal/endpoints/endpoints.go index e17ecb83889..3bd9b739ab0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dcae4227904 100644 --- a/service/kafka/api_client.go +++ b/service/kafka/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5b7fc9f74f0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kafka/generated.json b/service/kafka/generated.json index 5104342af3a..dcb86e920cd 100644 --- a/service/kafka/generated.json +++ b/service/kafka/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kafka/go.mod b/service/kafka/go.mod index 809f2c8f160..53b5ff8a661 100644 --- a/service/kafka/go.mod +++ b/service/kafka/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kafka/internal/endpoints/endpoints.go b/service/kafka/internal/endpoints/endpoints.go index 10228a91db0..ef7135378a2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..77bbe3849a6 100644 --- a/service/kendra/api_client.go +++ b/service/kendra/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b32d20ca2e0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kendra/generated.json b/service/kendra/generated.json index 0d35a222878..11891845a20 100644 --- a/service/kendra/generated.json +++ b/service/kendra/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kendra/go.mod b/service/kendra/go.mod index 42145e1d31c..297f62ec27d 100644 --- a/service/kendra/go.mod +++ b/service/kendra/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kendra/internal/endpoints/endpoints.go b/service/kendra/internal/endpoints/endpoints.go index baf3bceb07b..678464ec933 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9f7b1bca650 100644 --- a/service/kinesis/api_client.go +++ b/service/kinesis/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..945222a5b43 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesis/generated.json b/service/kinesis/generated.json index 71a27e4d77a..d0d214240f3 100644 --- a/service/kinesis/generated.json +++ b/service/kinesis/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/kinesis/go.mod b/service/kinesis/go.mod index 025aa387ac2..0c952ac4726 100644 --- a/service/kinesis/go.mod +++ b/service/kinesis/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesis/internal/endpoints/endpoints.go b/service/kinesis/internal/endpoints/endpoints.go index 6184560ad33..b7c2044be86 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1fa098b3970 100644 --- a/service/kinesisanalytics/api_client.go +++ b/service/kinesisanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..4efe248a629 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisanalytics/generated.json b/service/kinesisanalytics/generated.json index d426125a1d2..049f85a9370 100644 --- a/service/kinesisanalytics/generated.json +++ b/service/kinesisanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisanalytics/go.mod b/service/kinesisanalytics/go.mod index fb42ea5664c..bf379d69847 100644 --- a/service/kinesisanalytics/go.mod +++ b/service/kinesisanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisanalytics/internal/endpoints/endpoints.go b/service/kinesisanalytics/internal/endpoints/endpoints.go index 170b8c03d1d..4fae2797a39 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..8313e78d740 100644 --- a/service/kinesisanalyticsv2/api_client.go +++ b/service/kinesisanalyticsv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..270cd772d41 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisanalyticsv2/generated.json b/service/kinesisanalyticsv2/generated.json index 57ef12abb8f..70e00a6b9f3 100644 --- a/service/kinesisanalyticsv2/generated.json +++ b/service/kinesisanalyticsv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisanalyticsv2/go.mod b/service/kinesisanalyticsv2/go.mod index 027b1b5e9a4..cd48b33e0b5 100644 --- a/service/kinesisanalyticsv2/go.mod +++ b/service/kinesisanalyticsv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisanalyticsv2/internal/endpoints/endpoints.go b/service/kinesisanalyticsv2/internal/endpoints/endpoints.go index c6ebdb2a6c4..3884401d549 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ccd269e0204 100644 --- a/service/kinesisvideo/api_client.go +++ b/service/kinesisvideo/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5d5796b7434 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideo/generated.json b/service/kinesisvideo/generated.json index 54ec220ae37..638b3d879ff 100644 --- a/service/kinesisvideo/generated.json +++ b/service/kinesisvideo/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideo/go.mod b/service/kinesisvideo/go.mod index 850179ef005..220a80a2476 100644 --- a/service/kinesisvideo/go.mod +++ b/service/kinesisvideo/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideo/internal/endpoints/endpoints.go b/service/kinesisvideo/internal/endpoints/endpoints.go index 9df52df279b..f91f9d790be 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4170bb52f5d 100644 --- a/service/kinesisvideoarchivedmedia/api_client.go +++ b/service/kinesisvideoarchivedmedia/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..90b2a60c5f3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideoarchivedmedia/generated.json b/service/kinesisvideoarchivedmedia/generated.json index dd044a24024..44d65614401 100644 --- a/service/kinesisvideoarchivedmedia/generated.json +++ b/service/kinesisvideoarchivedmedia/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideoarchivedmedia/go.mod b/service/kinesisvideoarchivedmedia/go.mod index 17e393d4d35..c6173c91f77 100644 --- a/service/kinesisvideoarchivedmedia/go.mod +++ b/service/kinesisvideoarchivedmedia/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go b/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go index 9eb7eeae9dc..163c7fc6d41 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0bcfbec923c 100644 --- a/service/kinesisvideomedia/api_client.go +++ b/service/kinesisvideomedia/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c552da4ac39 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideomedia/generated.json b/service/kinesisvideomedia/generated.json index 2b7aefa7bd1..eda633f6484 100644 --- a/service/kinesisvideomedia/generated.json +++ b/service/kinesisvideomedia/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideomedia/go.mod b/service/kinesisvideomedia/go.mod index 5fc18522d42..a17825cf5b9 100644 --- a/service/kinesisvideomedia/go.mod +++ b/service/kinesisvideomedia/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideomedia/internal/endpoints/endpoints.go b/service/kinesisvideomedia/internal/endpoints/endpoints.go index 6dbbc9b7793..e2c5de35c56 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e878a4feb80 100644 --- a/service/kinesisvideosignaling/api_client.go +++ b/service/kinesisvideosignaling/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e4780fd87f9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kinesisvideosignaling/generated.json b/service/kinesisvideosignaling/generated.json index 372c4159155..2999ce9d64c 100644 --- a/service/kinesisvideosignaling/generated.json +++ b/service/kinesisvideosignaling/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kinesisvideosignaling/go.mod b/service/kinesisvideosignaling/go.mod index 381e2163ad2..688a78cfe99 100644 --- a/service/kinesisvideosignaling/go.mod +++ b/service/kinesisvideosignaling/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kinesisvideosignaling/internal/endpoints/endpoints.go b/service/kinesisvideosignaling/internal/endpoints/endpoints.go index 1ae7f41b3c3..28cb015ea6d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..da6427e028f 100644 --- a/service/kms/api_client.go +++ b/service/kms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..37797a6cd48 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/kms/generated.json b/service/kms/generated.json index 1a0d3d80bab..9b831b3622e 100644 --- a/service/kms/generated.json +++ b/service/kms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/kms/go.mod b/service/kms/go.mod index fd25ecfd068..8f200f9fd54 100644 --- a/service/kms/go.mod +++ b/service/kms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/kms/internal/endpoints/endpoints.go b/service/kms/internal/endpoints/endpoints.go index b1d1af3ae9f..c27f5920cbc 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..282351a5a16 100644 --- a/service/lakeformation/api_client.go +++ b/service/lakeformation/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ab00b0e769f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lakeformation/generated.json b/service/lakeformation/generated.json index 94c5e8a54f8..a286f2f3d3a 100644 --- a/service/lakeformation/generated.json +++ b/service/lakeformation/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lakeformation/go.mod b/service/lakeformation/go.mod index 87b68fa0709..6d50a1050c1 100644 --- a/service/lakeformation/go.mod +++ b/service/lakeformation/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lakeformation/internal/endpoints/endpoints.go b/service/lakeformation/internal/endpoints/endpoints.go index 4e6caac539e..73838deeb7f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..727cbf78121 100644 --- a/service/lambda/api_client.go +++ b/service/lambda/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5c25f083264 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lambda/generated.json b/service/lambda/generated.json index 277a058dbe8..8e443136c79 100644 --- a/service/lambda/generated.json +++ b/service/lambda/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/lambda/go.mod b/service/lambda/go.mod index 468d94346fa..9a187924fca 100644 --- a/service/lambda/go.mod +++ b/service/lambda/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lambda/internal/endpoints/endpoints.go b/service/lambda/internal/endpoints/endpoints.go index 96f259791f3..9e9aeef6795 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..303431fb14a 100644 --- a/service/lexmodelbuildingservice/api_client.go +++ b/service/lexmodelbuildingservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d3308b89c5c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexmodelbuildingservice/generated.json b/service/lexmodelbuildingservice/generated.json index b19eceb3814..ae63ccb5a37 100644 --- a/service/lexmodelbuildingservice/generated.json +++ b/service/lexmodelbuildingservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexmodelbuildingservice/go.mod b/service/lexmodelbuildingservice/go.mod index bfdcfe73dba..c6ccdcba764 100644 --- a/service/lexmodelbuildingservice/go.mod +++ b/service/lexmodelbuildingservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexmodelbuildingservice/internal/endpoints/endpoints.go b/service/lexmodelbuildingservice/internal/endpoints/endpoints.go index 2082eaa0c6e..75e133c3f00 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..fb5f39f29b6 100644 --- a/service/lexmodelsv2/api_client.go +++ b/service/lexmodelsv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e86b9b526ed 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexmodelsv2/generated.json b/service/lexmodelsv2/generated.json index 65dbf90d6a7..44c97652c08 100644 --- a/service/lexmodelsv2/generated.json +++ b/service/lexmodelsv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexmodelsv2/go.mod b/service/lexmodelsv2/go.mod index ddb8dee5f76..7bd5d969216 100644 --- a/service/lexmodelsv2/go.mod +++ b/service/lexmodelsv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexmodelsv2/internal/endpoints/endpoints.go b/service/lexmodelsv2/internal/endpoints/endpoints.go index 4d3739e44db..536f50ed004 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2c14ebeb66c 100644 --- a/service/lexruntimeservice/api_client.go +++ b/service/lexruntimeservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7698484e41f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexruntimeservice/generated.json b/service/lexruntimeservice/generated.json index 298b50456e2..343418b925e 100644 --- a/service/lexruntimeservice/generated.json +++ b/service/lexruntimeservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexruntimeservice/go.mod b/service/lexruntimeservice/go.mod index e88469a5ba8..2c8478a69ac 100644 --- a/service/lexruntimeservice/go.mod +++ b/service/lexruntimeservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexruntimeservice/internal/endpoints/endpoints.go b/service/lexruntimeservice/internal/endpoints/endpoints.go index 15a55ffffdf..f7c18ff5b58 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5849ccbb0ff 100644 --- a/service/lexruntimev2/api_client.go +++ b/service/lexruntimev2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..deeaec19f01 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lexruntimev2/generated.json b/service/lexruntimev2/generated.json index 74c19945835..b5866332450 100644 --- a/service/lexruntimev2/generated.json +++ b/service/lexruntimev2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lexruntimev2/go.mod b/service/lexruntimev2/go.mod index 0351400deb5..41ceebc7b6e 100644 --- a/service/lexruntimev2/go.mod +++ b/service/lexruntimev2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lexruntimev2/internal/endpoints/endpoints.go b/service/lexruntimev2/internal/endpoints/endpoints.go index b930e3dfdcf..0b0b79d46b9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..88c2259b008 100644 --- a/service/licensemanager/api_client.go +++ b/service/licensemanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6f5e749ea13 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/licensemanager/generated.json b/service/licensemanager/generated.json index 7dff800cb4f..c9bde428b64 100644 --- a/service/licensemanager/generated.json +++ b/service/licensemanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/licensemanager/go.mod b/service/licensemanager/go.mod index 8ad209d30ac..f43b27d484a 100644 --- a/service/licensemanager/go.mod +++ b/service/licensemanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/licensemanager/internal/endpoints/endpoints.go b/service/licensemanager/internal/endpoints/endpoints.go index 895b71d2009..262ba21bc39 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b8c2c4030f5 100644 --- a/service/lightsail/api_client.go +++ b/service/lightsail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5f9e4c38ae1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lightsail/generated.json b/service/lightsail/generated.json index 0c59627cbef..4a3267f2fb2 100644 --- a/service/lightsail/generated.json +++ b/service/lightsail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lightsail/go.mod b/service/lightsail/go.mod index 59eadde8aec..17a1985669e 100644 --- a/service/lightsail/go.mod +++ b/service/lightsail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lightsail/internal/endpoints/endpoints.go b/service/lightsail/internal/endpoints/endpoints.go index 010c5e44540..2deffc0eecf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1d55a88aa8f 100644 --- a/service/location/api_client.go +++ b/service/location/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..fd7be271ade 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/location/generated.json b/service/location/generated.json index b32b5495c13..0b2e397e379 100644 --- a/service/location/generated.json +++ b/service/location/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/location/go.mod b/service/location/go.mod index ac747d45d01..56e3d535b3f 100644 --- a/service/location/go.mod +++ b/service/location/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/location/internal/endpoints/endpoints.go b/service/location/internal/endpoints/endpoints.go index 81ac632797e..5553705ce85 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..cdfbf637405 100644 --- a/service/lookoutequipment/api_client.go +++ b/service/lookoutequipment/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f7e48b41f7d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutequipment/generated.json b/service/lookoutequipment/generated.json index 2a6b4245343..c1526a70dc8 100644 --- a/service/lookoutequipment/generated.json +++ b/service/lookoutequipment/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutequipment/go.mod b/service/lookoutequipment/go.mod index e735a7719d9..79dc805e8b9 100644 --- a/service/lookoutequipment/go.mod +++ b/service/lookoutequipment/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutequipment/internal/endpoints/endpoints.go b/service/lookoutequipment/internal/endpoints/endpoints.go index 6595ece909b..32d7ee25e28 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1b651f9ae20 100644 --- a/service/lookoutmetrics/api_client.go +++ b/service/lookoutmetrics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..616fbc9f8ff 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutmetrics/generated.json b/service/lookoutmetrics/generated.json index a89de82639d..980cff2a3f1 100644 --- a/service/lookoutmetrics/generated.json +++ b/service/lookoutmetrics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutmetrics/go.mod b/service/lookoutmetrics/go.mod index ea3184ee6a9..de8b50e41a1 100644 --- a/service/lookoutmetrics/go.mod +++ b/service/lookoutmetrics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutmetrics/internal/endpoints/endpoints.go b/service/lookoutmetrics/internal/endpoints/endpoints.go index 53fc0cbf118..619e094e3fd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..62afc2e1ca4 100644 --- a/service/lookoutvision/api_client.go +++ b/service/lookoutvision/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..acb6d79f297 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/lookoutvision/generated.json b/service/lookoutvision/generated.json index c4288f27725..285c3b4bf30 100644 --- a/service/lookoutvision/generated.json +++ b/service/lookoutvision/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/lookoutvision/go.mod b/service/lookoutvision/go.mod index d872abe7e63..f657dbb1186 100644 --- a/service/lookoutvision/go.mod +++ b/service/lookoutvision/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/lookoutvision/internal/endpoints/endpoints.go b/service/lookoutvision/internal/endpoints/endpoints.go index f3df5b518df..1a12769a8ec 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..24f73d4e10b 100644 --- a/service/machinelearning/api_client.go +++ b/service/machinelearning/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b00e8d81bc2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/machinelearning/generated.json b/service/machinelearning/generated.json index a22823af703..64abe043ac5 100644 --- a/service/machinelearning/generated.json +++ b/service/machinelearning/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/machinelearning/go.mod b/service/machinelearning/go.mod index f059818c131..59ed1c753ce 100644 --- a/service/machinelearning/go.mod +++ b/service/machinelearning/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/machinelearning/internal/endpoints/endpoints.go b/service/machinelearning/internal/endpoints/endpoints.go index 7dfc51e9d2d..35b555c40a4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..51b06838f52 100644 --- a/service/macie/api_client.go +++ b/service/macie/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..935b9e3d95c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/macie/generated.json b/service/macie/generated.json index ec36319474e..6570c47e3b6 100644 --- a/service/macie/generated.json +++ b/service/macie/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/macie/go.mod b/service/macie/go.mod index 404dff345da..2ad648f809c 100644 --- a/service/macie/go.mod +++ b/service/macie/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/macie/internal/endpoints/endpoints.go b/service/macie/internal/endpoints/endpoints.go index 89d8390f0b2..cfa63c46928 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6739e69c33f 100644 --- a/service/macie2/api_client.go +++ b/service/macie2/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..203ee2e67ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/macie2/generated.json b/service/macie2/generated.json index c88b52f8b83..8ddbc31c34c 100644 --- a/service/macie2/generated.json +++ b/service/macie2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/macie2/go.mod b/service/macie2/go.mod index dc7cd36ad88..42cdf1bf8b1 100644 --- a/service/macie2/go.mod +++ b/service/macie2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/macie2/internal/endpoints/endpoints.go b/service/macie2/internal/endpoints/endpoints.go index 553553e3edd..9dc8a539a6f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..94bf6c10d7c 100644 --- a/service/managedblockchain/api_client.go +++ b/service/managedblockchain/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..586c7ab69b8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/managedblockchain/generated.json b/service/managedblockchain/generated.json index 417e0bac934..8e08dc5f804 100644 --- a/service/managedblockchain/generated.json +++ b/service/managedblockchain/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/managedblockchain/go.mod b/service/managedblockchain/go.mod index 7ab4eafd6ae..e5d69ecb7ef 100644 --- a/service/managedblockchain/go.mod +++ b/service/managedblockchain/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/managedblockchain/internal/endpoints/endpoints.go b/service/managedblockchain/internal/endpoints/endpoints.go index 9216f883677..639522f5222 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..705036e7843 100644 --- a/service/marketplacecatalog/api_client.go +++ b/service/marketplacecatalog/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..14a366f6665 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacecatalog/generated.json b/service/marketplacecatalog/generated.json index a8d56693521..aac77d886c8 100644 --- a/service/marketplacecatalog/generated.json +++ b/service/marketplacecatalog/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacecatalog/go.mod b/service/marketplacecatalog/go.mod index ff0e68913e0..5342f6e92be 100644 --- a/service/marketplacecatalog/go.mod +++ b/service/marketplacecatalog/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacecatalog/internal/endpoints/endpoints.go b/service/marketplacecatalog/internal/endpoints/endpoints.go index 8d51a4eaee9..230c0701681 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b20b6f50b0a 100644 --- a/service/marketplacecommerceanalytics/api_client.go +++ b/service/marketplacecommerceanalytics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ab28b1ea18c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacecommerceanalytics/generated.json b/service/marketplacecommerceanalytics/generated.json index b0945e72809..3fb534e20b9 100644 --- a/service/marketplacecommerceanalytics/generated.json +++ b/service/marketplacecommerceanalytics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacecommerceanalytics/go.mod b/service/marketplacecommerceanalytics/go.mod index 27e0a827c86..64e4b0cd3ec 100644 --- a/service/marketplacecommerceanalytics/go.mod +++ b/service/marketplacecommerceanalytics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go b/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go index 8fffb4814dd..da1e09b7748 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7b7612793e8 100644 --- a/service/marketplaceentitlementservice/api_client.go +++ b/service/marketplaceentitlementservice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..062b9c36cdb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplaceentitlementservice/generated.json b/service/marketplaceentitlementservice/generated.json index 15028f5089d..7edcd9d4e0d 100644 --- a/service/marketplaceentitlementservice/generated.json +++ b/service/marketplaceentitlementservice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplaceentitlementservice/go.mod b/service/marketplaceentitlementservice/go.mod index ac6b0650b25..c272cc5d8de 100644 --- a/service/marketplaceentitlementservice/go.mod +++ b/service/marketplaceentitlementservice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplaceentitlementservice/internal/endpoints/endpoints.go b/service/marketplaceentitlementservice/internal/endpoints/endpoints.go index 007da1b6d0d..e41d408aa7c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..980fc95efea 100644 --- a/service/marketplacemetering/api_client.go +++ b/service/marketplacemetering/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b62d842a9ee 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/marketplacemetering/generated.json b/service/marketplacemetering/generated.json index 565573a4f91..6eac8ea9727 100644 --- a/service/marketplacemetering/generated.json +++ b/service/marketplacemetering/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/marketplacemetering/go.mod b/service/marketplacemetering/go.mod index 41622b20035..06a30cfd79d 100644 --- a/service/marketplacemetering/go.mod +++ b/service/marketplacemetering/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/marketplacemetering/internal/endpoints/endpoints.go b/service/marketplacemetering/internal/endpoints/endpoints.go index 5df4103fe5b..ad27f064323 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b3a78ce68e1 100644 --- a/service/mediaconnect/api_client.go +++ b/service/mediaconnect/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..29400b6a5a3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediaconnect/generated.json b/service/mediaconnect/generated.json index 90ad1b7bcb0..c1b4677db1d 100644 --- a/service/mediaconnect/generated.json +++ b/service/mediaconnect/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/mediaconnect/go.mod b/service/mediaconnect/go.mod index a17695ae19d..4c34f4d08f2 100644 --- a/service/mediaconnect/go.mod +++ b/service/mediaconnect/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediaconnect/internal/endpoints/endpoints.go b/service/mediaconnect/internal/endpoints/endpoints.go index 296ecb97daa..7bacf25a504 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d477d2b2631 100644 --- a/service/mediaconvert/api_client.go +++ b/service/mediaconvert/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..0ecc6a68419 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediaconvert/generated.json b/service/mediaconvert/generated.json index f1494109352..6265cf4ffd4 100644 --- a/service/mediaconvert/generated.json +++ b/service/mediaconvert/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediaconvert/go.mod b/service/mediaconvert/go.mod index 5533354e220..4c39da5f607 100644 --- a/service/mediaconvert/go.mod +++ b/service/mediaconvert/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediaconvert/internal/endpoints/endpoints.go b/service/mediaconvert/internal/endpoints/endpoints.go index 18e7a53eb87..ea61c156e46 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..585061d2a9f 100644 --- a/service/medialive/api_client.go +++ b/service/medialive/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..75c93d7b43a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/medialive/generated.json b/service/medialive/generated.json index 93a735dfe01..3acc21a0b06 100644 --- a/service/medialive/generated.json +++ b/service/medialive/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/medialive/go.mod b/service/medialive/go.mod index b510dedbab1..ab35a7d2cd4 100644 --- a/service/medialive/go.mod +++ b/service/medialive/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/medialive/internal/endpoints/endpoints.go b/service/medialive/internal/endpoints/endpoints.go index a0ac5f8dd3d..0815f33af82 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..33d1ee9299b 100644 --- a/service/mediapackage/api_client.go +++ b/service/mediapackage/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..222f2637371 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediapackage/generated.json b/service/mediapackage/generated.json index 5c27ee70ede..37c504844af 100644 --- a/service/mediapackage/generated.json +++ b/service/mediapackage/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediapackage/go.mod b/service/mediapackage/go.mod index 995e82c0cd9..619537a877b 100644 --- a/service/mediapackage/go.mod +++ b/service/mediapackage/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediapackage/internal/endpoints/endpoints.go b/service/mediapackage/internal/endpoints/endpoints.go index ca323280777..3704cdd2084 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e5b7fd5a1f9 100644 --- a/service/mediapackagevod/api_client.go +++ b/service/mediapackagevod/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..de1a4bf1189 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediapackagevod/generated.json b/service/mediapackagevod/generated.json index 442b95d2117..c065078455d 100644 --- a/service/mediapackagevod/generated.json +++ b/service/mediapackagevod/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediapackagevod/go.mod b/service/mediapackagevod/go.mod index dabd3f4d91b..5fd58b27e9d 100644 --- a/service/mediapackagevod/go.mod +++ b/service/mediapackagevod/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediapackagevod/internal/endpoints/endpoints.go b/service/mediapackagevod/internal/endpoints/endpoints.go index fb116621932..e67a212e956 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b10e80dae9f 100644 --- a/service/mediastore/api_client.go +++ b/service/mediastore/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..cd18249a901 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediastore/generated.json b/service/mediastore/generated.json index 618df3401fb..4c31deca49a 100644 --- a/service/mediastore/generated.json +++ b/service/mediastore/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediastore/go.mod b/service/mediastore/go.mod index b7d69729bde..f532a375139 100644 --- a/service/mediastore/go.mod +++ b/service/mediastore/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediastore/internal/endpoints/endpoints.go b/service/mediastore/internal/endpoints/endpoints.go index f4fb203ee37..7b1776d1c4c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6eac86e33b2 100644 --- a/service/mediastoredata/api_client.go +++ b/service/mediastoredata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..4183228622e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediastoredata/generated.json b/service/mediastoredata/generated.json index f5e9af55316..da20ac64c4c 100644 --- a/service/mediastoredata/generated.json +++ b/service/mediastoredata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediastoredata/go.mod b/service/mediastoredata/go.mod index 616caaf35ea..b2f1b762e04 100644 --- a/service/mediastoredata/go.mod +++ b/service/mediastoredata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediastoredata/internal/endpoints/endpoints.go b/service/mediastoredata/internal/endpoints/endpoints.go index 83b5502f3bf..1e8d424af91 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9db5889d906 100644 --- a/service/mediatailor/api_client.go +++ b/service/mediatailor/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6e7dcdd22d8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mediatailor/generated.json b/service/mediatailor/generated.json index 27dc0fdce1e..651d32fb441 100644 --- a/service/mediatailor/generated.json +++ b/service/mediatailor/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mediatailor/go.mod b/service/mediatailor/go.mod index d3d8d9e2524..c5968fcd659 100644 --- a/service/mediatailor/go.mod +++ b/service/mediatailor/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mediatailor/internal/endpoints/endpoints.go b/service/mediatailor/internal/endpoints/endpoints.go index e6c6fe689b1..1ecd11e3cf4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f8b7dfb324b 100644 --- a/service/mgn/api_client.go +++ b/service/mgn/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b03b9297396 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mgn/generated.json b/service/mgn/generated.json index aad2ee7f800..0bc3fd249f2 100644 --- a/service/mgn/generated.json +++ b/service/mgn/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mgn/go.mod b/service/mgn/go.mod index 7f9813cc410..4d12e6bde3e 100644 --- a/service/mgn/go.mod +++ b/service/mgn/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mgn/internal/endpoints/endpoints.go b/service/mgn/internal/endpoints/endpoints.go index bc32865c8f0..22056e28a1c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b0b69bd90d6 100644 --- a/service/migrationhub/api_client.go +++ b/service/migrationhub/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f6084aebc82 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/migrationhub/generated.json b/service/migrationhub/generated.json index a33ec8648a4..21bb1ef4ae6 100644 --- a/service/migrationhub/generated.json +++ b/service/migrationhub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/migrationhub/go.mod b/service/migrationhub/go.mod index e63066ef9fa..a7fe15dfd73 100644 --- a/service/migrationhub/go.mod +++ b/service/migrationhub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/migrationhub/internal/endpoints/endpoints.go b/service/migrationhub/internal/endpoints/endpoints.go index d2534d4783f..a90cd8ab307 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..04cb6242691 100644 --- a/service/migrationhubconfig/api_client.go +++ b/service/migrationhubconfig/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..14bd66624ad 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/migrationhubconfig/generated.json b/service/migrationhubconfig/generated.json index 59af0235b68..910d7834ba8 100644 --- a/service/migrationhubconfig/generated.json +++ b/service/migrationhubconfig/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/migrationhubconfig/go.mod b/service/migrationhubconfig/go.mod index 2ead4bdcc0d..815368f58ea 100644 --- a/service/migrationhubconfig/go.mod +++ b/service/migrationhubconfig/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/migrationhubconfig/internal/endpoints/endpoints.go b/service/migrationhubconfig/internal/endpoints/endpoints.go index 9bcc85bf5bb..de6f625f5e9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7067334372a 100644 --- a/service/mobile/api_client.go +++ b/service/mobile/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..0440d451e3b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mobile/generated.json b/service/mobile/generated.json index f6de86f03f1..9a47f92d0c3 100644 --- a/service/mobile/generated.json +++ b/service/mobile/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mobile/go.mod b/service/mobile/go.mod index 8ff2ab12305..02487d0ed5e 100644 --- a/service/mobile/go.mod +++ b/service/mobile/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mobile/internal/endpoints/endpoints.go b/service/mobile/internal/endpoints/endpoints.go index 5fbf4b81c0a..49f539b81e1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c3ea35ff48c 100644 --- a/service/mq/api_client.go +++ b/service/mq/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ff4c851313a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mq/generated.json b/service/mq/generated.json index e795b918034..2f7837e4e6c 100644 --- a/service/mq/generated.json +++ b/service/mq/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mq/go.mod b/service/mq/go.mod index ce2a6b3d699..3da12351f33 100644 --- a/service/mq/go.mod +++ b/service/mq/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mq/internal/endpoints/endpoints.go b/service/mq/internal/endpoints/endpoints.go index a1e0f7df4d7..2b7c37f2ea2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..86a55cef583 100644 --- a/service/mturk/api_client.go +++ b/service/mturk/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..872b5fb0764 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mturk/generated.json b/service/mturk/generated.json index d23e3faaaa3..c64556f0728 100644 --- a/service/mturk/generated.json +++ b/service/mturk/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mturk/go.mod b/service/mturk/go.mod index 2e48748b773..07bcb2393f6 100644 --- a/service/mturk/go.mod +++ b/service/mturk/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mturk/internal/endpoints/endpoints.go b/service/mturk/internal/endpoints/endpoints.go index 4b84852bbac..b4e101fef58 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a4d6662ca6a 100644 --- a/service/mwaa/api_client.go +++ b/service/mwaa/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5db5b2a416c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/mwaa/generated.json b/service/mwaa/generated.json index e5dde20fa31..d97f6e8f5ab 100644 --- a/service/mwaa/generated.json +++ b/service/mwaa/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/mwaa/go.mod b/service/mwaa/go.mod index f127a79f63c..8e9c7d69ab3 100644 --- a/service/mwaa/go.mod +++ b/service/mwaa/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/mwaa/internal/endpoints/endpoints.go b/service/mwaa/internal/endpoints/endpoints.go index efa4b598a31..5741c3e895f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..87fba862b8c 100644 --- a/service/neptune/api_client.go +++ b/service/neptune/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6087da411aa 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/neptune/generated.json b/service/neptune/generated.json index 06aa894495e..63808f79be3 100644 --- a/service/neptune/generated.json +++ b/service/neptune/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/neptune/go.mod b/service/neptune/go.mod index 1b402c7f482..f508563cf46 100644 --- a/service/neptune/go.mod +++ b/service/neptune/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/neptune/internal/endpoints/endpoints.go b/service/neptune/internal/endpoints/endpoints.go index 251990fe9c6..0a3e0cc0da6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..36a5a18e799 100644 --- a/service/networkfirewall/api_client.go +++ b/service/networkfirewall/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5df121d9520 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/networkfirewall/generated.json b/service/networkfirewall/generated.json index 1f0588e82a9..d98e74f6047 100644 --- a/service/networkfirewall/generated.json +++ b/service/networkfirewall/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/networkfirewall/go.mod b/service/networkfirewall/go.mod index 1bef4e591ff..ebf7cca579b 100644 --- a/service/networkfirewall/go.mod +++ b/service/networkfirewall/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/networkfirewall/internal/endpoints/endpoints.go b/service/networkfirewall/internal/endpoints/endpoints.go index 035752752f9..ecb5c8a47d5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..bfb01cd798c 100644 --- a/service/networkmanager/api_client.go +++ b/service/networkmanager/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f3331d7dd7e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/networkmanager/generated.json b/service/networkmanager/generated.json index dc387c1c24f..71ebccdcf5f 100644 --- a/service/networkmanager/generated.json +++ b/service/networkmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/networkmanager/go.mod b/service/networkmanager/go.mod index d9fae654e08..30b80c053e0 100644 --- a/service/networkmanager/go.mod +++ b/service/networkmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/networkmanager/internal/endpoints/endpoints.go b/service/networkmanager/internal/endpoints/endpoints.go index 8adc41a8e6e..f11849f8309 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2c0ec01b62b 100644 --- a/service/nimble/api_client.go +++ b/service/nimble/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e3873d19707 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/nimble/generated.json b/service/nimble/generated.json index aa92859ca8d..c050f461176 100644 --- a/service/nimble/generated.json +++ b/service/nimble/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/nimble/go.mod b/service/nimble/go.mod index c95307f0ddc..257bcacfe0c 100644 --- a/service/nimble/go.mod +++ b/service/nimble/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/nimble/internal/endpoints/endpoints.go b/service/nimble/internal/endpoints/endpoints.go index 5dc378146ae..564877cb24e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..3787fed67f9 100644 --- a/service/opsworks/api_client.go +++ b/service/opsworks/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9d5e314d4a9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/opsworks/generated.json b/service/opsworks/generated.json index 10792b619ff..e0eef6121d4 100644 --- a/service/opsworks/generated.json +++ b/service/opsworks/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/opsworks/go.mod b/service/opsworks/go.mod index 37892a9fe42..455bbeb7357 100644 --- a/service/opsworks/go.mod +++ b/service/opsworks/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/opsworks/internal/endpoints/endpoints.go b/service/opsworks/internal/endpoints/endpoints.go index e691e2787c6..4d8c8f710ff 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1d97716f5a9 100644 --- a/service/opsworkscm/api_client.go +++ b/service/opsworkscm/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..13fdfee5a03 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/opsworkscm/generated.json b/service/opsworkscm/generated.json index bb85c88fc95..d7ac7d06946 100644 --- a/service/opsworkscm/generated.json +++ b/service/opsworkscm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/opsworkscm/go.mod b/service/opsworkscm/go.mod index 1416191f00d..c9ba586c04f 100644 --- a/service/opsworkscm/go.mod +++ b/service/opsworkscm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/opsworkscm/internal/endpoints/endpoints.go b/service/opsworkscm/internal/endpoints/endpoints.go index 1b4a51b68db..c883f5221d6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b66749c7999 100644 --- a/service/organizations/api_client.go +++ b/service/organizations/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..97cc6b6ae90 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/organizations/generated.json b/service/organizations/generated.json index 96a9fb47154..f891ac7b051 100644 --- a/service/organizations/generated.json +++ b/service/organizations/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/organizations/go.mod b/service/organizations/go.mod index b982e8019ee..244ba78505c 100644 --- a/service/organizations/go.mod +++ b/service/organizations/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/organizations/internal/endpoints/endpoints.go b/service/organizations/internal/endpoints/endpoints.go index 67d95f95858..36b85f363d2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..49da2a85379 100644 --- a/service/outposts/api_client.go +++ b/service/outposts/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f9900f006f7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/outposts/generated.json b/service/outposts/generated.json index 67234c62956..11a7d474f65 100644 --- a/service/outposts/generated.json +++ b/service/outposts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/outposts/go.mod b/service/outposts/go.mod index 952c75ecec9..f51ae9f0c7e 100644 --- a/service/outposts/go.mod +++ b/service/outposts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/outposts/internal/endpoints/endpoints.go b/service/outposts/internal/endpoints/endpoints.go index ad2b8ea5753..d3d23e7a10d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..55820318843 100644 --- a/service/personalize/api_client.go +++ b/service/personalize/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f80c8d92282 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalize/generated.json b/service/personalize/generated.json index c4b7c898221..d7ab014307f 100644 --- a/service/personalize/generated.json +++ b/service/personalize/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalize/go.mod b/service/personalize/go.mod index 769c6b3a446..a819a21f909 100644 --- a/service/personalize/go.mod +++ b/service/personalize/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalize/internal/endpoints/endpoints.go b/service/personalize/internal/endpoints/endpoints.go index f30f1b6b6fc..7b1c2c1cee9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7e937281894 100644 --- a/service/personalizeevents/api_client.go +++ b/service/personalizeevents/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9fa502a1917 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalizeevents/generated.json b/service/personalizeevents/generated.json index dfc17aaf2fb..1a9d80bbeef 100644 --- a/service/personalizeevents/generated.json +++ b/service/personalizeevents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalizeevents/go.mod b/service/personalizeevents/go.mod index 4d8982c7fe0..4f5329875a6 100644 --- a/service/personalizeevents/go.mod +++ b/service/personalizeevents/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalizeevents/internal/endpoints/endpoints.go b/service/personalizeevents/internal/endpoints/endpoints.go index 08b014f3c73..8d91d16a490 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..fc029a6ab63 100644 --- a/service/personalizeruntime/api_client.go +++ b/service/personalizeruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6601cadff9f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/personalizeruntime/generated.json b/service/personalizeruntime/generated.json index 7e813ddf821..7622bfcfc7a 100644 --- a/service/personalizeruntime/generated.json +++ b/service/personalizeruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/personalizeruntime/go.mod b/service/personalizeruntime/go.mod index 0eb9cfcd5af..f5c69634877 100644 --- a/service/personalizeruntime/go.mod +++ b/service/personalizeruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/personalizeruntime/internal/endpoints/endpoints.go b/service/personalizeruntime/internal/endpoints/endpoints.go index 9dac71df149..d1f0c497e7b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f1db7245a05 100644 --- a/service/pi/api_client.go +++ b/service/pi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9ede43ee4af 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pi/generated.json b/service/pi/generated.json index 7b7ad72e373..fa34d3c97f5 100644 --- a/service/pi/generated.json +++ b/service/pi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pi/go.mod b/service/pi/go.mod index 39654e7c9a1..9cd51db930d 100644 --- a/service/pi/go.mod +++ b/service/pi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pi/internal/endpoints/endpoints.go b/service/pi/internal/endpoints/endpoints.go index a593cee0e50..635e6e3cbbb 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e823f050d0d 100644 --- a/service/pinpoint/api_client.go +++ b/service/pinpoint/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..0a7969b2980 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpoint/generated.json b/service/pinpoint/generated.json index 63e2a0c3893..b2162904b3a 100644 --- a/service/pinpoint/generated.json +++ b/service/pinpoint/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpoint/go.mod b/service/pinpoint/go.mod index 75d9fa0ce65..46e28510702 100644 --- a/service/pinpoint/go.mod +++ b/service/pinpoint/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpoint/internal/endpoints/endpoints.go b/service/pinpoint/internal/endpoints/endpoints.go index 5cd8578160a..96b9ce46de2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0c2f6cadbb5 100644 --- a/service/pinpointemail/api_client.go +++ b/service/pinpointemail/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5c3e1852a3d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpointemail/generated.json b/service/pinpointemail/generated.json index 4eebf5dbcbe..987925652e0 100644 --- a/service/pinpointemail/generated.json +++ b/service/pinpointemail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpointemail/go.mod b/service/pinpointemail/go.mod index c69c286ad88..5b1f1604c61 100644 --- a/service/pinpointemail/go.mod +++ b/service/pinpointemail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpointemail/internal/endpoints/endpoints.go b/service/pinpointemail/internal/endpoints/endpoints.go index 0d847ce864a..3d54af57d86 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..a8e7959c35e 100644 --- a/service/pinpointsmsvoice/api_client.go +++ b/service/pinpointsmsvoice/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..021e162e5d2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pinpointsmsvoice/generated.json b/service/pinpointsmsvoice/generated.json index 999aebfb56f..0825fed4fec 100644 --- a/service/pinpointsmsvoice/generated.json +++ b/service/pinpointsmsvoice/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pinpointsmsvoice/go.mod b/service/pinpointsmsvoice/go.mod index c2b179796a2..7187a58309f 100644 --- a/service/pinpointsmsvoice/go.mod +++ b/service/pinpointsmsvoice/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pinpointsmsvoice/internal/endpoints/endpoints.go b/service/pinpointsmsvoice/internal/endpoints/endpoints.go index 7307e5e7361..d8ab8ee6b1a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b93d32fb09a 100644 --- a/service/polly/api_client.go +++ b/service/polly/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..609b35fa304 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/polly/generated.json b/service/polly/generated.json index 2c365e27eae..de162804099 100644 --- a/service/polly/generated.json +++ b/service/polly/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/polly/go.mod b/service/polly/go.mod index 65de6f6439e..54a77aa0dd3 100644 --- a/service/polly/go.mod +++ b/service/polly/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/polly/internal/endpoints/endpoints.go b/service/polly/internal/endpoints/endpoints.go index 59605f2e7bb..e8f3c3b60bf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7885da32799 100644 --- a/service/pricing/api_client.go +++ b/service/pricing/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6dad05cb607 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/pricing/generated.json b/service/pricing/generated.json index b96c43dcf8c..9ddd88f0a16 100644 --- a/service/pricing/generated.json +++ b/service/pricing/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/pricing/go.mod b/service/pricing/go.mod index 2482b137b3b..4fbaa9f1095 100644 --- a/service/pricing/go.mod +++ b/service/pricing/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/pricing/internal/endpoints/endpoints.go b/service/pricing/internal/endpoints/endpoints.go index 67a5c42f18c..74b65cc1c45 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7f9a5a58946 100644 --- a/service/qldb/api_client.go +++ b/service/qldb/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a8b53650035 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/qldb/generated.json b/service/qldb/generated.json index 675796f08bd..428eae56d9e 100644 --- a/service/qldb/generated.json +++ b/service/qldb/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/qldb/go.mod b/service/qldb/go.mod index 6cedd84da08..39804eaae63 100644 --- a/service/qldb/go.mod +++ b/service/qldb/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/qldb/internal/endpoints/endpoints.go b/service/qldb/internal/endpoints/endpoints.go index cb8b0626515..3d12bbe5293 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..45f17af41c8 100644 --- a/service/qldbsession/api_client.go +++ b/service/qldbsession/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..959a95276d5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/qldbsession/generated.json b/service/qldbsession/generated.json index 83622da29d2..dc61430abf4 100644 --- a/service/qldbsession/generated.json +++ b/service/qldbsession/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/qldbsession/go.mod b/service/qldbsession/go.mod index 1d9edbaf392..23b3a721a7d 100644 --- a/service/qldbsession/go.mod +++ b/service/qldbsession/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/qldbsession/internal/endpoints/endpoints.go b/service/qldbsession/internal/endpoints/endpoints.go index 2bcc0e17553..125b4f2f8d8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4747692b5d7 100644 --- a/service/quicksight/api_client.go +++ b/service/quicksight/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..ff54d801786 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/quicksight/generated.json b/service/quicksight/generated.json index 336a2afc874..2c848e06911 100644 --- a/service/quicksight/generated.json +++ b/service/quicksight/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/quicksight/go.mod b/service/quicksight/go.mod index b0ebea3c9be..c462c132c38 100644 --- a/service/quicksight/go.mod +++ b/service/quicksight/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/quicksight/internal/endpoints/endpoints.go b/service/quicksight/internal/endpoints/endpoints.go index 3f60648b2e3..89334c75460 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c9820d098db 100644 --- a/service/ram/api_client.go +++ b/service/ram/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2b50bc2c2a6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ram/generated.json b/service/ram/generated.json index ac26d462937..8497c95e1e7 100644 --- a/service/ram/generated.json +++ b/service/ram/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ram/go.mod b/service/ram/go.mod index 024072c644a..b47b72a3d4b 100644 --- a/service/ram/go.mod +++ b/service/ram/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ram/internal/endpoints/endpoints.go b/service/ram/internal/endpoints/endpoints.go index 4361ab1c790..2d4ee1af99b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..5cddb0bb193 100644 --- a/service/rds/api_client.go +++ b/service/rds/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d7dbe38c8c1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rds/generated.json b/service/rds/generated.json index 7a7f170a2f7..f1f935c7cd0 100644 --- a/service/rds/generated.json +++ b/service/rds/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" diff --git a/service/rds/go.mod b/service/rds/go.mod index 71ba1264bb8..02d1c35f1ed 100644 --- a/service/rds/go.mod +++ b/service/rds/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 @@ -11,4 +12,6 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/rds/internal/endpoints/endpoints.go b/service/rds/internal/endpoints/endpoints.go index 25be3541905..50b42049145 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6cb5d60b704 100644 --- a/service/rdsdata/api_client.go +++ b/service/rdsdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..952a8f13c16 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rdsdata/generated.json b/service/rdsdata/generated.json index b4965a6fcc0..1a414285d42 100644 --- a/service/rdsdata/generated.json +++ b/service/rdsdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/rdsdata/go.mod b/service/rdsdata/go.mod index ccd7cd58045..e8a8cd999c5 100644 --- a/service/rdsdata/go.mod +++ b/service/rdsdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/rdsdata/internal/endpoints/endpoints.go b/service/rdsdata/internal/endpoints/endpoints.go index a0b7798e066..62bde0ced82 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1ebcca80c86 100644 --- a/service/redshift/api_client.go +++ b/service/redshift/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..98284f640d7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/redshift/generated.json b/service/redshift/generated.json index eb34b4c3aa7..a70270bef08 100644 --- a/service/redshift/generated.json +++ b/service/redshift/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/redshift/go.mod b/service/redshift/go.mod index 4f0973bf7b8..1014c5adc09 100644 --- a/service/redshift/go.mod +++ b/service/redshift/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/redshift/internal/endpoints/endpoints.go b/service/redshift/internal/endpoints/endpoints.go index f719d24d4bd..d0a3e336144 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..dcf9f0a0f1e 100644 --- a/service/redshiftdata/api_client.go +++ b/service/redshiftdata/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7983dc85538 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/redshiftdata/generated.json b/service/redshiftdata/generated.json index 2adee145738..9d516f6ff2a 100644 --- a/service/redshiftdata/generated.json +++ b/service/redshiftdata/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/redshiftdata/go.mod b/service/redshiftdata/go.mod index ce2fbcf35f8..47bc438bf73 100644 --- a/service/redshiftdata/go.mod +++ b/service/redshiftdata/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/redshiftdata/internal/endpoints/endpoints.go b/service/redshiftdata/internal/endpoints/endpoints.go index 17c3d010231..f5ae6bf8b9f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..864fe3e0639 100644 --- a/service/rekognition/api_client.go +++ b/service/rekognition/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d1ba99dbfc8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/rekognition/generated.json b/service/rekognition/generated.json index 0e08c71ed95..7d2cd4fe321 100644 --- a/service/rekognition/generated.json +++ b/service/rekognition/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/rekognition/go.mod b/service/rekognition/go.mod index ea31c73008e..d83462c7b45 100644 --- a/service/rekognition/go.mod +++ b/service/rekognition/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/rekognition/internal/endpoints/endpoints.go b/service/rekognition/internal/endpoints/endpoints.go index 6eb3373675c..626ecf3eb05 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..99cd9288223 100644 --- a/service/resourcegroups/api_client.go +++ b/service/resourcegroups/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..212fc741be2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/resourcegroups/generated.json b/service/resourcegroups/generated.json index f87981ec651..6ca1b44d514 100644 --- a/service/resourcegroups/generated.json +++ b/service/resourcegroups/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/resourcegroups/go.mod b/service/resourcegroups/go.mod index 2fe2f732103..5428c025a59 100644 --- a/service/resourcegroups/go.mod +++ b/service/resourcegroups/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/resourcegroups/internal/endpoints/endpoints.go b/service/resourcegroups/internal/endpoints/endpoints.go index 00b99bab288..77595bd8589 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..cd274b87a96 100644 --- a/service/resourcegroupstaggingapi/api_client.go +++ b/service/resourcegroupstaggingapi/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..57d53987699 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/resourcegroupstaggingapi/generated.json b/service/resourcegroupstaggingapi/generated.json index 8767a920882..ec2046d92b1 100644 --- a/service/resourcegroupstaggingapi/generated.json +++ b/service/resourcegroupstaggingapi/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/resourcegroupstaggingapi/go.mod b/service/resourcegroupstaggingapi/go.mod index ac66332e458..f717b0f1905 100644 --- a/service/resourcegroupstaggingapi/go.mod +++ b/service/resourcegroupstaggingapi/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go b/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go index d3b341eb036..3d562de8fb9 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0c09b11d792 100644 --- a/service/robomaker/api_client.go +++ b/service/robomaker/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6e1e59d43f1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/robomaker/generated.json b/service/robomaker/generated.json index 8878f132153..096e24fc042 100644 --- a/service/robomaker/generated.json +++ b/service/robomaker/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/robomaker/go.mod b/service/robomaker/go.mod index f17673744d0..9c44f2dc9c6 100644 --- a/service/robomaker/go.mod +++ b/service/robomaker/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/robomaker/internal/endpoints/endpoints.go b/service/robomaker/internal/endpoints/endpoints.go index 75994981c0e..a3de22bf66f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..34651e54535 100644 --- a/service/route53/api_client.go +++ b/service/route53/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" route53cust "github.com/aws/aws-sdk-go-v2/service/route53/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -172,6 +173,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -242,6 +244,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2a3ad99b89c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53/generated.json b/service/route53/generated.json index 8defb0fffcc..0f6266e8349 100644 --- a/service/route53/generated.json +++ b/service/route53/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/route53/go.mod b/service/route53/go.mod index 5e7a741b3f6..d20d2b96dfb 100644 --- a/service/route53/go.mod +++ b/service/route53/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53/internal/endpoints/endpoints.go b/service/route53/internal/endpoints/endpoints.go index 9c82fc9a158..373ae82170f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..261c19a2e9e 100644 --- a/service/route53domains/api_client.go +++ b/service/route53domains/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9c63f7f946e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53domains/generated.json b/service/route53domains/generated.json index fbe805ab88d..f8113335ee1 100644 --- a/service/route53domains/generated.json +++ b/service/route53domains/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/route53domains/go.mod b/service/route53domains/go.mod index 4e03f53ed58..8db32d9467a 100644 --- a/service/route53domains/go.mod +++ b/service/route53domains/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53domains/internal/endpoints/endpoints.go b/service/route53domains/internal/endpoints/endpoints.go index 3b1cf0a397e..79fcbd979b0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..966d92cc097 100644 --- a/service/route53resolver/api_client.go +++ b/service/route53resolver/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7b39a437e5e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/route53resolver/generated.json b/service/route53resolver/generated.json index 4504eb3f364..21f92b9630f 100644 --- a/service/route53resolver/generated.json +++ b/service/route53resolver/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/route53resolver/go.mod b/service/route53resolver/go.mod index f6338f47611..54a046ae76c 100644 --- a/service/route53resolver/go.mod +++ b/service/route53resolver/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/route53resolver/internal/endpoints/endpoints.go b/service/route53resolver/internal/endpoints/endpoints.go index 5cdd3730197..d7e4aa6e6db 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c365f276ed4 100644 --- a/service/s3/api_client.go +++ b/service/s3/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" acceptencodingcust "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" @@ -101,7 +102,11 @@ 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 +201,8 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) - resolveClientConfig(cfg, &opts) + resolveUseARNRegion(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -268,8 +274,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 +289,26 @@ func resolveClientConfig(cfg aws.Config, o *Options) error { return nil } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualstack = true + } else { + o.UseDualstack = false + } + + } + return nil +} + func addMetadataRetrieverMiddleware(stack *middleware.Stack) error { return s3shared.AddMetadataRetrieverMiddleware(stack) } diff --git a/service/s3/endpoints.go b/service/s3/endpoints.go index 4652db06f87..be6af33e2d3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // 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.DualStackEndpoint == DualStackEndpointUnset { + if o.UseDualstack { + endpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + endpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3/generated.json b/service/s3/generated.json index d070516de88..b2902acf8e5 100644 --- a/service/s3/generated.json +++ b/service/s3/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding": "v1.0.5", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/aws-sdk-go-v2/service/internal/s3shared": "v1.2.3", diff --git a/service/s3/go.mod b/service/s3/go.mod index fed48d6e109..497bd609a55 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.3.1 @@ -13,6 +14,8 @@ require ( replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../service/internal/accept-encoding/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/s3/internal/configtesting/go.mod b/service/s3/internal/configtesting/go.mod index 0a5f936ca64..592cb94fd47 100644 --- a/service/s3/internal/configtesting/go.mod +++ b/service/s3/internal/configtesting/go.mod @@ -15,6 +15,8 @@ replace github.com/aws/aws-sdk-go-v2/credentials => ../../../../credentials/ replace github.com/aws/aws-sdk-go-v2/feature/ec2/imds => ../../../../feature/ec2/imds/ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/internal/ini => ../../../../internal/ini/ replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../../../service/internal/presigned-url/ diff --git a/service/s3/internal/endpoints/endpoints.go b/service/s3/internal/endpoints/endpoints.go index 3acda91a3b7..b6bb8de4c67 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -62,6 +84,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -101,318 +128,320 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-af-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", + "accesspoint-eu-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", + "accesspoint-eu-north-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", + "accesspoint-eu-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + "accesspoint-eu-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + "accesspoint-eu-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + "accesspoint-eu-west-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + "accesspoint-me-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + "accesspoint-sa-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", + "accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", + "accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", + "accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", + "accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "aws-global": endpoints.Endpoint{ + Hostname: "s3.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "fips-accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", + "fips-accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", + "fips-accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", + "fips-accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", + "fips-accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", + "me-south-1": endpoints.Endpoint{}, + "s3-external-1": endpoints.Endpoint{ + Hostname: "s3-external-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-1": endpoints.Endpoint{ + Hostname: "s3.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-2": endpoints.Endpoint{}, + "us-west-1": endpoints.Endpoint{ + Hostname: "s3.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-west-2": endpoints.Endpoint{ + Hostname: "s3.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-af-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", + "accesspoint-ap-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", + "accesspoint-ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", + "accesspoint-ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.me-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "af-south-1": endpoints.Endpoint{}, - "af-south-1-dualstack": endpoints.Endpoint{ + "af-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-east-1": endpoints.Endpoint{}, - "ap-east-1-dualstack": endpoints.Endpoint{ + "ap-east-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-2-dualstack": endpoints.Endpoint{ + "ap-northeast-2": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-3": endpoints.Endpoint{}, - "ap-northeast-3-dualstack": endpoints.Endpoint{ + "ap-northeast-3": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-south-1": endpoints.Endpoint{}, - "ap-south-1-dualstack": endpoints.Endpoint{ + "ap-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "aws-global": endpoints.Endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoints.Endpoint{}, - "ca-central-1-dualstack": endpoints.Endpoint{ + "ca-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-central-1": endpoints.Endpoint{}, - "eu-central-1-dualstack": endpoints.Endpoint{ + "eu-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-north-1": endpoints.Endpoint{}, - "eu-north-1-dualstack": endpoints.Endpoint{ + "eu-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-south-1": endpoints.Endpoint{}, - "eu-south-1-dualstack": endpoints.Endpoint{ + "eu-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "eu-west-1": endpoints.Endpoint{ - Hostname: "s3.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-2-dualstack": endpoints.Endpoint{ + "eu-west-2": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-3": endpoints.Endpoint{}, - "eu-west-3-dualstack": endpoints.Endpoint{ + "eu-west-3": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "fips-accesspoint-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "me-south-1": endpoints.Endpoint{}, - "me-south-1-dualstack": endpoints.Endpoint{ + "me-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "s3-external-1": endpoints.Endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, "sa-east-1": endpoints.Endpoint{ - Hostname: "s3.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "sa-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-east-1": endpoints.Endpoint{ - Hostname: "s3.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "us-east-2": endpoints.Endpoint{}, - "us-east-2-dualstack": endpoints.Endpoint{ + "us-east-2": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-1": endpoints.Endpoint{ - Hostname: "s3.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-2": endpoints.Endpoint{ - Hostname: "s3.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, @@ -425,6 +454,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -436,20 +470,22 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-north-1": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-cn-north-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-northwest-1": endpoints.Endpoint{ + "accesspoint-cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "cn-north-1": endpoints.Endpoint{}, - "cn-north-1-dualstack": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn", }, - "cn-northwest-1": endpoints.Endpoint{}, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn", }, }, @@ -490,17 +526,14 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3", "s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -509,14 +542,6 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -535,15 +560,33 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, diff --git a/service/s3control/api_client.go b/service/s3control/api_client.go index f5b7dcee684..d102d1fa0bf 100644 --- a/service/s3control/api_client.go +++ b/service/s3control/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" s3sharedconfig "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config" smithy "github.com/aws/smithy-go" @@ -96,7 +97,11 @@ 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 +191,8 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) - resolveClientConfig(cfg, &opts) + resolveUseARNRegion(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -264,8 +270,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 +285,26 @@ func resolveClientConfig(cfg aws.Config, o *Options) error { return nil } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.UseDualstack = true + } else { + o.UseDualstack = false + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/s3control/endpoints.go b/service/s3control/endpoints.go index 7889cc861f7..e86ae01db5d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // 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.DualStackEndpoint == DualStackEndpointUnset { + if o.UseDualstack { + endpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + endpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3control/generated.json b/service/s3control/generated.json index 4e3ba094389..bdf7e0fb2c4 100644 --- a/service/s3control/generated.json +++ b/service/s3control/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/s3shared": "v1.2.3", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/s3control/go.mod b/service/s3control/go.mod index cafd7d204d6..14362105421 100644 --- a/service/s3control/go.mod +++ b/service/s3control/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.3.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/s3shared => ../../service/internal/s3shared/ diff --git a/service/s3control/internal/endpoints/endpoints.go b/service/s3control/internal/endpoints/endpoints.go index 5f23ecb30e2..ef8ac606abd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -70,301 +97,303 @@ var defaultPartitions = endpoints.Partitions{ Region: "ap-northeast-1", }, }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-1.amazonaws.com", + "ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-control.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-1", + Region: "ap-northeast-2", }, }, - "ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-control.ap-northeast-2.amazonaws.com", + "ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-control.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-2", + Region: "ap-northeast-3", }, }, - "ap-northeast-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-2.amazonaws.com", + "ap-south-1": endpoints.Endpoint{ + Hostname: "s3-control.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-2", + Region: "ap-south-1", }, }, - "ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-control.ap-northeast-3.amazonaws.com", + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-control.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-3", + Region: "ap-southeast-1", }, }, - "ap-northeast-3-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-northeast-3.amazonaws.com", + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-control.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-northeast-3", + Region: "ap-southeast-2", }, }, - "ap-south-1": endpoints.Endpoint{ - Hostname: "s3-control.ap-south-1.amazonaws.com", + "ca-central-1": endpoints.Endpoint{ + Hostname: "s3-control.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-south-1", + Region: "ca-central-1", }, }, - "ap-south-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-south-1.amazonaws.com", + "ca-central-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-south-1", + Region: "ca-central-1", }, }, - "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-control.ap-southeast-1.amazonaws.com", + "eu-central-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-1", + Region: "eu-central-1", }, }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-southeast-1.amazonaws.com", + "eu-north-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-1", + Region: "eu-north-1", }, }, - "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-control.ap-southeast-2.amazonaws.com", + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-2", + Region: "eu-west-1", }, }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ap-southeast-2.amazonaws.com", + "eu-west-2": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ap-southeast-2", + Region: "eu-west-2", }, }, - "ca-central-1": endpoints.Endpoint{ - Hostname: "s3-control.ca-central-1.amazonaws.com", + "eu-west-3": endpoints.Endpoint{ + Hostname: "s3-control.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "eu-west-3", }, }, - "ca-central-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.ca-central-1.amazonaws.com", + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3-control.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "sa-east-1", }, }, - "ca-central-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.ca-central-1.amazonaws.com", + "us-east-1": endpoints.Endpoint{ + Hostname: "s3-control.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "us-east-1", }, }, - "ca-central-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.ca-central-1.amazonaws.com", + "us-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", + Region: "us-east-1", }, }, - "eu-central-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-central-1.amazonaws.com", + "us-east-2": endpoints.Endpoint{ + Hostname: "s3-control.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-central-1", + Region: "us-east-2", }, }, - "eu-central-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-central-1.amazonaws.com", + "us-east-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-central-1", + Region: "us-east-2", }, }, - "eu-north-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-north-1.amazonaws.com", + "us-west-1": endpoints.Endpoint{ + Hostname: "s3-control.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-north-1", + Region: "us-west-1", }, }, - "eu-north-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-north-1.amazonaws.com", + "us-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-north-1", + Region: "us-west-1", }, }, - "eu-west-1": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-1.amazonaws.com", + "us-west-2": endpoints.Endpoint{ + Hostname: "s3-control.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-1", + Region: "us-west-2", }, }, - "eu-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-1.amazonaws.com", + "us-west-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-1", + Region: "us-west-2", }, }, - "eu-west-2": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-2.amazonaws.com", + }, + DualStackEndpoints: endpoints.Endpoints{ + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-2", + Region: "ap-northeast-1", }, }, - "eu-west-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-2.amazonaws.com", + "ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-2", + Region: "ap-northeast-2", }, }, - "eu-west-3": endpoints.Endpoint{ - Hostname: "s3-control.eu-west-3.amazonaws.com", + "ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-3", + Region: "ap-northeast-3", }, }, - "eu-west-3-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.eu-west-3.amazonaws.com", + "ap-south-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "eu-west-3", + Region: "ap-south-1", }, }, - "sa-east-1": endpoints.Endpoint{ - Hostname: "s3-control.sa-east-1.amazonaws.com", + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "sa-east-1", + Region: "ap-southeast-1", }, }, - "sa-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.sa-east-1.amazonaws.com", + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "sa-east-1", + Region: "ap-southeast-2", }, }, - "us-east-1": endpoints.Endpoint{ - Hostname: "s3-control.us-east-1.amazonaws.com", + "ca-central-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "ca-central-1", }, }, - "us-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-east-1.amazonaws.com", + "ca-central-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "ca-central-1", }, }, - "us-east-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-east-1.amazonaws.com", + "eu-central-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "eu-central-1", }, }, - "us-east-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-east-1.amazonaws.com", + "eu-north-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", + Region: "eu-north-1", }, }, - "us-east-2": endpoints.Endpoint{ - Hostname: "s3-control.us-east-2.amazonaws.com", + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-1", }, }, - "us-east-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-east-2.amazonaws.com", + "eu-west-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-2", }, }, - "us-east-2-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-east-2.amazonaws.com", + "eu-west-3": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "eu-west-3", }, }, - "us-east-2-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-east-2.amazonaws.com", + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", + Region: "sa-east-1", }, }, - "us-west-1": endpoints.Endpoint{ - Hostname: "s3-control.us-west-1.amazonaws.com", + "us-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-1", }, }, - "us-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-west-1.amazonaws.com", + "us-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-1", }, }, - "us-west-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-west-1.amazonaws.com", + "us-east-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-2", }, }, - "us-west-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-west-1.amazonaws.com", + "us-east-2-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", + Region: "us-east-2", }, }, - "us-west-2": endpoints.Endpoint{ - Hostname: "s3-control.us-west-2.amazonaws.com", + "us-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", + Region: "us-west-1", }, }, - "us-west-2-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-west-2.amazonaws.com", + "us-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", + Region: "us-west-1", }, }, - "us-west-2-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-west-2.amazonaws.com", + "us-west-2": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-west-2", }, }, - "us-west-2-fips-dualstack": endpoints.Endpoint{ + "us-west-2-fips": endpoints.Endpoint{ Hostname: "s3-control-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ @@ -380,6 +409,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -390,21 +424,23 @@ var defaultPartitions = endpoints.Partitions{ Region: "cn-north-1", }, }, - "cn-north-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.cn-north-1.amazonaws.com.cn", + "cn-northwest-1": endpoints.Endpoint{ + Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "cn-north-1", + Region: "cn-northwest-1", }, }, - "cn-northwest-1": endpoints.Endpoint{ - Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", + }, + DualStackEndpoints: endpoints.Endpoints{ + "cn-north-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "cn-northwest-1", + Region: "cn-north-1", }, }, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-control.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ @@ -440,6 +476,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3-control.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -450,49 +491,51 @@ var defaultPartitions = endpoints.Partitions{ Region: "us-gov-east-1", }, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-gov-east-1.amazonaws.com", + "us-gov-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-gov-east-1", }, }, - "us-gov-east-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", + "us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-control.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", + Region: "us-gov-west-1", }, }, - "us-gov-east-1-fips-dualstack": endpoints.Endpoint{ - Hostname: "s3-control-fips.dualstack.us-gov-east-1.amazonaws.com", + "us-gov-west-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", + Region: "us-gov-west-1", }, }, - "us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-control.us-gov-west-1.amazonaws.com", + }, + DualStackEndpoints: endpoints.Endpoints{ + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", + Region: "us-gov-east-1", }, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ - Hostname: "s3-control.dualstack.us-gov-west-1.amazonaws.com", + "us-gov-east-1-fips": endpoints.Endpoint{ + Hostname: "s3-control-fips.dualstack.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", + Region: "us-gov-east-1", }, }, - "us-gov-west-1-fips": endpoints.Endpoint{ - Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", + "us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-control.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-gov-west-1", }, }, - "us-gov-west-1-fips-dualstack": endpoints.Endpoint{ + "us-gov-west-1-fips": endpoints.Endpoint{ Hostname: "s3-control-fips.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, CredentialScope: endpoints.CredentialScope{ diff --git a/service/s3control/internal/endpoints/s3/endpoints.go b/service/s3control/internal/endpoints/s3/endpoints.go index 0ca85492e3e..b4956f9c627 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -99,318 +126,320 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-af-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", + "accesspoint-eu-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", + "accesspoint-eu-north-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", + "accesspoint-eu-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + "accesspoint-eu-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-northeast-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + "accesspoint-eu-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + "accesspoint-eu-west-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + "accesspoint-me-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + "accesspoint-sa-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", + "accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", + "accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", + "accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", + "accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", + "af-south-1": endpoints.Endpoint{}, + "ap-east-1": endpoints.Endpoint{}, + "ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-northeast-2": endpoints.Endpoint{}, + "ap-northeast-3": endpoints.Endpoint{}, + "ap-south-1": endpoints.Endpoint{}, + "ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "aws-global": endpoints.Endpoint{ + Hostname: "s3.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "ca-central-1": endpoints.Endpoint{}, + "eu-central-1": endpoints.Endpoint{}, + "eu-north-1": endpoints.Endpoint{}, + "eu-south-1": endpoints.Endpoint{}, + "eu-west-1": endpoints.Endpoint{ + Hostname: "s3.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "eu-west-2": endpoints.Endpoint{}, + "eu-west-3": endpoints.Endpoint{}, + "fips-accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", + "fips-accesspoint-us-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", + "fips-accesspoint-us-east-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", + "fips-accesspoint-us-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", + "fips-accesspoint-us-west-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", + "me-south-1": endpoints.Endpoint{}, + "s3-external-1": endpoints.Endpoint{ + Hostname: "s3-external-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoints.Endpoint{ + Hostname: "s3.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-1": endpoints.Endpoint{ + Hostname: "s3.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-2": endpoints.Endpoint{}, + "us-west-1": endpoints.Endpoint{ + Hostname: "s3.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-west-2": endpoints.Endpoint{ + Hostname: "s3.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-af-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", + "accesspoint-ap-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", + "accesspoint-ap-northeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", + "accesspoint-ap-northeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-northeast-3": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-northeast-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-south-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-south-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ap-southeast-2": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-ca-central-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-central-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-north-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-north-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-eu-west-3": endpoints.Endpoint{ - Hostname: "s3-accesspoint.eu-west-3.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-me-south-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.me-south-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-sa-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.sa-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "af-south-1": endpoints.Endpoint{}, - "af-south-1-dualstack": endpoints.Endpoint{ + "af-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.af-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-east-1": endpoints.Endpoint{}, - "ap-east-1-dualstack": endpoints.Endpoint{ + "ap-east-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-northeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-2": endpoints.Endpoint{}, - "ap-northeast-2-dualstack": endpoints.Endpoint{ + "ap-northeast-2": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-northeast-3": endpoints.Endpoint{}, - "ap-northeast-3-dualstack": endpoints.Endpoint{ + "ap-northeast-3": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-northeast-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "ap-south-1": endpoints.Endpoint{}, - "ap-south-1-dualstack": endpoints.Endpoint{ + "ap-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-1": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "ap-southeast-2": endpoints.Endpoint{ - Hostname: "s3.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "aws-global": endpoints.Endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoints.Endpoint{}, - "ca-central-1-dualstack": endpoints.Endpoint{ + "ca-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-central-1": endpoints.Endpoint{}, - "eu-central-1-dualstack": endpoints.Endpoint{ + "eu-central-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-central-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-north-1": endpoints.Endpoint{}, - "eu-north-1-dualstack": endpoints.Endpoint{ + "eu-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-north-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-south-1": endpoints.Endpoint{}, - "eu-south-1-dualstack": endpoints.Endpoint{ + "eu-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "eu-west-1": endpoints.Endpoint{ - Hostname: "s3.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoints.Endpoint{}, - "eu-west-2-dualstack": endpoints.Endpoint{ + "eu-west-2": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-3": endpoints.Endpoint{}, - "eu-west-3-dualstack": endpoints.Endpoint{ + "eu-west-3": endpoints.Endpoint{ Hostname: "s3.dualstack.eu-west-3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "fips-accesspoint-ca-central-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.ca-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-ca-central-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.dualstack.ca-central-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-east-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-east-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-1.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, "fips-accesspoint-us-west-2": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.us-west-2.amazonaws.com", + Hostname: "s3-accesspoint-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "me-south-1": endpoints.Endpoint{}, - "me-south-1-dualstack": endpoints.Endpoint{ + "me-south-1": endpoints.Endpoint{ Hostname: "s3.dualstack.me-south-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "s3-external-1": endpoints.Endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - }, "sa-east-1": endpoints.Endpoint{ - Hostname: "s3.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "sa-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-east-1": endpoints.Endpoint{ - Hostname: "s3.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "us-east-2": endpoints.Endpoint{}, - "us-east-2-dualstack": endpoints.Endpoint{ + "us-east-2": endpoints.Endpoint{ Hostname: "s3.dualstack.us-east-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-1": endpoints.Endpoint{ - Hostname: "s3.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-1-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, "us-west-2": endpoints.Endpoint{ - Hostname: "s3.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2-dualstack": endpoints.Endpoint{ Hostname: "s3.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, @@ -423,6 +452,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ @@ -434,20 +468,22 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-north-1": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{}, + "cn-northwest-1": endpoints.Endpoint{}, + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-cn-north-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-north-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "accesspoint-dualstack-cn-northwest-1": endpoints.Endpoint{ + "accesspoint-cn-northwest-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.dualstack.cn-northwest-1.amazonaws.com.cn", SignatureVersions: []string{"s3v4"}, }, - "cn-north-1": endpoints.Endpoint{}, - "cn-north-1-dualstack": endpoints.Endpoint{ + "cn-north-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn", }, - "cn-northwest-1": endpoints.Endpoint{}, - "cn-northwest-1-dualstack": endpoints.Endpoint{ + "cn-northwest-1": endpoints.Endpoint{ Hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn", }, }, @@ -488,17 +524,14 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "s3.dualstack.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"s3", "s3v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - "accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -507,14 +540,6 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3-accesspoint.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, }, - "fips-accesspoint-dualstack-us-gov-east-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, - "fips-accesspoint-dualstack-us-gov-west-1": endpoints.Endpoint{ - Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - }, "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ Hostname: "s3-accesspoint-fips.us-gov-east-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -533,15 +558,33 @@ var defaultPartitions = endpoints.Partitions{ Hostname: "s3.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-east-1-dualstack": endpoints.Endpoint{ - Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, - "us-gov-west-1-dualstack": endpoints.Endpoint{ + }, + DualStackEndpoints: endpoints.Endpoints{ + "accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "fips-accesspoint-us-gov-west-1": endpoints.Endpoint{ + Hostname: "s3-accesspoint-fips.dualstack.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + }, + "us-gov-east-1": endpoints.Endpoint{ + Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-gov-west-1": endpoints.Endpoint{ Hostname: "s3.dualstack.us-gov-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, diff --git a/service/s3outposts/api_client.go b/service/s3outposts/api_client.go index ef670431347..7bc22a3bb74 100644 --- a/service/s3outposts/api_client.go +++ b/service/s3outposts/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..fa9443e3a16 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/s3outposts/generated.json b/service/s3outposts/generated.json index a5f324d30a5..df1f9ddf29d 100644 --- a/service/s3outposts/generated.json +++ b/service/s3outposts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/s3outposts/go.mod b/service/s3outposts/go.mod index 1d1af78a965..f3b1a6e3e2f 100644 --- a/service/s3outposts/go.mod +++ b/service/s3outposts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/s3outposts/internal/endpoints/endpoints.go b/service/s3outposts/internal/endpoints/endpoints.go index be7f7c4d744..e818e599fde 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0614243b959 100644 --- a/service/sagemaker/api_client.go +++ b/service/sagemaker/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..63fa573e942 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemaker/generated.json b/service/sagemaker/generated.json index 47cf2235713..0f7bbe3ea0d 100644 --- a/service/sagemaker/generated.json +++ b/service/sagemaker/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/sagemaker/go.mod b/service/sagemaker/go.mod index 15e25198c50..51c31628bfd 100644 --- a/service/sagemaker/go.mod +++ b/service/sagemaker/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemaker/internal/endpoints/endpoints.go b/service/sagemaker/internal/endpoints/endpoints.go index 0322494588d..6913a7107df 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..4384cfbb94a 100644 --- a/service/sagemakera2iruntime/api_client.go +++ b/service/sagemakera2iruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c8f9cffb645 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakera2iruntime/generated.json b/service/sagemakera2iruntime/generated.json index e4e8a8fed6b..135ac63eee4 100644 --- a/service/sagemakera2iruntime/generated.json +++ b/service/sagemakera2iruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakera2iruntime/go.mod b/service/sagemakera2iruntime/go.mod index 43338912a64..394e905f3bd 100644 --- a/service/sagemakera2iruntime/go.mod +++ b/service/sagemakera2iruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakera2iruntime/internal/endpoints/endpoints.go b/service/sagemakera2iruntime/internal/endpoints/endpoints.go index f36a95b6257..87ab427042a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..321ec68ee36 100644 --- a/service/sagemakeredge/api_client.go +++ b/service/sagemakeredge/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..390125f26ce 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakeredge/generated.json b/service/sagemakeredge/generated.json index 6f632d65fd0..2b7c9292074 100644 --- a/service/sagemakeredge/generated.json +++ b/service/sagemakeredge/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakeredge/go.mod b/service/sagemakeredge/go.mod index a8fafebdc97..58340088bd7 100644 --- a/service/sagemakeredge/go.mod +++ b/service/sagemakeredge/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakeredge/internal/endpoints/endpoints.go b/service/sagemakeredge/internal/endpoints/endpoints.go index 9820e2ad5c3..9eaacfb2134 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..93333b24731 100644 --- a/service/sagemakerfeaturestoreruntime/api_client.go +++ b/service/sagemakerfeaturestoreruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d7ab0d774fa 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakerfeaturestoreruntime/generated.json b/service/sagemakerfeaturestoreruntime/generated.json index 8584b56d1c9..832e8e9cdaa 100644 --- a/service/sagemakerfeaturestoreruntime/generated.json +++ b/service/sagemakerfeaturestoreruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakerfeaturestoreruntime/go.mod b/service/sagemakerfeaturestoreruntime/go.mod index 4ba3c69e5e4..d7807c626d6 100644 --- a/service/sagemakerfeaturestoreruntime/go.mod +++ b/service/sagemakerfeaturestoreruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go b/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go index 1939942c2fd..b9a0f61e466 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..aa29b07f15f 100644 --- a/service/sagemakerruntime/api_client.go +++ b/service/sagemakerruntime/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9557bdd509d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sagemakerruntime/generated.json b/service/sagemakerruntime/generated.json index d58f8bec8d4..26f6a6a5455 100644 --- a/service/sagemakerruntime/generated.json +++ b/service/sagemakerruntime/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sagemakerruntime/go.mod b/service/sagemakerruntime/go.mod index 6c73d42d19c..021e281a53a 100644 --- a/service/sagemakerruntime/go.mod +++ b/service/sagemakerruntime/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sagemakerruntime/internal/endpoints/endpoints.go b/service/sagemakerruntime/internal/endpoints/endpoints.go index 0d88783842b..9a39427a47b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..df96662f47f 100644 --- a/service/savingsplans/api_client.go +++ b/service/savingsplans/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..a8da3e17345 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/savingsplans/generated.json b/service/savingsplans/generated.json index 7511af13d52..0cc5f003ea9 100644 --- a/service/savingsplans/generated.json +++ b/service/savingsplans/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/savingsplans/go.mod b/service/savingsplans/go.mod index 7abd9ddd9e6..6eb7587d64d 100644 --- a/service/savingsplans/go.mod +++ b/service/savingsplans/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/savingsplans/internal/endpoints/endpoints.go b/service/savingsplans/internal/endpoints/endpoints.go index 540f6cc5e96..2f2c7bb8ae7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..75dae4902bd 100644 --- a/service/schemas/api_client.go +++ b/service/schemas/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2bbde51e924 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/schemas/generated.json b/service/schemas/generated.json index 942ef135ba0..b83b76a2e2a 100644 --- a/service/schemas/generated.json +++ b/service/schemas/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/schemas/go.mod b/service/schemas/go.mod index 28ff150044e..9e5b1841881 100644 --- a/service/schemas/go.mod +++ b/service/schemas/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/schemas/internal/endpoints/endpoints.go b/service/schemas/internal/endpoints/endpoints.go index 5766470fb0b..2b9a152faf5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..167e76f52ee 100644 --- a/service/secretsmanager/api_client.go +++ b/service/secretsmanager/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..145cca3a4a0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/secretsmanager/generated.json b/service/secretsmanager/generated.json index 84246ee5b96..9c2f5973041 100644 --- a/service/secretsmanager/generated.json +++ b/service/secretsmanager/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/secretsmanager/go.mod b/service/secretsmanager/go.mod index 2368e2cdd65..4cdeffb744b 100644 --- a/service/secretsmanager/go.mod +++ b/service/secretsmanager/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/secretsmanager/internal/endpoints/endpoints.go b/service/secretsmanager/internal/endpoints/endpoints.go index 135bc8194ab..d83f4fda2c5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1ef79773c7f 100644 --- a/service/securityhub/api_client.go +++ b/service/securityhub/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6b7060f3c78 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/securityhub/generated.json b/service/securityhub/generated.json index 2a42a3e18d7..9fa4a808572 100644 --- a/service/securityhub/generated.json +++ b/service/securityhub/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/securityhub/go.mod b/service/securityhub/go.mod index 8cfbf8cbb31..e66e5f665d9 100644 --- a/service/securityhub/go.mod +++ b/service/securityhub/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/securityhub/internal/endpoints/endpoints.go b/service/securityhub/internal/endpoints/endpoints.go index deda44feb9f..4ef73460068 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6223ed48f64 100644 --- a/service/serverlessapplicationrepository/api_client.go +++ b/service/serverlessapplicationrepository/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..3997d96e230 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/serverlessapplicationrepository/generated.json b/service/serverlessapplicationrepository/generated.json index 94bb3f62285..e793106aee2 100644 --- a/service/serverlessapplicationrepository/generated.json +++ b/service/serverlessapplicationrepository/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/serverlessapplicationrepository/go.mod b/service/serverlessapplicationrepository/go.mod index 18905a92133..99011d55ea6 100644 --- a/service/serverlessapplicationrepository/go.mod +++ b/service/serverlessapplicationrepository/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/serverlessapplicationrepository/internal/endpoints/endpoints.go b/service/serverlessapplicationrepository/internal/endpoints/endpoints.go index 9d202f7fb1d..7c93514be2a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..8dff5bdfef0 100644 --- a/service/servicecatalog/api_client.go +++ b/service/servicecatalog/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..954459b6db7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicecatalog/generated.json b/service/servicecatalog/generated.json index 1ce18921a3e..45756ae1f02 100644 --- a/service/servicecatalog/generated.json +++ b/service/servicecatalog/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicecatalog/go.mod b/service/servicecatalog/go.mod index d2e4172bf9b..a0f6b74bbf9 100644 --- a/service/servicecatalog/go.mod +++ b/service/servicecatalog/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicecatalog/internal/endpoints/endpoints.go b/service/servicecatalog/internal/endpoints/endpoints.go index 4ca17b48c4a..f49ccb2042a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d126cf399a3 100644 --- a/service/servicecatalogappregistry/api_client.go +++ b/service/servicecatalogappregistry/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..cf69e65d038 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicecatalogappregistry/generated.json b/service/servicecatalogappregistry/generated.json index c9ab5073733..05c01283a2c 100644 --- a/service/servicecatalogappregistry/generated.json +++ b/service/servicecatalogappregistry/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicecatalogappregistry/go.mod b/service/servicecatalogappregistry/go.mod index 649ea1eb442..7d6e831a85f 100644 --- a/service/servicecatalogappregistry/go.mod +++ b/service/servicecatalogappregistry/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicecatalogappregistry/internal/endpoints/endpoints.go b/service/servicecatalogappregistry/internal/endpoints/endpoints.go index 3546b75d9b0..415670dea3a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ec5e97618a1 100644 --- a/service/servicediscovery/api_client.go +++ b/service/servicediscovery/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..318613b99f2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicediscovery/generated.json b/service/servicediscovery/generated.json index 6f134dca62b..e8e63ac3af9 100644 --- a/service/servicediscovery/generated.json +++ b/service/servicediscovery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicediscovery/go.mod b/service/servicediscovery/go.mod index a0eefbb6908..f6a7acd53d3 100644 --- a/service/servicediscovery/go.mod +++ b/service/servicediscovery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicediscovery/internal/endpoints/endpoints.go b/service/servicediscovery/internal/endpoints/endpoints.go index b08232968f0..416d7c99376 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..54ab627c42e 100644 --- a/service/servicequotas/api_client.go +++ b/service/servicequotas/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..aa41b07c8c1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/servicequotas/generated.json b/service/servicequotas/generated.json index 7568a09d2a0..d004df15d75 100644 --- a/service/servicequotas/generated.json +++ b/service/servicequotas/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/servicequotas/go.mod b/service/servicequotas/go.mod index 308303d88ab..df28fc96a2e 100644 --- a/service/servicequotas/go.mod +++ b/service/servicequotas/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/servicequotas/internal/endpoints/endpoints.go b/service/servicequotas/internal/endpoints/endpoints.go index d0b2be34714..0d3bdc31142 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9236c9ee4f1 100644 --- a/service/ses/api_client.go +++ b/service/ses/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f561554e2ae 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ses/generated.json b/service/ses/generated.json index b1a0d92d460..d80cab89125 100644 --- a/service/ses/generated.json +++ b/service/ses/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ses/go.mod b/service/ses/go.mod index 20abad36e50..01af906c766 100644 --- a/service/ses/go.mod +++ b/service/ses/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ses/internal/endpoints/endpoints.go b/service/ses/internal/endpoints/endpoints.go index e280612c5f1..dc59cff6afd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ee4ac325354 100644 --- a/service/sesv2/api_client.go +++ b/service/sesv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..66d4fe3b89c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sesv2/generated.json b/service/sesv2/generated.json index 1ef9f9449fa..2d5bf6f96ee 100644 --- a/service/sesv2/generated.json +++ b/service/sesv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sesv2/go.mod b/service/sesv2/go.mod index a7de55486d6..5404457fc1e 100644 --- a/service/sesv2/go.mod +++ b/service/sesv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sesv2/internal/endpoints/endpoints.go b/service/sesv2/internal/endpoints/endpoints.go index 39f2c478657..320ea1c7414 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f76b9fa819c 100644 --- a/service/sfn/api_client.go +++ b/service/sfn/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9d4cd8e8c91 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sfn/generated.json b/service/sfn/generated.json index b8c334e8a25..e3a677c2307 100644 --- a/service/sfn/generated.json +++ b/service/sfn/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sfn/go.mod b/service/sfn/go.mod index 110c96e94ba..9243285552e 100644 --- a/service/sfn/go.mod +++ b/service/sfn/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sfn/internal/endpoints/endpoints.go b/service/sfn/internal/endpoints/endpoints.go index 590b1dd05f6..1888429ecf8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ddc5454d03c 100644 --- a/service/shield/api_client.go +++ b/service/shield/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..61c1185b0d6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/shield/generated.json b/service/shield/generated.json index c3580a2363e..9832d3d0dee 100644 --- a/service/shield/generated.json +++ b/service/shield/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/shield/go.mod b/service/shield/go.mod index ca1c7d0bc6f..dcb63ef8612 100644 --- a/service/shield/go.mod +++ b/service/shield/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/shield/internal/endpoints/endpoints.go b/service/shield/internal/endpoints/endpoints.go index a3a57043001..1dfcf6bd1c6 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ce0cefe20c0 100644 --- a/service/signer/api_client.go +++ b/service/signer/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e4493b57839 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/signer/generated.json b/service/signer/generated.json index 99e1fbbf2c5..d93064c89e9 100644 --- a/service/signer/generated.json +++ b/service/signer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/signer/go.mod b/service/signer/go.mod index 32a222aedfb..df8b77ade49 100644 --- a/service/signer/go.mod +++ b/service/signer/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/signer/internal/endpoints/endpoints.go b/service/signer/internal/endpoints/endpoints.go index 1156ed49372..7290bdd5b9e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..57f8e739557 100644 --- a/service/sms/api_client.go +++ b/service/sms/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..22292346804 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sms/generated.json b/service/sms/generated.json index 07f299d9743..c0ee59772f1 100644 --- a/service/sms/generated.json +++ b/service/sms/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sms/go.mod b/service/sms/go.mod index c90e0f2c2a2..b779e3fdb66 100644 --- a/service/sms/go.mod +++ b/service/sms/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sms/internal/endpoints/endpoints.go b/service/sms/internal/endpoints/endpoints.go index b3ac36db355..885a165e01a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..296fc2993c8 100644 --- a/service/snowball/api_client.go +++ b/service/snowball/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..de65c21d867 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/snowball/generated.json b/service/snowball/generated.json index f332ebb1606..95c6f03bb49 100644 --- a/service/snowball/generated.json +++ b/service/snowball/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/snowball/go.mod b/service/snowball/go.mod index 637f7bd8209..6430a1cf601 100644 --- a/service/snowball/go.mod +++ b/service/snowball/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/snowball/internal/endpoints/endpoints.go b/service/snowball/internal/endpoints/endpoints.go index 366f890c651..0f6dcca57b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..42228348a13 100644 --- a/service/sns/api_client.go +++ b/service/sns/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..00afafadfe5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sns/generated.json b/service/sns/generated.json index 6a1ba7b4913..65736971f1b 100644 --- a/service/sns/generated.json +++ b/service/sns/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sns/go.mod b/service/sns/go.mod index f6969c569e0..80716423298 100644 --- a/service/sns/go.mod +++ b/service/sns/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sns/internal/endpoints/endpoints.go b/service/sns/internal/endpoints/endpoints.go index 926bd4d3086..0f13cd4d79e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9abe6860d7b 100644 --- a/service/sqs/api_client.go +++ b/service/sqs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..c73b6f3193c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sqs/generated.json b/service/sqs/generated.json index 93ebbb4cbf1..acbf448849d 100644 --- a/service/sqs/generated.json +++ b/service/sqs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sqs/go.mod b/service/sqs/go.mod index 506884d416a..bde1bf433ac 100644 --- a/service/sqs/go.mod +++ b/service/sqs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sqs/internal/endpoints/endpoints.go b/service/sqs/internal/endpoints/endpoints.go index cc1fab22471..321b621a1bf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ca4af92962c 100644 --- a/service/ssm/api_client.go +++ b/service/ssm/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..9b49c7d482b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssm/generated.json b/service/ssm/generated.json index 1faa87f195a..7b008bff6fb 100644 --- a/service/ssm/generated.json +++ b/service/ssm/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ssm/go.mod b/service/ssm/go.mod index 830e21e0a52..9ede881c590 100644 --- a/service/ssm/go.mod +++ b/service/ssm/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssm/internal/endpoints/endpoints.go b/service/ssm/internal/endpoints/endpoints.go index 24c48ade116..80d0402b4b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..1f39b2a51c5 100644 --- a/service/ssmcontacts/api_client.go +++ b/service/ssmcontacts/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..0f7409868e5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssmcontacts/generated.json b/service/ssmcontacts/generated.json index 31c7940bd60..648ec72317d 100644 --- a/service/ssmcontacts/generated.json +++ b/service/ssmcontacts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssmcontacts/go.mod b/service/ssmcontacts/go.mod index ff56ff98df9..76b8006e0e0 100644 --- a/service/ssmcontacts/go.mod +++ b/service/ssmcontacts/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssmcontacts/internal/endpoints/endpoints.go b/service/ssmcontacts/internal/endpoints/endpoints.go index 494c0809622..a5fb55b02b0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-contacts.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/ssmincidents/api_client.go b/service/ssmincidents/api_client.go index 1e7b22ece93..0d0632a6275 100644 --- a/service/ssmincidents/api_client.go +++ b/service/ssmincidents/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + return nil +} + // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) diff --git a/service/ssmincidents/endpoints.go b/service/ssmincidents/endpoints.go index 3fe96d7d623..046c53eb59f 100644 --- a/service/ssmincidents/endpoints.go +++ b/service/ssmincidents/endpoints.go @@ -14,6 +14,22 @@ import ( "net/url" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint = internalendpoints.DualStackEndpoint + +const ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssmincidents/generated.json b/service/ssmincidents/generated.json index 17ba1f63701..e30eacabeff 100644 --- a/service/ssmincidents/generated.json +++ b/service/ssmincidents/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0", "github.com/jmespath/go-jmespath": "v0.4.0" }, diff --git a/service/ssmincidents/go.mod b/service/ssmincidents/go.mod index 2853c87e53b..8c6992a3774 100644 --- a/service/ssmincidents/go.mod +++ b/service/ssmincidents/go.mod @@ -4,8 +4,11 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 github.com/jmespath/go-jmespath v0.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssmincidents/internal/endpoints/endpoints.go b/service/ssmincidents/internal/endpoints/endpoints.go index 8f2e2466d1b..b4ee7f7f634 100644 --- a/service/ssmincidents/internal/endpoints/endpoints.go +++ b/service/ssmincidents/internal/endpoints/endpoints.go @@ -8,9 +8,30 @@ import ( "regexp" ) +// DualStackEndpoint is a constant to describe the dual-stack endpoint resolution +// behavior. +type DualStackEndpoint uint + +const ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // Resolver SSM Incidents endpoint resolver @@ -26,6 +47,7 @@ func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws opt := endpoints.Options{ DisableHTTPS: options.DisableHTTPS, + UseDualStack: isDualStackEndpointEnabled(options.DualStackEndpoint), } return r.partitions.ResolveEndpoint(region, opt) } @@ -60,6 +82,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, @@ -70,6 +97,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, @@ -100,6 +132,11 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, + DualStackDefaults: endpoints.Endpoint{ + Hostname: "ssm-incidents.{region}.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, diff --git a/service/sso/api_client.go b/service/sso/api_client.go index 7b8887b24c5..a2f0677ca62 100644 --- a/service/sso/api_client.go +++ b/service/sso/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..7717a20aa4c 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sso/generated.json b/service/sso/generated.json index a82f11041b7..385f727936e 100644 --- a/service/sso/generated.json +++ b/service/sso/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/sso/go.mod b/service/sso/go.mod index d41388aeb4d..1ab7cdeff2b 100644 --- a/service/sso/go.mod +++ b/service/sso/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/sso/internal/endpoints/endpoints.go b/service/sso/internal/endpoints/endpoints.go index 398f8bc96aa..4f43d0cf01a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2bd1aabd07d 100644 --- a/service/ssoadmin/api_client.go +++ b/service/ssoadmin/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..bebea24bfe0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssoadmin/generated.json b/service/ssoadmin/generated.json index 8ddd61a9bd1..c2deb2e9337 100644 --- a/service/ssoadmin/generated.json +++ b/service/ssoadmin/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssoadmin/go.mod b/service/ssoadmin/go.mod index 483bb0ecd66..f4a94ce7607 100644 --- a/service/ssoadmin/go.mod +++ b/service/ssoadmin/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssoadmin/internal/endpoints/endpoints.go b/service/ssoadmin/internal/endpoints/endpoints.go index e067a94dd6b..92c481f9adf 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..b836950abee 100644 --- a/service/ssooidc/api_client.go +++ b/service/ssooidc/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..48f323eebe0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/ssooidc/generated.json b/service/ssooidc/generated.json index e86429a3754..b5ea615bdb7 100644 --- a/service/ssooidc/generated.json +++ b/service/ssooidc/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/ssooidc/go.mod b/service/ssooidc/go.mod index 7508145839a..9a69170f8da 100644 --- a/service/ssooidc/go.mod +++ b/service/ssooidc/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/ssooidc/internal/endpoints/endpoints.go b/service/ssooidc/internal/endpoints/endpoints.go index c9307a6178c..a656695df49 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..0417907bcd9 100644 --- a/service/storagegateway/api_client.go +++ b/service/storagegateway/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..b82d1eac612 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/storagegateway/generated.json b/service/storagegateway/generated.json index 9499ef38eb6..7c29a05c9cc 100644 --- a/service/storagegateway/generated.json +++ b/service/storagegateway/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/storagegateway/go.mod b/service/storagegateway/go.mod index 82be4ec21ac..c259faeee59 100644 --- a/service/storagegateway/go.mod +++ b/service/storagegateway/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/storagegateway/internal/endpoints/endpoints.go b/service/storagegateway/internal/endpoints/endpoints.go index 82b0bfe9096..ab23e34cee0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..f6d84abf817 100644 --- a/service/sts/api_client.go +++ b/service/sts/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" @@ -173,6 +174,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -243,6 +245,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d9158e7eef4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/sts/generated.json b/service/sts/generated.json index d223a42ed7f..374d7a6a3d0 100644 --- a/service/sts/generated.json +++ b/service/sts/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url": "v1.0.7", "github.com/aws/smithy-go": "v1.4.0" }, diff --git a/service/sts/go.mod b/service/sts/go.mod index b29ffc3c9bb..727f66e8083 100644 --- a/service/sts/go.mod +++ b/service/sts/go.mod @@ -4,10 +4,13 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ diff --git a/service/sts/internal/endpoints/endpoints.go b/service/sts/internal/endpoints/endpoints.go index e99aab6a62c..40edf463a7e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..7cb3d1db5f4 100644 --- a/service/support/api_client.go +++ b/service/support/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..6c365853b25 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/support/generated.json b/service/support/generated.json index 354bd91e80e..5e9429ef5a1 100644 --- a/service/support/generated.json +++ b/service/support/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/support/go.mod b/service/support/go.mod index 3594b8bd656..d3f77a900e9 100644 --- a/service/support/go.mod +++ b/service/support/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/support/internal/endpoints/endpoints.go b/service/support/internal/endpoints/endpoints.go index abf6d4c1969..fde4d76bf1f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..84a47616589 100644 --- a/service/swf/api_client.go +++ b/service/swf/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..71915aafaf3 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/swf/generated.json b/service/swf/generated.json index 2aafeff9831..450a9770bbf 100644 --- a/service/swf/generated.json +++ b/service/swf/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/swf/go.mod b/service/swf/go.mod index f435b1ecc25..29df890b8b1 100644 --- a/service/swf/go.mod +++ b/service/swf/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/swf/internal/endpoints/endpoints.go b/service/swf/internal/endpoints/endpoints.go index 10c79532e45..bea351f0ad7 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2c3e4f6decf 100644 --- a/service/synthetics/api_client.go +++ b/service/synthetics/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..eaebc98f73f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/synthetics/generated.json b/service/synthetics/generated.json index 50cef98d7cf..127c64596c6 100644 --- a/service/synthetics/generated.json +++ b/service/synthetics/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/synthetics/go.mod b/service/synthetics/go.mod index c4f18866244..35bcb7ed93b 100644 --- a/service/synthetics/go.mod +++ b/service/synthetics/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/synthetics/internal/endpoints/endpoints.go b/service/synthetics/internal/endpoints/endpoints.go index e2c85fa7182..8db32c58058 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..d37173e9a52 100644 --- a/service/textract/api_client.go +++ b/service/textract/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e4037b6e7b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/textract/generated.json b/service/textract/generated.json index 62509949099..797fcd485df 100644 --- a/service/textract/generated.json +++ b/service/textract/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/textract/go.mod b/service/textract/go.mod index 8eb66566946..44b15373b81 100644 --- a/service/textract/go.mod +++ b/service/textract/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/textract/internal/endpoints/endpoints.go b/service/textract/internal/endpoints/endpoints.go index b36356c9a29..67545434a0e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..9068938145a 100644 --- a/service/timestreamquery/api_client.go +++ b/service/timestreamquery/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2ad3218ffb0 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/timestreamquery/generated.json b/service/timestreamquery/generated.json index 837cb34e73f..c646ca8494a 100644 --- a/service/timestreamquery/generated.json +++ b/service/timestreamquery/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/timestreamquery/go.mod b/service/timestreamquery/go.mod index 07e585e9749..8da13402d49 100644 --- a/service/timestreamquery/go.mod +++ b/service/timestreamquery/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/timestreamquery/internal/endpoints/endpoints.go b/service/timestreamquery/internal/endpoints/endpoints.go index 84df6bea531..a3ee72f9e1f 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..56baee95b76 100644 --- a/service/timestreamwrite/api_client.go +++ b/service/timestreamwrite/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..0a0a1bd1c87 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/timestreamwrite/generated.json b/service/timestreamwrite/generated.json index 9ca39bfe4f6..b515f8d8736 100644 --- a/service/timestreamwrite/generated.json +++ b/service/timestreamwrite/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/timestreamwrite/go.mod b/service/timestreamwrite/go.mod index 8609eb2617d..acd7f43cb72 100644 --- a/service/timestreamwrite/go.mod +++ b/service/timestreamwrite/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/timestreamwrite/internal/endpoints/endpoints.go b/service/timestreamwrite/internal/endpoints/endpoints.go index baf7927a44f..c9a8f27a05b 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..18baa7c347d 100644 --- a/service/transcribe/api_client.go +++ b/service/transcribe/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..166aa23dbe8 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/transcribe/generated.json b/service/transcribe/generated.json index b00e110b055..2bba3be0f7b 100644 --- a/service/transcribe/generated.json +++ b/service/transcribe/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/transcribe/go.mod b/service/transcribe/go.mod index 8be474161ae..9d06c213ad0 100644 --- a/service/transcribe/go.mod +++ b/service/transcribe/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/transcribe/internal/endpoints/endpoints.go b/service/transcribe/internal/endpoints/endpoints.go index 69edd845334..8dd58665f09 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..2f03fa2cfe7 100644 --- a/service/transfer/api_client.go +++ b/service/transfer/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..25d1eb50b59 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/transfer/generated.json b/service/transfer/generated.json index ded5c1efcff..c5907cdf309 100644 --- a/service/transfer/generated.json +++ b/service/transfer/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/transfer/go.mod b/service/transfer/go.mod index b5b8c49748b..c56a331a84d 100644 --- a/service/transfer/go.mod +++ b/service/transfer/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/transfer/internal/endpoints/endpoints.go b/service/transfer/internal/endpoints/endpoints.go index ea240f63ad0..2458d3be95e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..fd9c879d2dc 100644 --- a/service/translate/api_client.go +++ b/service/translate/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..f021f182e7d 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/translate/generated.json b/service/translate/generated.json index 0a0bd528ac5..b965549d5e8 100644 --- a/service/translate/generated.json +++ b/service/translate/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/translate/go.mod b/service/translate/go.mod index ea34a98974f..e18c064b572 100644 --- a/service/translate/go.mod +++ b/service/translate/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/translate/internal/endpoints/endpoints.go b/service/translate/internal/endpoints/endpoints.go index c034489b92e..a82d9b72f39 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..63d71417690 100644 --- a/service/waf/api_client.go +++ b/service/waf/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..d586715f34e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/waf/generated.json b/service/waf/generated.json index 35e9e49c44c..25d4aadfb52 100644 --- a/service/waf/generated.json +++ b/service/waf/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/waf/go.mod b/service/waf/go.mod index 5ac748fa625..4f45edfb8ad 100644 --- a/service/waf/go.mod +++ b/service/waf/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/waf/internal/endpoints/endpoints.go b/service/waf/internal/endpoints/endpoints.go index 1f15710743e..22d2a700a30 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..e1dac9658ba 100644 --- a/service/wafregional/api_client.go +++ b/service/wafregional/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..2d3f2aa14c5 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wafregional/generated.json b/service/wafregional/generated.json index fc1e8c79bc8..14c0526b4c5 100644 --- a/service/wafregional/generated.json +++ b/service/wafregional/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wafregional/go.mod b/service/wafregional/go.mod index 239e6f3f770..cebf5c2b07a 100644 --- a/service/wafregional/go.mod +++ b/service/wafregional/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wafregional/internal/endpoints/endpoints.go b/service/wafregional/internal/endpoints/endpoints.go index c111d0c3298..9b15138e5b4 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..457852b1193 100644 --- a/service/wafv2/api_client.go +++ b/service/wafv2/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..bfc23aed4d2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wafv2/generated.json b/service/wafv2/generated.json index b2a582e3416..4feb9600053 100644 --- a/service/wafv2/generated.json +++ b/service/wafv2/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wafv2/go.mod b/service/wafv2/go.mod index eee2266ba48..9b46268cb56 100644 --- a/service/wafv2/go.mod +++ b/service/wafv2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wafv2/internal/endpoints/endpoints.go b/service/wafv2/internal/endpoints/endpoints.go index 8a0648efbbb..47e36894427 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6706e996a40 100644 --- a/service/wellarchitected/api_client.go +++ b/service/wellarchitected/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -179,6 +180,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -256,6 +258,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..e0cb248f775 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/wellarchitected/generated.json b/service/wellarchitected/generated.json index ff0147239b8..67ba76bf978 100644 --- a/service/wellarchitected/generated.json +++ b/service/wellarchitected/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/wellarchitected/go.mod b/service/wellarchitected/go.mod index 4dcbf865079..db39061deb9 100644 --- a/service/wellarchitected/go.mod +++ b/service/wellarchitected/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/wellarchitected/internal/endpoints/endpoints.go b/service/wellarchitected/internal/endpoints/endpoints.go index 4412ee761f4..7709bcebe52 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..ecc4e594c0e 100644 --- a/service/workdocs/api_client.go +++ b/service/workdocs/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..076204104f2 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workdocs/generated.json b/service/workdocs/generated.json index 94c4d37b9e1..42bf2dc5a94 100644 --- a/service/workdocs/generated.json +++ b/service/workdocs/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workdocs/go.mod b/service/workdocs/go.mod index 8aeb638431d..5ef48e797a1 100644 --- a/service/workdocs/go.mod +++ b/service/workdocs/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workdocs/internal/endpoints/endpoints.go b/service/workdocs/internal/endpoints/endpoints.go index 2630d84fa60..f029f2b639a 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..689a6602308 100644 --- a/service/worklink/api_client.go +++ b/service/worklink/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1982a29b489 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/worklink/generated.json b/service/worklink/generated.json index 61131bf8e03..d84500ffbf2 100644 --- a/service/worklink/generated.json +++ b/service/worklink/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/worklink/go.mod b/service/worklink/go.mod index 586b128338b..9feaf388e88 100644 --- a/service/worklink/go.mod +++ b/service/worklink/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/worklink/internal/endpoints/endpoints.go b/service/worklink/internal/endpoints/endpoints.go index 0ed2cd6f0fa..b9bc1ea3969 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..c6050b94ccf 100644 --- a/service/workmail/api_client.go +++ b/service/workmail/api_client.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -178,6 +179,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -255,6 +257,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..5e8a9ac743e 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workmail/generated.json b/service/workmail/generated.json index 68dfe2561ac..fb663d98fcf 100644 --- a/service/workmail/generated.json +++ b/service/workmail/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workmail/go.mod b/service/workmail/go.mod index 0d6f5568b0c..d115841c631 100644 --- a/service/workmail/go.mod +++ b/service/workmail/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workmail/internal/endpoints/endpoints.go b/service/workmail/internal/endpoints/endpoints.go index 88dc477f0c3..71647b95194 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..318b319c6f8 100644 --- a/service/workmailmessageflow/api_client.go +++ b/service/workmailmessageflow/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -171,6 +172,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -241,6 +243,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..dd79ef3e5a1 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workmailmessageflow/generated.json b/service/workmailmessageflow/generated.json index 7cfdefaef65..08329f6d50c 100644 --- a/service/workmailmessageflow/generated.json +++ b/service/workmailmessageflow/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workmailmessageflow/go.mod b/service/workmailmessageflow/go.mod index 38cf5d2cfd7..e91bb1946c6 100644 --- a/service/workmailmessageflow/go.mod +++ b/service/workmailmessageflow/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workmailmessageflow/internal/endpoints/endpoints.go b/service/workmailmessageflow/internal/endpoints/endpoints.go index 6b6f5050d4c..529eaeb3743 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..6c36155ae2a 100644 --- a/service/workspaces/api_client.go +++ b/service/workspaces/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..94adbcb9252 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/workspaces/generated.json b/service/workspaces/generated.json index 6ae1f1383de..166b8d8b53a 100644 --- a/service/workspaces/generated.json +++ b/service/workspaces/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/workspaces/go.mod b/service/workspaces/go.mod index 9939336a5d2..ac1347a2631 100644 --- a/service/workspaces/go.mod +++ b/service/workspaces/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/workspaces/internal/endpoints/endpoints.go b/service/workspaces/internal/endpoints/endpoints.go index 94d0b6fe413..5837b1475bd 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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..bcc0dbfe175 100644 --- a/service/xray/api_client.go +++ b/service/xray/api_client.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/configsources" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" @@ -170,6 +171,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { } resolveAWSRetryerProvider(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) + resolveDualStackEndpoint(cfg, &opts) return New(opts, optFns...) } @@ -240,6 +242,26 @@ func addRetryMiddlewares(stack *middleware.Stack, o Options) error { return retry.AddRetryMiddlewares(stack, mo) } +// resolves dual-stack endpoint configuration +func resolveDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := configsources.ResolveUseDualStack(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + if value { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointEnabled + } else { + o.EndpointOptions.DualStackEndpoint = DualStackEndpointDisabled + } + + } + 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..1a2c6d64b56 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = internalendpoints.DualStackEndpointUnset + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled DualStackEndpoint = internalendpoints.DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled DualStackEndpoint = internalendpoints.DualStackEndpointDisabled +) + // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options @@ -112,9 +128,10 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + endpointOptions := o.EndpointOptions return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, - Options: o.EndpointOptions, + Options: endpointOptions, }, "OperationSerializer", middleware.Before) } diff --git a/service/xray/generated.json b/service/xray/generated.json index fde6ca5f7b6..310e9d30611 100644 --- a/service/xray/generated.json +++ b/service/xray/generated.json @@ -1,6 +1,7 @@ { "dependencies": { "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", "github.com/aws/smithy-go": "v1.4.0" }, "files": [ diff --git a/service/xray/go.mod b/service/xray/go.mod index 574de5e470a..838c6121082 100644 --- a/service/xray/go.mod +++ b/service/xray/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/aws/aws-sdk-go-v2 v1.6.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/smithy-go v1.4.0 ) replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ diff --git a/service/xray/internal/endpoints/endpoints.go b/service/xray/internal/endpoints/endpoints.go index 1db09e625fa..a99ae136911 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 ( + // DualStackEndpointUnset is the default value behavior for dual-stack endpoint + // resolution. + DualStackEndpointUnset DualStackEndpoint = iota + + // DualStackEndpointEnabled enable dual-stack endpoint resolution for endpoints. + DualStackEndpointEnabled + + // DualStackEndpointDisabled disables dual-stack endpoint resolution for endpoints. + DualStackEndpointDisabled +) + // Options is the endpoint resolver configuration options type Options struct { - DisableHTTPS bool + DisableHTTPS bool + DualStackEndpoint DualStackEndpoint +} + +func isDualStackEndpointEnabled(value DualStackEndpoint) bool { + return value == DualStackEndpointEnabled } // 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.DualStackEndpoint), } 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{