Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EndpointResolverWithOptions ignored issue #1514

Merged
merged 5 commits into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .changelog/954dde1360ef407d8ecb138e35fd6534.json
@@ -0,0 +1,8 @@
{
"id": "954dde13-60ef-407d-8ecb-138e35fd6534",
"type": "feature",
"description": "Add support for specifying `EndpointResolverWithOptions` on `LoadOptions`, and associated `WithEndpointResolverWithOptions`.",
"modules": [
"config"
]
}
309 changes: 309 additions & 0 deletions .changelog/f0080c1f15ae43c5a697801297110714.json
@@ -0,0 +1,309 @@
{
"id": "f0080c1f-15ae-43c5-a697-801297110714",
"type": "bugfix",
"collapse": true,
"description": "Fixes a bug that prevented aws.EndpointResolverWithOptions from being used by the service client.",
"modules": [
"internal/protocoltest/awsrestjson",
"internal/protocoltest/ec2query",
"internal/protocoltest/jsonrpc",
"internal/protocoltest/jsonrpc10",
"internal/protocoltest/query",
"internal/protocoltest/restxml",
"internal/protocoltest/restxmlwithnamespace",
"service/accessanalyzer",
"service/account",
"service/acm",
"service/acmpca",
"service/alexaforbusiness",
"service/amp",
"service/amplify",
"service/amplifybackend",
"service/apigateway",
"service/apigatewaymanagementapi",
"service/apigatewayv2",
"service/appconfig",
"service/appconfigdata",
"service/appflow",
"service/appintegrations",
"service/applicationautoscaling",
"service/applicationcostprofiler",
"service/applicationdiscoveryservice",
"service/applicationinsights",
"service/appmesh",
"service/apprunner",
"service/appstream",
"service/appsync",
"service/athena",
"service/auditmanager",
"service/autoscaling",
"service/autoscalingplans",
"service/backup",
"service/batch",
"service/braket",
"service/budgets",
"service/chime",
"service/chimesdkidentity",
"service/chimesdkmeetings",
"service/chimesdkmessaging",
"service/cloud9",
"service/cloudcontrol",
"service/clouddirectory",
"service/cloudformation",
"service/cloudfront",
"service/cloudhsm",
"service/cloudhsmv2",
"service/cloudsearch",
"service/cloudsearchdomain",
"service/cloudtrail",
"service/cloudwatch",
"service/cloudwatchevents",
"service/cloudwatchlogs",
"service/codeartifact",
"service/codebuild",
"service/codecommit",
"service/codedeploy",
"service/codeguruprofiler",
"service/codegurureviewer",
"service/codepipeline",
"service/codestar",
"service/codestarconnections",
"service/codestarnotifications",
"service/cognitoidentity",
"service/cognitoidentityprovider",
"service/cognitosync",
"service/comprehend",
"service/comprehendmedical",
"service/computeoptimizer",
"service/configservice",
"service/connect",
"service/connectcontactlens",
"service/connectparticipant",
"service/costandusagereportservice",
"service/costexplorer",
"service/customerprofiles",
"service/databasemigrationservice",
"service/databrew",
"service/dataexchange",
"service/datapipeline",
"service/datasync",
"service/dax",
"service/detective",
"service/devicefarm",
"service/devopsguru",
"service/directconnect",
"service/directoryservice",
"service/dlm",
"service/docdb",
"service/drs",
"service/dynamodb",
"service/dynamodbstreams",
"service/ebs",
"service/ec2",
"service/ec2instanceconnect",
"service/ecr",
"service/ecrpublic",
"service/ecs",
"service/efs",
"service/eks",
"service/elasticache",
"service/elasticbeanstalk",
"service/elasticinference",
"service/elasticloadbalancing",
"service/elasticloadbalancingv2",
"service/elasticsearchservice",
"service/elastictranscoder",
"service/emr",
"service/emrcontainers",
"service/eventbridge",
"service/evidently",
"service/finspace",
"service/finspacedata",
"service/firehose",
"service/fis",
"service/fms",
"service/forecast",
"service/forecastquery",
"service/frauddetector",
"service/fsx",
"service/gamelift",
"service/glacier",
"service/globalaccelerator",
"service/glue",
"service/grafana",
"service/greengrass",
"service/greengrassv2",
"service/groundstation",
"service/guardduty",
"service/health",
"service/healthlake",
"service/honeycode",
"service/iam",
"service/identitystore",
"service/imagebuilder",
"service/inspector",
"service/inspector2",
"service/iot",
"service/iot1clickdevicesservice",
"service/iot1clickprojects",
"service/iotanalytics",
"service/iotdataplane",
"service/iotdeviceadvisor",
"service/iotevents",
"service/ioteventsdata",
"service/iotfleethub",
"service/iotjobsdataplane",
"service/iotsecuretunneling",
"service/iotsitewise",
"service/iotthingsgraph",
"service/iotwireless",
"service/ivs",
"service/kafka",
"service/kafkaconnect",
"service/kendra",
"service/kinesis",
"service/kinesisanalytics",
"service/kinesisanalyticsv2",
"service/kinesisvideo",
"service/kinesisvideoarchivedmedia",
"service/kinesisvideomedia",
"service/kinesisvideosignaling",
"service/kms",
"service/lakeformation",
"service/lambda",
"service/lexmodelbuildingservice",
"service/lexmodelsv2",
"service/lexruntimeservice",
"service/lexruntimev2",
"service/licensemanager",
"service/lightsail",
"service/location",
"service/lookoutequipment",
"service/lookoutmetrics",
"service/lookoutvision",
"service/machinelearning",
"service/macie",
"service/macie2",
"service/managedblockchain",
"service/marketplacecatalog",
"service/marketplacecommerceanalytics",
"service/marketplaceentitlementservice",
"service/marketplacemetering",
"service/mediaconnect",
"service/mediaconvert",
"service/medialive",
"service/mediapackage",
"service/mediapackagevod",
"service/mediastore",
"service/mediastoredata",
"service/mediatailor",
"service/memorydb",
"service/mgn",
"service/migrationhub",
"service/migrationhubconfig",
"service/migrationhubrefactorspaces",
"service/migrationhubstrategy",
"service/mobile",
"service/mq",
"service/mturk",
"service/mwaa",
"service/neptune",
"service/networkfirewall",
"service/networkmanager",
"service/nimble",
"service/opensearch",
"service/opsworks",
"service/opsworkscm",
"service/organizations",
"service/outposts",
"service/panorama",
"service/personalize",
"service/personalizeevents",
"service/personalizeruntime",
"service/pi",
"service/pinpoint",
"service/pinpointemail",
"service/pinpointsmsvoice",
"service/polly",
"service/pricing",
"service/proton",
"service/qldb",
"service/qldbsession",
"service/quicksight",
"service/ram",
"service/rbin",
"service/rds",
"service/rdsdata",
"service/redshift",
"service/redshiftdata",
"service/rekognition",
"service/resiliencehub",
"service/resourcegroups",
"service/resourcegroupstaggingapi",
"service/robomaker",
"service/route53",
"service/route53domains",
"service/route53recoverycluster",
"service/route53recoverycontrolconfig",
"service/route53recoveryreadiness",
"service/route53resolver",
"service/rum",
"service/s3",
"service/s3control",
"service/s3outposts",
"service/sagemaker",
"service/sagemakera2iruntime",
"service/sagemakeredge",
"service/sagemakerfeaturestoreruntime",
"service/sagemakerruntime",
"service/savingsplans",
"service/schemas",
"service/secretsmanager",
"service/securityhub",
"service/serverlessapplicationrepository",
"service/servicecatalog",
"service/servicecatalogappregistry",
"service/servicediscovery",
"service/servicequotas",
"service/ses",
"service/sesv2",
"service/sfn",
"service/shield",
"service/signer",
"service/sms",
"service/snowball",
"service/snowdevicemanagement",
"service/sns",
"service/sqs",
"service/ssm",
"service/ssmcontacts",
"service/ssmincidents",
"service/sso",
"service/ssoadmin",
"service/ssooidc",
"service/storagegateway",
"service/sts",
"service/support",
"service/swf",
"service/synthetics",
"service/textract",
"service/timestreamquery",
"service/timestreamwrite",
"service/transcribe",
"service/transcribestreaming",
"service/transfer",
"service/translate",
"service/voiceid",
"service/waf",
"service/wafregional",
"service/wafv2",
"service/wellarchitected",
"service/wisdom",
"service/workdocs",
"service/worklink",
"service/workmail",
"service/workmailmessageflow",
"service/workspaces",
"service/xray"
]
}
11 changes: 9 additions & 2 deletions aws/config.go
Expand Up @@ -39,13 +39,20 @@ type Config struct {
HTTPClient HTTPClient

// An endpoint resolver that can be used to provide or override an endpoint for the given
// service and region Please see the `aws.EndpointResolver` documentation on usage.
// service and region.
//
// See the `aws.EndpointResolver` documentation for additional usage information.
//
// Deprecated: See Config.EndpointResolverWithOptions
EndpointResolver EndpointResolver

// An endpoint resolver that can be used to provide or override an endpoint for the given
// service and region Please see the `aws.EndpointResolverWithOptions` documentation on usage.
// service and region.
//
// When EndpointResolverWithOptions is specified, it will be used by a service client rather than using
// EndpointResolver if also specified.
//
// See the `aws.EndpointResolverWithOptions` documentation for additional usage information.
EndpointResolverWithOptions EndpointResolverWithOptions

// Retryer is a function that provides a Retryer implementation. A Retryer guides how HTTP requests should be
Expand Down
12 changes: 9 additions & 3 deletions aws/endpoints.go
Expand Up @@ -160,22 +160,28 @@ func (e *EndpointNotFoundError) Unwrap() error {
// available. If the EndpointResolver returns an EndpointNotFoundError error,
// API clients will fallback to attempting to resolve the endpoint using its
// internal default endpoint resolver.
//
// Deprecated: See EndpointResolverWithOptions
type EndpointResolver interface {
ResolveEndpoint(service, region string) (Endpoint, error)
}

// EndpointResolverFunc wraps a function to satisfy the EndpointResolver interface.
//
// Deprecated: See EndpointResolverWithOptionsFunc
type EndpointResolverFunc func(service, region string) (Endpoint, error)

// ResolveEndpoint calls the wrapped function and returns the results.
//
// Deprecated: See EndpointResolverWithOptions.ResolveEndpoint
func (e EndpointResolverFunc) ResolveEndpoint(service, region string) (Endpoint, error) {
return e(service, region)
}

// EndpointResolverWithOptions is an endpoint resolver that can be used to provide or
// override an endpoint for the given service, region, and the service clients EndpointOptions. API clients will
// attempt to use the EndpointResolver first to resolve an endpoint if
// available. If the EndpointResolver returns an EndpointNotFoundError error,
// override an endpoint for the given service, region, and the service client's EndpointOptions. API clients will
// attempt to use the EndpointResolverWithOptions first to resolve an endpoint if
// available. If the EndpointResolverWithOptions returns an EndpointNotFoundError error,
// API clients will fallback to attempting to resolve the endpoint using its
// internal default endpoint resolver.
type EndpointResolverWithOptions interface {
Expand Down