From c7357bb31076e6e6d59faa8d1b93746ef051d066 Mon Sep 17 00:00:00 2001 From: Luc Talatinian <102624213+lucix-aws@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:08:33 -0500 Subject: [PATCH] fix: reinstate presence of retryer when functional opts run but still respect max attempts set therein (#2420) --- .../3678282d88fa4578a5345036a6ef377c.json | 388 ++++++++++++++++++ .../aws/go/codegen/AddAwsConfigFields.java | 41 +- config/shared_config_test.go | 4 +- .../protocoltest/awsrestjson/api_client.go | 16 +- .../awsrestjson/api_client_test.go | 4 + internal/protocoltest/awsrestjson/options.go | 8 +- internal/protocoltest/ec2query/api_client.go | 16 +- .../protocoltest/ec2query/api_client_test.go | 4 + internal/protocoltest/ec2query/options.go | 8 +- internal/protocoltest/jsonrpc/api_client.go | 16 +- .../protocoltest/jsonrpc/api_client_test.go | 4 + internal/protocoltest/jsonrpc/options.go | 8 +- internal/protocoltest/jsonrpc10/api_client.go | 16 +- .../protocoltest/jsonrpc10/api_client_test.go | 4 + internal/protocoltest/jsonrpc10/options.go | 8 +- internal/protocoltest/query/api_client.go | 16 +- .../protocoltest/query/api_client_test.go | 4 + internal/protocoltest/query/options.go | 8 +- internal/protocoltest/restxml/api_client.go | 16 +- .../protocoltest/restxml/api_client_test.go | 4 + internal/protocoltest/restxml/options.go | 8 +- .../restxmlwithnamespace/api_client.go | 16 +- .../restxmlwithnamespace/api_client_test.go | 4 + .../restxmlwithnamespace/options.go | 8 +- service/accessanalyzer/api_client.go | 16 +- service/accessanalyzer/api_client_test.go | 4 + service/accessanalyzer/options.go | 8 +- service/account/api_client.go | 16 +- service/account/api_client_test.go | 4 + service/account/options.go | 8 +- service/acm/api_client.go | 16 +- service/acm/api_client_test.go | 4 + service/acm/options.go | 8 +- service/acmpca/api_client.go | 16 +- service/acmpca/api_client_test.go | 4 + service/acmpca/options.go | 8 +- service/alexaforbusiness/api_client.go | 16 +- service/alexaforbusiness/api_client_test.go | 4 + service/alexaforbusiness/options.go | 8 +- service/amp/api_client.go | 16 +- service/amp/api_client_test.go | 4 + service/amp/options.go | 8 +- service/amplify/api_client.go | 16 +- service/amplify/api_client_test.go | 4 + service/amplify/options.go | 8 +- service/amplifybackend/api_client.go | 16 +- service/amplifybackend/api_client_test.go | 4 + service/amplifybackend/options.go | 8 +- service/amplifyuibuilder/api_client.go | 16 +- service/amplifyuibuilder/api_client_test.go | 4 + service/amplifyuibuilder/options.go | 8 +- service/apigateway/api_client.go | 16 +- service/apigateway/api_client_test.go | 4 + service/apigateway/options.go | 8 +- service/apigatewaymanagementapi/api_client.go | 16 +- .../api_client_test.go | 4 + service/apigatewaymanagementapi/options.go | 8 +- service/apigatewayv2/api_client.go | 16 +- service/apigatewayv2/api_client_test.go | 4 + service/apigatewayv2/options.go | 8 +- service/appconfig/api_client.go | 16 +- service/appconfig/api_client_test.go | 4 + service/appconfig/options.go | 8 +- service/appconfigdata/api_client.go | 16 +- service/appconfigdata/api_client_test.go | 4 + service/appconfigdata/options.go | 8 +- service/appfabric/api_client.go | 16 +- service/appfabric/api_client_test.go | 4 + service/appfabric/options.go | 8 +- service/appflow/api_client.go | 16 +- service/appflow/api_client_test.go | 4 + service/appflow/options.go | 8 +- service/appintegrations/api_client.go | 16 +- service/appintegrations/api_client_test.go | 4 + service/appintegrations/options.go | 8 +- service/applicationautoscaling/api_client.go | 16 +- .../applicationautoscaling/api_client_test.go | 4 + service/applicationautoscaling/options.go | 8 +- service/applicationcostprofiler/api_client.go | 16 +- .../api_client_test.go | 4 + service/applicationcostprofiler/options.go | 8 +- .../applicationdiscoveryservice/api_client.go | 16 +- .../api_client_test.go | 4 + .../applicationdiscoveryservice/options.go | 8 +- service/applicationinsights/api_client.go | 16 +- .../applicationinsights/api_client_test.go | 4 + service/applicationinsights/options.go | 8 +- service/appmesh/api_client.go | 16 +- service/appmesh/api_client_test.go | 4 + service/appmesh/options.go | 8 +- service/apprunner/api_client.go | 16 +- service/apprunner/api_client_test.go | 4 + service/apprunner/options.go | 8 +- service/appstream/api_client.go | 16 +- service/appstream/api_client_test.go | 4 + service/appstream/options.go | 8 +- service/appsync/api_client.go | 16 +- service/appsync/api_client_test.go | 4 + service/appsync/options.go | 8 +- service/arczonalshift/api_client.go | 16 +- service/arczonalshift/api_client_test.go | 4 + service/arczonalshift/options.go | 8 +- service/athena/api_client.go | 16 +- service/athena/api_client_test.go | 4 + service/athena/options.go | 8 +- service/auditmanager/api_client.go | 16 +- service/auditmanager/api_client_test.go | 4 + service/auditmanager/options.go | 8 +- service/autoscaling/api_client.go | 16 +- service/autoscaling/api_client_test.go | 4 + service/autoscaling/options.go | 8 +- service/autoscalingplans/api_client.go | 16 +- service/autoscalingplans/api_client_test.go | 4 + service/autoscalingplans/options.go | 8 +- service/b2bi/api_client.go | 16 +- service/b2bi/api_client_test.go | 4 + service/b2bi/options.go | 8 +- service/backup/api_client.go | 16 +- service/backup/api_client_test.go | 4 + service/backup/options.go | 8 +- service/backupgateway/api_client.go | 16 +- service/backupgateway/api_client_test.go | 4 + service/backupgateway/options.go | 8 +- service/backupstorage/api_client.go | 16 +- service/backupstorage/api_client_test.go | 4 + service/backupstorage/options.go | 8 +- service/batch/api_client.go | 16 +- service/batch/api_client_test.go | 4 + service/batch/options.go | 8 +- service/bcmdataexports/api_client.go | 16 +- service/bcmdataexports/api_client_test.go | 4 + service/bcmdataexports/options.go | 8 +- service/bedrock/api_client.go | 16 +- service/bedrock/api_client_test.go | 4 + service/bedrock/options.go | 8 +- service/bedrockagent/api_client.go | 16 +- service/bedrockagent/api_client_test.go | 4 + service/bedrockagent/options.go | 8 +- service/bedrockagentruntime/api_client.go | 16 +- .../bedrockagentruntime/api_client_test.go | 4 + service/bedrockagentruntime/options.go | 8 +- service/bedrockruntime/api_client.go | 16 +- service/bedrockruntime/api_client_test.go | 4 + service/bedrockruntime/options.go | 8 +- service/billingconductor/api_client.go | 16 +- service/billingconductor/api_client_test.go | 4 + service/billingconductor/options.go | 8 +- service/braket/api_client.go | 16 +- service/braket/api_client_test.go | 4 + service/braket/options.go | 8 +- service/budgets/api_client.go | 16 +- service/budgets/api_client_test.go | 4 + service/budgets/options.go | 8 +- service/chime/api_client.go | 16 +- service/chime/api_client_test.go | 4 + service/chime/options.go | 8 +- service/chimesdkidentity/api_client.go | 16 +- service/chimesdkidentity/api_client_test.go | 4 + service/chimesdkidentity/options.go | 8 +- service/chimesdkmediapipelines/api_client.go | 16 +- .../chimesdkmediapipelines/api_client_test.go | 4 + service/chimesdkmediapipelines/options.go | 8 +- service/chimesdkmeetings/api_client.go | 16 +- service/chimesdkmeetings/api_client_test.go | 4 + service/chimesdkmeetings/options.go | 8 +- service/chimesdkmessaging/api_client.go | 16 +- service/chimesdkmessaging/api_client_test.go | 4 + service/chimesdkmessaging/options.go | 8 +- service/chimesdkvoice/api_client.go | 16 +- service/chimesdkvoice/api_client_test.go | 4 + service/chimesdkvoice/options.go | 8 +- service/cleanrooms/api_client.go | 16 +- service/cleanrooms/api_client_test.go | 4 + service/cleanrooms/options.go | 8 +- service/cleanroomsml/api_client.go | 16 +- service/cleanroomsml/api_client_test.go | 4 + service/cleanroomsml/options.go | 8 +- service/cloud9/api_client.go | 16 +- service/cloud9/api_client_test.go | 4 + service/cloud9/options.go | 8 +- service/cloudcontrol/api_client.go | 16 +- service/cloudcontrol/api_client_test.go | 4 + service/cloudcontrol/options.go | 8 +- service/clouddirectory/api_client.go | 16 +- service/clouddirectory/api_client_test.go | 4 + service/clouddirectory/options.go | 8 +- service/cloudformation/api_client.go | 16 +- service/cloudformation/api_client_test.go | 4 + service/cloudformation/options.go | 8 +- service/cloudfront/api_client.go | 16 +- service/cloudfront/api_client_test.go | 4 + service/cloudfront/options.go | 8 +- service/cloudfrontkeyvaluestore/api_client.go | 16 +- .../api_client_test.go | 4 + service/cloudfrontkeyvaluestore/options.go | 8 +- service/cloudhsm/api_client.go | 16 +- service/cloudhsm/api_client_test.go | 4 + service/cloudhsm/options.go | 8 +- service/cloudhsmv2/api_client.go | 16 +- service/cloudhsmv2/api_client_test.go | 4 + service/cloudhsmv2/options.go | 8 +- service/cloudsearch/api_client.go | 16 +- service/cloudsearch/api_client_test.go | 4 + service/cloudsearch/options.go | 8 +- service/cloudsearchdomain/api_client.go | 16 +- service/cloudsearchdomain/api_client_test.go | 4 + service/cloudsearchdomain/options.go | 8 +- service/cloudtrail/api_client.go | 16 +- service/cloudtrail/api_client_test.go | 4 + service/cloudtrail/options.go | 8 +- service/cloudtraildata/api_client.go | 16 +- service/cloudtraildata/api_client_test.go | 4 + service/cloudtraildata/options.go | 8 +- service/cloudwatch/api_client.go | 16 +- service/cloudwatch/api_client_test.go | 4 + service/cloudwatch/options.go | 8 +- service/cloudwatchevents/api_client.go | 16 +- service/cloudwatchevents/api_client_test.go | 4 + service/cloudwatchevents/options.go | 8 +- service/cloudwatchlogs/api_client.go | 16 +- service/cloudwatchlogs/api_client_test.go | 4 + service/cloudwatchlogs/options.go | 8 +- service/codeartifact/api_client.go | 16 +- service/codeartifact/api_client_test.go | 4 + service/codeartifact/options.go | 8 +- service/codebuild/api_client.go | 16 +- service/codebuild/api_client_test.go | 4 + service/codebuild/options.go | 8 +- service/codecatalyst/api_client.go | 16 +- service/codecatalyst/api_client_test.go | 4 + service/codecatalyst/options.go | 8 +- service/codecommit/api_client.go | 16 +- service/codecommit/api_client_test.go | 4 + service/codecommit/options.go | 8 +- service/codedeploy/api_client.go | 16 +- service/codedeploy/api_client_test.go | 4 + service/codedeploy/options.go | 8 +- service/codeguruprofiler/api_client.go | 16 +- service/codeguruprofiler/api_client_test.go | 4 + service/codeguruprofiler/options.go | 8 +- service/codegurureviewer/api_client.go | 16 +- service/codegurureviewer/api_client_test.go | 4 + service/codegurureviewer/options.go | 8 +- service/codegurusecurity/api_client.go | 16 +- service/codegurusecurity/api_client_test.go | 4 + service/codegurusecurity/options.go | 8 +- service/codepipeline/api_client.go | 16 +- service/codepipeline/api_client_test.go | 4 + service/codepipeline/options.go | 8 +- service/codestar/api_client.go | 16 +- service/codestar/api_client_test.go | 4 + service/codestar/options.go | 8 +- service/codestarconnections/api_client.go | 16 +- .../codestarconnections/api_client_test.go | 4 + service/codestarconnections/options.go | 8 +- service/codestarnotifications/api_client.go | 16 +- .../codestarnotifications/api_client_test.go | 4 + service/codestarnotifications/options.go | 8 +- service/cognitoidentity/api_client.go | 16 +- service/cognitoidentity/api_client_test.go | 4 + service/cognitoidentity/options.go | 8 +- service/cognitoidentityprovider/api_client.go | 16 +- .../api_client_test.go | 4 + service/cognitoidentityprovider/options.go | 8 +- service/cognitosync/api_client.go | 16 +- service/cognitosync/api_client_test.go | 4 + service/cognitosync/options.go | 8 +- service/comprehend/api_client.go | 16 +- service/comprehend/api_client_test.go | 4 + service/comprehend/options.go | 8 +- service/comprehendmedical/api_client.go | 16 +- service/comprehendmedical/api_client_test.go | 4 + service/comprehendmedical/options.go | 8 +- service/computeoptimizer/api_client.go | 16 +- service/computeoptimizer/api_client_test.go | 4 + service/computeoptimizer/options.go | 8 +- service/configservice/api_client.go | 16 +- service/configservice/api_client_test.go | 4 + service/configservice/options.go | 8 +- service/connect/api_client.go | 16 +- service/connect/api_client_test.go | 4 + service/connect/options.go | 8 +- service/connectcampaigns/api_client.go | 16 +- service/connectcampaigns/api_client_test.go | 4 + service/connectcampaigns/options.go | 8 +- service/connectcases/api_client.go | 16 +- service/connectcases/api_client_test.go | 4 + service/connectcases/options.go | 8 +- service/connectcontactlens/api_client.go | 16 +- service/connectcontactlens/api_client_test.go | 4 + service/connectcontactlens/options.go | 8 +- service/connectparticipant/api_client.go | 16 +- service/connectparticipant/api_client_test.go | 4 + service/connectparticipant/options.go | 8 +- service/controltower/api_client.go | 16 +- service/controltower/api_client_test.go | 4 + service/controltower/options.go | 8 +- .../costandusagereportservice/api_client.go | 16 +- .../api_client_test.go | 4 + service/costandusagereportservice/options.go | 8 +- service/costexplorer/api_client.go | 16 +- service/costexplorer/api_client_test.go | 4 + service/costexplorer/options.go | 8 +- service/costoptimizationhub/api_client.go | 16 +- .../costoptimizationhub/api_client_test.go | 4 + service/costoptimizationhub/options.go | 8 +- service/customerprofiles/api_client.go | 16 +- service/customerprofiles/api_client_test.go | 4 + service/customerprofiles/options.go | 8 +- .../databasemigrationservice/api_client.go | 16 +- .../api_client_test.go | 4 + service/databasemigrationservice/options.go | 8 +- service/databrew/api_client.go | 16 +- service/databrew/api_client_test.go | 4 + service/databrew/options.go | 8 +- service/dataexchange/api_client.go | 16 +- service/dataexchange/api_client_test.go | 4 + service/dataexchange/options.go | 8 +- service/datapipeline/api_client.go | 16 +- service/datapipeline/api_client_test.go | 4 + service/datapipeline/options.go | 8 +- service/datasync/api_client.go | 16 +- service/datasync/api_client_test.go | 4 + service/datasync/options.go | 8 +- service/datazone/api_client.go | 16 +- service/datazone/api_client_test.go | 4 + service/datazone/options.go | 8 +- service/dax/api_client.go | 16 +- service/dax/api_client_test.go | 4 + service/dax/options.go | 8 +- service/detective/api_client.go | 16 +- service/detective/api_client_test.go | 4 + service/detective/options.go | 8 +- service/devicefarm/api_client.go | 16 +- service/devicefarm/api_client_test.go | 4 + service/devicefarm/options.go | 8 +- service/devopsguru/api_client.go | 16 +- service/devopsguru/api_client_test.go | 4 + service/devopsguru/options.go | 8 +- service/directconnect/api_client.go | 16 +- service/directconnect/api_client_test.go | 4 + service/directconnect/options.go | 8 +- service/directoryservice/api_client.go | 16 +- service/directoryservice/api_client_test.go | 4 + service/directoryservice/options.go | 8 +- service/dlm/api_client.go | 16 +- service/dlm/api_client_test.go | 4 + service/dlm/options.go | 8 +- service/docdb/api_client.go | 16 +- service/docdb/api_client_test.go | 4 + service/docdb/options.go | 8 +- service/docdbelastic/api_client.go | 16 +- service/docdbelastic/api_client_test.go | 4 + service/docdbelastic/options.go | 8 +- service/drs/api_client.go | 16 +- service/drs/api_client_test.go | 4 + service/drs/options.go | 8 +- service/dynamodb/api_client.go | 16 +- service/dynamodb/api_client_test.go | 4 + service/dynamodb/options.go | 8 +- service/dynamodbstreams/api_client.go | 16 +- service/dynamodbstreams/api_client_test.go | 4 + service/dynamodbstreams/options.go | 8 +- service/ebs/api_client.go | 16 +- service/ebs/api_client_test.go | 4 + service/ebs/options.go | 8 +- service/ec2/api_client.go | 16 +- service/ec2/api_client_test.go | 4 + service/ec2/options.go | 8 +- service/ec2instanceconnect/api_client.go | 16 +- service/ec2instanceconnect/api_client_test.go | 4 + service/ec2instanceconnect/options.go | 8 +- service/ecr/api_client.go | 16 +- service/ecr/api_client_test.go | 4 + service/ecr/options.go | 8 +- service/ecrpublic/api_client.go | 16 +- service/ecrpublic/api_client_test.go | 4 + service/ecrpublic/options.go | 8 +- service/ecs/api_client.go | 16 +- service/ecs/api_client_test.go | 4 + service/ecs/options.go | 8 +- service/efs/api_client.go | 16 +- service/efs/api_client_test.go | 4 + service/efs/options.go | 8 +- service/eks/api_client.go | 16 +- service/eks/api_client_test.go | 4 + service/eks/options.go | 8 +- service/eksauth/api_client.go | 16 +- service/eksauth/api_client_test.go | 4 + service/eksauth/options.go | 8 +- service/elasticache/api_client.go | 16 +- service/elasticache/api_client_test.go | 4 + service/elasticache/options.go | 8 +- service/elasticbeanstalk/api_client.go | 16 +- service/elasticbeanstalk/api_client_test.go | 4 + service/elasticbeanstalk/options.go | 8 +- service/elasticinference/api_client.go | 16 +- service/elasticinference/api_client_test.go | 4 + service/elasticinference/options.go | 8 +- service/elasticloadbalancing/api_client.go | 16 +- .../elasticloadbalancing/api_client_test.go | 4 + service/elasticloadbalancing/options.go | 8 +- service/elasticloadbalancingv2/api_client.go | 16 +- .../elasticloadbalancingv2/api_client_test.go | 4 + service/elasticloadbalancingv2/options.go | 8 +- service/elasticsearchservice/api_client.go | 16 +- .../elasticsearchservice/api_client_test.go | 4 + service/elasticsearchservice/options.go | 8 +- service/elastictranscoder/api_client.go | 16 +- service/elastictranscoder/api_client_test.go | 4 + service/elastictranscoder/options.go | 8 +- service/emr/api_client.go | 16 +- service/emr/api_client_test.go | 4 + service/emr/options.go | 8 +- service/emrcontainers/api_client.go | 16 +- service/emrcontainers/api_client_test.go | 4 + service/emrcontainers/options.go | 8 +- service/emrserverless/api_client.go | 16 +- service/emrserverless/api_client_test.go | 4 + service/emrserverless/options.go | 8 +- service/entityresolution/api_client.go | 16 +- service/entityresolution/api_client_test.go | 4 + service/entityresolution/options.go | 8 +- service/eventbridge/api_client.go | 16 +- service/eventbridge/api_client_test.go | 4 + service/eventbridge/options.go | 8 +- service/evidently/api_client.go | 16 +- service/evidently/api_client_test.go | 4 + service/evidently/options.go | 8 +- service/finspace/api_client.go | 16 +- service/finspace/api_client_test.go | 4 + service/finspace/options.go | 8 +- service/finspacedata/api_client.go | 16 +- service/finspacedata/api_client_test.go | 4 + service/finspacedata/options.go | 8 +- service/firehose/api_client.go | 16 +- service/firehose/api_client_test.go | 4 + service/firehose/options.go | 8 +- service/fis/api_client.go | 16 +- service/fis/api_client_test.go | 4 + service/fis/options.go | 8 +- service/fms/api_client.go | 16 +- service/fms/api_client_test.go | 4 + service/fms/options.go | 8 +- service/forecast/api_client.go | 16 +- service/forecast/api_client_test.go | 4 + service/forecast/options.go | 8 +- service/forecastquery/api_client.go | 16 +- service/forecastquery/api_client_test.go | 4 + service/forecastquery/options.go | 8 +- service/frauddetector/api_client.go | 16 +- service/frauddetector/api_client_test.go | 4 + service/frauddetector/options.go | 8 +- service/freetier/api_client.go | 16 +- service/freetier/api_client_test.go | 4 + service/freetier/options.go | 8 +- service/fsx/api_client.go | 16 +- service/fsx/api_client_test.go | 4 + service/fsx/options.go | 8 +- service/gamelift/api_client.go | 16 +- service/gamelift/api_client_test.go | 4 + service/gamelift/options.go | 8 +- service/glacier/api_client.go | 16 +- service/glacier/api_client_test.go | 4 + service/glacier/options.go | 8 +- service/globalaccelerator/api_client.go | 16 +- service/globalaccelerator/api_client_test.go | 4 + service/globalaccelerator/options.go | 8 +- service/glue/api_client.go | 16 +- service/glue/api_client_test.go | 4 + service/glue/options.go | 8 +- service/grafana/api_client.go | 16 +- service/grafana/api_client_test.go | 4 + service/grafana/options.go | 8 +- service/greengrass/api_client.go | 16 +- service/greengrass/api_client_test.go | 4 + service/greengrass/options.go | 8 +- service/greengrassv2/api_client.go | 16 +- service/greengrassv2/api_client_test.go | 4 + service/greengrassv2/options.go | 8 +- service/groundstation/api_client.go | 16 +- service/groundstation/api_client_test.go | 4 + service/groundstation/options.go | 8 +- service/guardduty/api_client.go | 16 +- service/guardduty/api_client_test.go | 4 + service/guardduty/options.go | 8 +- service/health/api_client.go | 16 +- service/health/api_client_test.go | 4 + service/health/options.go | 8 +- service/healthlake/api_client.go | 16 +- service/healthlake/api_client_test.go | 4 + service/healthlake/options.go | 8 +- service/honeycode/api_client.go | 16 +- service/honeycode/api_client_test.go | 4 + service/honeycode/options.go | 8 +- service/iam/api_client.go | 16 +- service/iam/api_client_test.go | 4 + service/iam/options.go | 8 +- service/identitystore/api_client.go | 16 +- service/identitystore/api_client_test.go | 4 + service/identitystore/options.go | 8 +- service/imagebuilder/api_client.go | 16 +- service/imagebuilder/api_client_test.go | 4 + service/imagebuilder/options.go | 8 +- service/inspector/api_client.go | 16 +- service/inspector/api_client_test.go | 4 + service/inspector/options.go | 8 +- service/inspector2/api_client.go | 16 +- service/inspector2/api_client_test.go | 4 + service/inspector2/options.go | 8 +- service/inspectorscan/api_client.go | 16 +- service/inspectorscan/api_client_test.go | 4 + service/inspectorscan/options.go | 8 +- service/internetmonitor/api_client.go | 16 +- service/internetmonitor/api_client_test.go | 4 + service/internetmonitor/options.go | 8 +- service/iot/api_client.go | 16 +- service/iot/api_client_test.go | 4 + service/iot/options.go | 8 +- service/iot1clickdevicesservice/api_client.go | 16 +- .../api_client_test.go | 4 + service/iot1clickdevicesservice/options.go | 8 +- service/iot1clickprojects/api_client.go | 16 +- service/iot1clickprojects/api_client_test.go | 4 + service/iot1clickprojects/options.go | 8 +- service/iotanalytics/api_client.go | 16 +- service/iotanalytics/api_client_test.go | 4 + service/iotanalytics/options.go | 8 +- service/iotdataplane/api_client.go | 16 +- service/iotdataplane/api_client_test.go | 4 + service/iotdataplane/options.go | 8 +- service/iotdeviceadvisor/api_client.go | 16 +- service/iotdeviceadvisor/api_client_test.go | 4 + service/iotdeviceadvisor/options.go | 8 +- service/iotevents/api_client.go | 16 +- service/iotevents/api_client_test.go | 4 + service/iotevents/options.go | 8 +- service/ioteventsdata/api_client.go | 16 +- service/ioteventsdata/api_client_test.go | 4 + service/ioteventsdata/options.go | 8 +- service/iotfleethub/api_client.go | 16 +- service/iotfleethub/api_client_test.go | 4 + service/iotfleethub/options.go | 8 +- service/iotfleetwise/api_client.go | 16 +- service/iotfleetwise/api_client_test.go | 4 + service/iotfleetwise/options.go | 8 +- service/iotjobsdataplane/api_client.go | 16 +- service/iotjobsdataplane/api_client_test.go | 4 + service/iotjobsdataplane/options.go | 8 +- service/iotroborunner/api_client.go | 16 +- service/iotroborunner/api_client_test.go | 4 + service/iotroborunner/options.go | 8 +- service/iotsecuretunneling/api_client.go | 16 +- service/iotsecuretunneling/api_client_test.go | 4 + service/iotsecuretunneling/options.go | 8 +- service/iotsitewise/api_client.go | 16 +- service/iotsitewise/api_client_test.go | 4 + service/iotsitewise/options.go | 8 +- service/iotthingsgraph/api_client.go | 16 +- service/iotthingsgraph/api_client_test.go | 4 + service/iotthingsgraph/options.go | 8 +- service/iottwinmaker/api_client.go | 16 +- service/iottwinmaker/api_client_test.go | 4 + service/iottwinmaker/options.go | 8 +- service/iotwireless/api_client.go | 16 +- service/iotwireless/api_client_test.go | 4 + service/iotwireless/options.go | 8 +- service/ivs/api_client.go | 16 +- service/ivs/api_client_test.go | 4 + service/ivs/options.go | 8 +- service/ivschat/api_client.go | 16 +- service/ivschat/api_client_test.go | 4 + service/ivschat/options.go | 8 +- service/ivsrealtime/api_client.go | 16 +- service/ivsrealtime/api_client_test.go | 4 + service/ivsrealtime/options.go | 8 +- service/kafka/api_client.go | 16 +- service/kafka/api_client_test.go | 4 + service/kafka/options.go | 8 +- service/kafkaconnect/api_client.go | 16 +- service/kafkaconnect/api_client_test.go | 4 + service/kafkaconnect/options.go | 8 +- service/kendra/api_client.go | 16 +- service/kendra/api_client_test.go | 4 + service/kendra/options.go | 8 +- service/kendraranking/api_client.go | 16 +- service/kendraranking/api_client_test.go | 4 + service/kendraranking/options.go | 8 +- service/keyspaces/api_client.go | 16 +- service/keyspaces/api_client_test.go | 4 + service/keyspaces/options.go | 8 +- service/kinesis/api_client.go | 16 +- service/kinesis/api_client_test.go | 4 + service/kinesis/options.go | 8 +- service/kinesisanalytics/api_client.go | 16 +- service/kinesisanalytics/api_client_test.go | 4 + service/kinesisanalytics/options.go | 8 +- service/kinesisanalyticsv2/api_client.go | 16 +- service/kinesisanalyticsv2/api_client_test.go | 4 + service/kinesisanalyticsv2/options.go | 8 +- service/kinesisvideo/api_client.go | 16 +- service/kinesisvideo/api_client_test.go | 4 + service/kinesisvideo/options.go | 8 +- .../kinesisvideoarchivedmedia/api_client.go | 16 +- .../api_client_test.go | 4 + service/kinesisvideoarchivedmedia/options.go | 8 +- service/kinesisvideomedia/api_client.go | 16 +- service/kinesisvideomedia/api_client_test.go | 4 + service/kinesisvideomedia/options.go | 8 +- service/kinesisvideosignaling/api_client.go | 16 +- .../kinesisvideosignaling/api_client_test.go | 4 + service/kinesisvideosignaling/options.go | 8 +- .../kinesisvideowebrtcstorage/api_client.go | 16 +- .../api_client_test.go | 4 + service/kinesisvideowebrtcstorage/options.go | 8 +- service/kms/api_client.go | 16 +- service/kms/api_client_test.go | 4 + service/kms/options.go | 8 +- service/lakeformation/api_client.go | 16 +- service/lakeformation/api_client_test.go | 4 + service/lakeformation/options.go | 8 +- service/lambda/api_client.go | 16 +- service/lambda/api_client_test.go | 4 + service/lambda/options.go | 8 +- service/launchwizard/api_client.go | 16 +- service/launchwizard/api_client_test.go | 4 + service/launchwizard/options.go | 8 +- service/lexmodelbuildingservice/api_client.go | 16 +- .../api_client_test.go | 4 + service/lexmodelbuildingservice/options.go | 8 +- service/lexmodelsv2/api_client.go | 16 +- service/lexmodelsv2/api_client_test.go | 4 + service/lexmodelsv2/options.go | 8 +- service/lexruntimeservice/api_client.go | 16 +- service/lexruntimeservice/api_client_test.go | 4 + service/lexruntimeservice/options.go | 8 +- service/lexruntimev2/api_client.go | 16 +- service/lexruntimev2/api_client_test.go | 4 + service/lexruntimev2/options.go | 8 +- service/licensemanager/api_client.go | 16 +- service/licensemanager/api_client_test.go | 4 + service/licensemanager/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../options.go | 8 +- service/lightsail/api_client.go | 16 +- service/lightsail/api_client_test.go | 4 + service/lightsail/options.go | 8 +- service/location/api_client.go | 16 +- service/location/api_client_test.go | 4 + service/location/options.go | 8 +- service/lookoutequipment/api_client.go | 16 +- service/lookoutequipment/api_client_test.go | 4 + service/lookoutequipment/options.go | 8 +- service/lookoutmetrics/api_client.go | 16 +- service/lookoutmetrics/api_client_test.go | 4 + service/lookoutmetrics/options.go | 8 +- service/lookoutvision/api_client.go | 16 +- service/lookoutvision/api_client_test.go | 4 + service/lookoutvision/options.go | 8 +- service/m2/api_client.go | 16 +- service/m2/api_client_test.go | 4 + service/m2/options.go | 8 +- service/machinelearning/api_client.go | 16 +- service/machinelearning/api_client_test.go | 4 + service/machinelearning/options.go | 8 +- service/macie2/api_client.go | 16 +- service/macie2/api_client_test.go | 4 + service/macie2/options.go | 8 +- service/managedblockchain/api_client.go | 16 +- service/managedblockchain/api_client_test.go | 4 + service/managedblockchain/options.go | 8 +- service/managedblockchainquery/api_client.go | 16 +- .../managedblockchainquery/api_client_test.go | 4 + service/managedblockchainquery/options.go | 8 +- service/marketplaceagreement/api_client.go | 16 +- .../marketplaceagreement/api_client_test.go | 4 + service/marketplaceagreement/options.go | 8 +- service/marketplacecatalog/api_client.go | 16 +- service/marketplacecatalog/api_client_test.go | 4 + service/marketplacecatalog/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../marketplacecommerceanalytics/options.go | 8 +- service/marketplacedeployment/api_client.go | 16 +- .../marketplacedeployment/api_client_test.go | 4 + service/marketplacedeployment/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../marketplaceentitlementservice/options.go | 8 +- service/marketplacemetering/api_client.go | 16 +- .../marketplacemetering/api_client_test.go | 4 + service/marketplacemetering/options.go | 8 +- service/mediaconnect/api_client.go | 16 +- service/mediaconnect/api_client_test.go | 4 + service/mediaconnect/options.go | 8 +- service/mediaconvert/api_client.go | 16 +- service/mediaconvert/api_client_test.go | 4 + service/mediaconvert/options.go | 8 +- service/medialive/api_client.go | 16 +- service/medialive/api_client_test.go | 4 + service/medialive/options.go | 8 +- service/mediapackage/api_client.go | 16 +- service/mediapackage/api_client_test.go | 4 + service/mediapackage/options.go | 8 +- service/mediapackagev2/api_client.go | 16 +- service/mediapackagev2/api_client_test.go | 4 + service/mediapackagev2/options.go | 8 +- service/mediapackagevod/api_client.go | 16 +- service/mediapackagevod/api_client_test.go | 4 + service/mediapackagevod/options.go | 8 +- service/mediastore/api_client.go | 16 +- service/mediastore/api_client_test.go | 4 + service/mediastore/options.go | 8 +- service/mediastoredata/api_client.go | 16 +- service/mediastoredata/api_client_test.go | 4 + service/mediastoredata/options.go | 8 +- service/mediatailor/api_client.go | 16 +- service/mediatailor/api_client_test.go | 4 + service/mediatailor/options.go | 8 +- service/medicalimaging/api_client.go | 16 +- service/medicalimaging/api_client_test.go | 4 + service/medicalimaging/options.go | 8 +- service/memorydb/api_client.go | 16 +- service/memorydb/api_client_test.go | 4 + service/memorydb/options.go | 8 +- service/mgn/api_client.go | 16 +- service/mgn/api_client_test.go | 4 + service/mgn/options.go | 8 +- service/migrationhub/api_client.go | 16 +- service/migrationhub/api_client_test.go | 4 + service/migrationhub/options.go | 8 +- service/migrationhubconfig/api_client.go | 16 +- service/migrationhubconfig/api_client_test.go | 4 + service/migrationhubconfig/options.go | 8 +- .../migrationhuborchestrator/api_client.go | 16 +- .../api_client_test.go | 4 + service/migrationhuborchestrator/options.go | 8 +- .../migrationhubrefactorspaces/api_client.go | 16 +- .../api_client_test.go | 4 + service/migrationhubrefactorspaces/options.go | 8 +- service/migrationhubstrategy/api_client.go | 16 +- .../migrationhubstrategy/api_client_test.go | 4 + service/migrationhubstrategy/options.go | 8 +- service/mobile/api_client.go | 16 +- service/mobile/api_client_test.go | 4 + service/mobile/options.go | 8 +- service/mq/api_client.go | 16 +- service/mq/api_client_test.go | 4 + service/mq/options.go | 8 +- service/mturk/api_client.go | 16 +- service/mturk/api_client_test.go | 4 + service/mturk/options.go | 8 +- service/mwaa/api_client.go | 16 +- service/mwaa/api_client_test.go | 4 + service/mwaa/options.go | 8 +- service/neptune/api_client.go | 16 +- service/neptune/api_client_test.go | 4 + service/neptune/options.go | 8 +- service/neptunedata/api_client.go | 16 +- service/neptunedata/api_client_test.go | 4 + service/neptunedata/options.go | 8 +- service/networkfirewall/api_client.go | 16 +- service/networkfirewall/api_client_test.go | 4 + service/networkfirewall/options.go | 8 +- service/networkmanager/api_client.go | 16 +- service/networkmanager/api_client_test.go | 4 + service/networkmanager/options.go | 8 +- service/nimble/api_client.go | 16 +- service/nimble/api_client_test.go | 4 + service/nimble/options.go | 8 +- service/oam/api_client.go | 16 +- service/oam/api_client_test.go | 4 + service/oam/options.go | 8 +- service/omics/api_client.go | 16 +- service/omics/api_client_test.go | 4 + service/omics/options.go | 8 +- service/opensearch/api_client.go | 16 +- service/opensearch/api_client_test.go | 4 + service/opensearch/options.go | 8 +- service/opensearchserverless/api_client.go | 16 +- .../opensearchserverless/api_client_test.go | 4 + service/opensearchserverless/options.go | 8 +- service/opsworks/api_client.go | 16 +- service/opsworks/api_client_test.go | 4 + service/opsworks/options.go | 8 +- service/opsworkscm/api_client.go | 16 +- service/opsworkscm/api_client_test.go | 4 + service/opsworkscm/options.go | 8 +- service/organizations/api_client.go | 16 +- service/organizations/api_client_test.go | 4 + service/organizations/options.go | 8 +- service/osis/api_client.go | 16 +- service/osis/api_client_test.go | 4 + service/osis/options.go | 8 +- service/outposts/api_client.go | 16 +- service/outposts/api_client_test.go | 4 + service/outposts/options.go | 8 +- service/panorama/api_client.go | 16 +- service/panorama/api_client_test.go | 4 + service/panorama/options.go | 8 +- service/paymentcryptography/api_client.go | 16 +- .../paymentcryptography/api_client_test.go | 4 + service/paymentcryptography/options.go | 8 +- service/paymentcryptographydata/api_client.go | 16 +- .../api_client_test.go | 4 + service/paymentcryptographydata/options.go | 8 +- service/pcaconnectorad/api_client.go | 16 +- service/pcaconnectorad/api_client_test.go | 4 + service/pcaconnectorad/options.go | 8 +- service/personalize/api_client.go | 16 +- service/personalize/api_client_test.go | 4 + service/personalize/options.go | 8 +- service/personalizeevents/api_client.go | 16 +- service/personalizeevents/api_client_test.go | 4 + service/personalizeevents/options.go | 8 +- service/personalizeruntime/api_client.go | 16 +- service/personalizeruntime/api_client_test.go | 4 + service/personalizeruntime/options.go | 8 +- service/pi/api_client.go | 16 +- service/pi/api_client_test.go | 4 + service/pi/options.go | 8 +- service/pinpoint/api_client.go | 16 +- service/pinpoint/api_client_test.go | 4 + service/pinpoint/options.go | 8 +- service/pinpointemail/api_client.go | 16 +- service/pinpointemail/api_client_test.go | 4 + service/pinpointemail/options.go | 8 +- service/pinpointsmsvoice/api_client.go | 16 +- service/pinpointsmsvoice/api_client_test.go | 4 + service/pinpointsmsvoice/options.go | 8 +- service/pinpointsmsvoicev2/api_client.go | 16 +- service/pinpointsmsvoicev2/api_client_test.go | 4 + service/pinpointsmsvoicev2/options.go | 8 +- service/pipes/api_client.go | 16 +- service/pipes/api_client_test.go | 4 + service/pipes/options.go | 8 +- service/polly/api_client.go | 16 +- service/polly/api_client_test.go | 4 + service/polly/options.go | 8 +- service/pricing/api_client.go | 16 +- service/pricing/api_client_test.go | 4 + service/pricing/options.go | 8 +- service/privatenetworks/api_client.go | 16 +- service/privatenetworks/api_client_test.go | 4 + service/privatenetworks/options.go | 8 +- service/proton/api_client.go | 16 +- service/proton/api_client_test.go | 4 + service/proton/options.go | 8 +- service/qbusiness/api_client.go | 16 +- service/qbusiness/api_client_test.go | 4 + service/qbusiness/options.go | 8 +- service/qconnect/api_client.go | 16 +- service/qconnect/api_client_test.go | 4 + service/qconnect/options.go | 8 +- service/qldb/api_client.go | 16 +- service/qldb/api_client_test.go | 4 + service/qldb/options.go | 8 +- service/qldbsession/api_client.go | 16 +- service/qldbsession/api_client_test.go | 4 + service/qldbsession/options.go | 8 +- service/quicksight/api_client.go | 16 +- service/quicksight/api_client_test.go | 4 + service/quicksight/options.go | 8 +- service/ram/api_client.go | 16 +- service/ram/api_client_test.go | 4 + service/ram/options.go | 8 +- service/rbin/api_client.go | 16 +- service/rbin/api_client_test.go | 4 + service/rbin/options.go | 8 +- service/rds/api_client.go | 16 +- service/rds/api_client_test.go | 4 + service/rds/options.go | 8 +- service/rdsdata/api_client.go | 16 +- service/rdsdata/api_client_test.go | 4 + service/rdsdata/options.go | 8 +- service/redshift/api_client.go | 16 +- service/redshift/api_client_test.go | 4 + service/redshift/options.go | 8 +- service/redshiftdata/api_client.go | 16 +- service/redshiftdata/api_client_test.go | 4 + service/redshiftdata/options.go | 8 +- service/redshiftserverless/api_client.go | 16 +- service/redshiftserverless/api_client_test.go | 4 + service/redshiftserverless/options.go | 8 +- service/rekognition/api_client.go | 16 +- service/rekognition/api_client_test.go | 4 + service/rekognition/options.go | 8 +- service/repostspace/api_client.go | 16 +- service/repostspace/api_client_test.go | 4 + service/repostspace/options.go | 8 +- service/resiliencehub/api_client.go | 16 +- service/resiliencehub/api_client_test.go | 4 + service/resiliencehub/options.go | 8 +- service/resourceexplorer2/api_client.go | 16 +- service/resourceexplorer2/api_client_test.go | 4 + service/resourceexplorer2/options.go | 8 +- service/resourcegroups/api_client.go | 16 +- service/resourcegroups/api_client_test.go | 4 + service/resourcegroups/options.go | 8 +- .../resourcegroupstaggingapi/api_client.go | 16 +- .../api_client_test.go | 4 + service/resourcegroupstaggingapi/options.go | 8 +- service/robomaker/api_client.go | 16 +- service/robomaker/api_client_test.go | 4 + service/robomaker/options.go | 8 +- service/rolesanywhere/api_client.go | 16 +- service/rolesanywhere/api_client_test.go | 4 + service/rolesanywhere/options.go | 8 +- service/route53/api_client.go | 16 +- service/route53/api_client_test.go | 4 + service/route53/options.go | 8 +- service/route53domains/api_client.go | 16 +- service/route53domains/api_client_test.go | 4 + service/route53domains/options.go | 8 +- service/route53recoverycluster/api_client.go | 16 +- .../route53recoverycluster/api_client_test.go | 4 + service/route53recoverycluster/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../route53recoverycontrolconfig/options.go | 8 +- .../route53recoveryreadiness/api_client.go | 16 +- .../api_client_test.go | 4 + service/route53recoveryreadiness/options.go | 8 +- service/route53resolver/api_client.go | 16 +- service/route53resolver/api_client_test.go | 4 + service/route53resolver/options.go | 8 +- service/rum/api_client.go | 16 +- service/rum/api_client_test.go | 4 + service/rum/options.go | 8 +- service/s3/api_client.go | 16 +- service/s3/api_client_test.go | 4 + service/s3/options.go | 8 +- service/s3control/api_client.go | 16 +- service/s3control/api_client_test.go | 4 + service/s3control/options.go | 8 +- service/s3outposts/api_client.go | 16 +- service/s3outposts/api_client_test.go | 4 + service/s3outposts/options.go | 8 +- service/sagemaker/api_client.go | 16 +- service/sagemaker/api_client_test.go | 4 + service/sagemaker/options.go | 8 +- service/sagemakera2iruntime/api_client.go | 16 +- .../sagemakera2iruntime/api_client_test.go | 4 + service/sagemakera2iruntime/options.go | 8 +- service/sagemakeredge/api_client.go | 16 +- service/sagemakeredge/api_client_test.go | 4 + service/sagemakeredge/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../sagemakerfeaturestoreruntime/options.go | 8 +- service/sagemakergeospatial/api_client.go | 16 +- .../sagemakergeospatial/api_client_test.go | 4 + service/sagemakergeospatial/options.go | 8 +- service/sagemakermetrics/api_client.go | 16 +- service/sagemakermetrics/api_client_test.go | 4 + service/sagemakermetrics/options.go | 8 +- service/sagemakerruntime/api_client.go | 16 +- service/sagemakerruntime/api_client_test.go | 4 + service/sagemakerruntime/options.go | 8 +- service/savingsplans/api_client.go | 16 +- service/savingsplans/api_client_test.go | 4 + service/savingsplans/options.go | 8 +- service/scheduler/api_client.go | 16 +- service/scheduler/api_client_test.go | 4 + service/scheduler/options.go | 8 +- service/schemas/api_client.go | 16 +- service/schemas/api_client_test.go | 4 + service/schemas/options.go | 8 +- service/secretsmanager/api_client.go | 16 +- service/secretsmanager/api_client_test.go | 4 + service/secretsmanager/options.go | 8 +- service/securityhub/api_client.go | 16 +- service/securityhub/api_client_test.go | 4 + service/securityhub/options.go | 8 +- service/securitylake/api_client.go | 16 +- service/securitylake/api_client_test.go | 4 + service/securitylake/options.go | 8 +- .../api_client.go | 16 +- .../api_client_test.go | 4 + .../options.go | 8 +- service/servicecatalog/api_client.go | 16 +- service/servicecatalog/api_client_test.go | 4 + service/servicecatalog/options.go | 8 +- .../servicecatalogappregistry/api_client.go | 16 +- .../api_client_test.go | 4 + service/servicecatalogappregistry/options.go | 8 +- service/servicediscovery/api_client.go | 16 +- service/servicediscovery/api_client_test.go | 4 + service/servicediscovery/options.go | 8 +- service/servicequotas/api_client.go | 16 +- service/servicequotas/api_client_test.go | 4 + service/servicequotas/options.go | 8 +- service/ses/api_client.go | 16 +- service/ses/api_client_test.go | 4 + service/ses/options.go | 8 +- service/sesv2/api_client.go | 16 +- service/sesv2/api_client_test.go | 4 + service/sesv2/options.go | 8 +- service/sfn/api_client.go | 16 +- service/sfn/api_client_test.go | 4 + service/sfn/options.go | 8 +- service/shield/api_client.go | 16 +- service/shield/api_client_test.go | 4 + service/shield/options.go | 8 +- service/signer/api_client.go | 16 +- service/signer/api_client_test.go | 4 + service/signer/options.go | 8 +- service/simspaceweaver/api_client.go | 16 +- service/simspaceweaver/api_client_test.go | 4 + service/simspaceweaver/options.go | 8 +- service/sms/api_client.go | 16 +- service/sms/api_client_test.go | 4 + service/sms/options.go | 8 +- service/snowball/api_client.go | 16 +- service/snowball/api_client_test.go | 4 + service/snowball/options.go | 8 +- service/snowdevicemanagement/api_client.go | 16 +- .../snowdevicemanagement/api_client_test.go | 4 + service/snowdevicemanagement/options.go | 8 +- service/sns/api_client.go | 16 +- service/sns/api_client_test.go | 4 + service/sns/options.go | 8 +- service/sqs/api_client.go | 16 +- service/sqs/api_client_test.go | 4 + service/sqs/options.go | 8 +- service/ssm/api_client.go | 16 +- service/ssm/api_client_test.go | 4 + service/ssm/options.go | 8 +- service/ssmcontacts/api_client.go | 16 +- service/ssmcontacts/api_client_test.go | 4 + service/ssmcontacts/options.go | 8 +- service/ssmincidents/api_client.go | 16 +- service/ssmincidents/api_client_test.go | 4 + service/ssmincidents/options.go | 8 +- service/ssmsap/api_client.go | 16 +- service/ssmsap/api_client_test.go | 4 + service/ssmsap/options.go | 8 +- service/sso/api_client.go | 16 +- service/sso/api_client_test.go | 4 + service/sso/options.go | 8 +- service/ssoadmin/api_client.go | 16 +- service/ssoadmin/api_client_test.go | 4 + service/ssoadmin/options.go | 8 +- service/ssooidc/api_client.go | 16 +- service/ssooidc/api_client_test.go | 4 + service/ssooidc/options.go | 8 +- service/storagegateway/api_client.go | 16 +- service/storagegateway/api_client_test.go | 4 + service/storagegateway/options.go | 8 +- service/sts/api_client.go | 16 +- service/sts/api_client_test.go | 4 + service/sts/options.go | 8 +- service/support/api_client.go | 16 +- service/support/api_client_test.go | 4 + service/support/options.go | 8 +- service/supportapp/api_client.go | 16 +- service/supportapp/api_client_test.go | 4 + service/supportapp/options.go | 8 +- service/swf/api_client.go | 16 +- service/swf/api_client_test.go | 4 + service/swf/options.go | 8 +- service/synthetics/api_client.go | 16 +- service/synthetics/api_client_test.go | 4 + service/synthetics/options.go | 8 +- service/textract/api_client.go | 16 +- service/textract/api_client_test.go | 4 + service/textract/options.go | 8 +- service/timestreamquery/api_client.go | 16 +- service/timestreamquery/api_client_test.go | 4 + service/timestreamquery/options.go | 8 +- service/timestreamwrite/api_client.go | 16 +- service/timestreamwrite/api_client_test.go | 4 + service/timestreamwrite/options.go | 8 +- service/tnb/api_client.go | 16 +- service/tnb/api_client_test.go | 4 + service/tnb/options.go | 8 +- service/transcribe/api_client.go | 16 +- service/transcribe/api_client_test.go | 4 + service/transcribe/options.go | 8 +- service/transcribestreaming/api_client.go | 16 +- .../transcribestreaming/api_client_test.go | 4 + service/transcribestreaming/options.go | 8 +- service/transfer/api_client.go | 16 +- service/transfer/api_client_test.go | 4 + service/transfer/options.go | 8 +- service/translate/api_client.go | 16 +- service/translate/api_client_test.go | 4 + service/translate/options.go | 8 +- service/trustedadvisor/api_client.go | 16 +- service/trustedadvisor/api_client_test.go | 4 + service/trustedadvisor/options.go | 8 +- service/verifiedpermissions/api_client.go | 16 +- .../verifiedpermissions/api_client_test.go | 4 + service/verifiedpermissions/options.go | 8 +- service/voiceid/api_client.go | 16 +- service/voiceid/api_client_test.go | 4 + service/voiceid/options.go | 8 +- service/vpclattice/api_client.go | 16 +- service/vpclattice/api_client_test.go | 4 + service/vpclattice/options.go | 8 +- service/waf/api_client.go | 16 +- service/waf/api_client_test.go | 4 + service/waf/options.go | 8 +- service/wafregional/api_client.go | 16 +- service/wafregional/api_client_test.go | 4 + service/wafregional/options.go | 8 +- service/wafv2/api_client.go | 16 +- service/wafv2/api_client_test.go | 4 + service/wafv2/options.go | 8 +- service/wellarchitected/api_client.go | 16 +- service/wellarchitected/api_client_test.go | 4 + service/wellarchitected/options.go | 8 +- service/wisdom/api_client.go | 16 +- service/wisdom/api_client_test.go | 4 + service/wisdom/options.go | 8 +- service/workdocs/api_client.go | 16 +- service/workdocs/api_client_test.go | 4 + service/workdocs/options.go | 8 +- service/worklink/api_client.go | 16 +- service/worklink/api_client_test.go | 4 + service/worklink/options.go | 8 +- service/workmail/api_client.go | 16 +- service/workmail/api_client_test.go | 4 + service/workmail/options.go | 8 +- service/workmailmessageflow/api_client.go | 16 +- .../workmailmessageflow/api_client_test.go | 4 + service/workmailmessageflow/options.go | 8 +- service/workspaces/api_client.go | 16 +- service/workspaces/api_client_test.go | 4 + service/workspaces/options.go | 8 +- service/workspacesthinclient/api_client.go | 16 +- .../workspacesthinclient/api_client_test.go | 4 + service/workspacesthinclient/options.go | 8 +- service/workspacesweb/api_client.go | 16 +- service/workspacesweb/api_client_test.go | 4 + service/workspacesweb/options.go | 8 +- service/xray/api_client.go | 16 +- service/xray/api_client_test.go | 4 + service/xray/options.go | 8 +- 1143 files changed, 8018 insertions(+), 3055 deletions(-) create mode 100644 .changelog/3678282d88fa4578a5345036a6ef377c.json diff --git a/.changelog/3678282d88fa4578a5345036a6ef377c.json b/.changelog/3678282d88fa4578a5345036a6ef377c.json new file mode 100644 index 00000000000..15b23524103 --- /dev/null +++ b/.changelog/3678282d88fa4578a5345036a6ef377c.json @@ -0,0 +1,388 @@ +{ + "id": "3678282d-88fa-4578-a534-5036a6ef377c", + "type": "bugfix", + "collapse": true, + "description": "Reinstate presence of default Retryer in functional options, but still respect max attempts set therein.", + "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/amplifyuibuilder", + "service/apigateway", + "service/apigatewaymanagementapi", + "service/apigatewayv2", + "service/appconfig", + "service/appconfigdata", + "service/appfabric", + "service/appflow", + "service/appintegrations", + "service/applicationautoscaling", + "service/applicationcostprofiler", + "service/applicationdiscoveryservice", + "service/applicationinsights", + "service/appmesh", + "service/apprunner", + "service/appstream", + "service/appsync", + "service/arczonalshift", + "service/athena", + "service/auditmanager", + "service/autoscaling", + "service/autoscalingplans", + "service/b2bi", + "service/backup", + "service/backupgateway", + "service/backupstorage", + "service/batch", + "service/bcmdataexports", + "service/bedrock", + "service/bedrockagent", + "service/bedrockagentruntime", + "service/bedrockruntime", + "service/billingconductor", + "service/braket", + "service/budgets", + "service/chime", + "service/chimesdkidentity", + "service/chimesdkmediapipelines", + "service/chimesdkmeetings", + "service/chimesdkmessaging", + "service/chimesdkvoice", + "service/cleanrooms", + "service/cleanroomsml", + "service/cloud9", + "service/cloudcontrol", + "service/clouddirectory", + "service/cloudformation", + "service/cloudfront", + "service/cloudfrontkeyvaluestore", + "service/cloudhsm", + "service/cloudhsmv2", + "service/cloudsearch", + "service/cloudsearchdomain", + "service/cloudtrail", + "service/cloudtraildata", + "service/cloudwatch", + "service/cloudwatchevents", + "service/cloudwatchlogs", + "service/codeartifact", + "service/codebuild", + "service/codecatalyst", + "service/codecommit", + "service/codedeploy", + "service/codeguruprofiler", + "service/codegurureviewer", + "service/codegurusecurity", + "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/connectcampaigns", + "service/connectcases", + "service/connectcontactlens", + "service/connectparticipant", + "service/controltower", + "service/costandusagereportservice", + "service/costexplorer", + "service/costoptimizationhub", + "service/customerprofiles", + "service/databasemigrationservice", + "service/databrew", + "service/dataexchange", + "service/datapipeline", + "service/datasync", + "service/datazone", + "service/dax", + "service/detective", + "service/devicefarm", + "service/devopsguru", + "service/directconnect", + "service/directoryservice", + "service/dlm", + "service/docdb", + "service/docdbelastic", + "service/drs", + "service/dynamodb", + "service/dynamodbstreams", + "service/ebs", + "service/ec2", + "service/ec2instanceconnect", + "service/ecr", + "service/ecrpublic", + "service/ecs", + "service/efs", + "service/eks", + "service/eksauth", + "service/elasticache", + "service/elasticbeanstalk", + "service/elasticinference", + "service/elasticloadbalancing", + "service/elasticloadbalancingv2", + "service/elasticsearchservice", + "service/elastictranscoder", + "service/emr", + "service/emrcontainers", + "service/emrserverless", + "service/entityresolution", + "service/eventbridge", + "service/evidently", + "service/finspace", + "service/finspacedata", + "service/firehose", + "service/fis", + "service/fms", + "service/forecast", + "service/forecastquery", + "service/frauddetector", + "service/freetier", + "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/inspectorscan", + "service/internetmonitor", + "service/iot", + "service/iot1clickdevicesservice", + "service/iot1clickprojects", + "service/iotanalytics", + "service/iotdataplane", + "service/iotdeviceadvisor", + "service/iotevents", + "service/ioteventsdata", + "service/iotfleethub", + "service/iotfleetwise", + "service/iotjobsdataplane", + "service/iotroborunner", + "service/iotsecuretunneling", + "service/iotsitewise", + "service/iotthingsgraph", + "service/iottwinmaker", + "service/iotwireless", + "service/ivs", + "service/ivschat", + "service/ivsrealtime", + "service/kafka", + "service/kafkaconnect", + "service/kendra", + "service/kendraranking", + "service/keyspaces", + "service/kinesis", + "service/kinesisanalytics", + "service/kinesisanalyticsv2", + "service/kinesisvideo", + "service/kinesisvideoarchivedmedia", + "service/kinesisvideomedia", + "service/kinesisvideosignaling", + "service/kinesisvideowebrtcstorage", + "service/kms", + "service/lakeformation", + "service/lambda", + "service/launchwizard", + "service/lexmodelbuildingservice", + "service/lexmodelsv2", + "service/lexruntimeservice", + "service/lexruntimev2", + "service/licensemanager", + "service/licensemanagerlinuxsubscriptions", + "service/licensemanagerusersubscriptions", + "service/lightsail", + "service/location", + "service/lookoutequipment", + "service/lookoutmetrics", + "service/lookoutvision", + "service/m2", + "service/machinelearning", + "service/macie2", + "service/managedblockchain", + "service/managedblockchainquery", + "service/marketplaceagreement", + "service/marketplacecatalog", + "service/marketplacecommerceanalytics", + "service/marketplacedeployment", + "service/marketplaceentitlementservice", + "service/marketplacemetering", + "service/mediaconnect", + "service/mediaconvert", + "service/medialive", + "service/mediapackage", + "service/mediapackagev2", + "service/mediapackagevod", + "service/mediastore", + "service/mediastoredata", + "service/mediatailor", + "service/medicalimaging", + "service/memorydb", + "service/mgn", + "service/migrationhub", + "service/migrationhubconfig", + "service/migrationhuborchestrator", + "service/migrationhubrefactorspaces", + "service/migrationhubstrategy", + "service/mobile", + "service/mq", + "service/mturk", + "service/mwaa", + "service/neptune", + "service/neptunedata", + "service/networkfirewall", + "service/networkmanager", + "service/nimble", + "service/oam", + "service/omics", + "service/opensearch", + "service/opensearchserverless", + "service/opsworks", + "service/opsworkscm", + "service/organizations", + "service/osis", + "service/outposts", + "service/panorama", + "service/paymentcryptography", + "service/paymentcryptographydata", + "service/pcaconnectorad", + "service/personalize", + "service/personalizeevents", + "service/personalizeruntime", + "service/pi", + "service/pinpoint", + "service/pinpointemail", + "service/pinpointsmsvoice", + "service/pinpointsmsvoicev2", + "service/pipes", + "service/polly", + "service/pricing", + "service/privatenetworks", + "service/proton", + "service/qbusiness", + "service/qconnect", + "service/qldb", + "service/qldbsession", + "service/quicksight", + "service/ram", + "service/rbin", + "service/rds", + "service/rdsdata", + "service/redshift", + "service/redshiftdata", + "service/redshiftserverless", + "service/rekognition", + "service/repostspace", + "service/resiliencehub", + "service/resourceexplorer2", + "service/resourcegroups", + "service/resourcegroupstaggingapi", + "service/robomaker", + "service/rolesanywhere", + "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/sagemakergeospatial", + "service/sagemakermetrics", + "service/sagemakerruntime", + "service/savingsplans", + "service/scheduler", + "service/schemas", + "service/secretsmanager", + "service/securityhub", + "service/securitylake", + "service/serverlessapplicationrepository", + "service/servicecatalog", + "service/servicecatalogappregistry", + "service/servicediscovery", + "service/servicequotas", + "service/ses", + "service/sesv2", + "service/sfn", + "service/shield", + "service/signer", + "service/simspaceweaver", + "service/sms", + "service/snowball", + "service/snowdevicemanagement", + "service/sns", + "service/sqs", + "service/ssm", + "service/ssmcontacts", + "service/ssmincidents", + "service/ssmsap", + "service/sso", + "service/ssoadmin", + "service/ssooidc", + "service/storagegateway", + "service/sts", + "service/support", + "service/supportapp", + "service/swf", + "service/synthetics", + "service/textract", + "service/timestreamquery", + "service/timestreamwrite", + "service/tnb", + "service/transcribe", + "service/transcribestreaming", + "service/transfer", + "service/translate", + "service/trustedadvisor", + "service/verifiedpermissions", + "service/voiceid", + "service/vpclattice", + "service/waf", + "service/wafregional", + "service/wafv2", + "service/wellarchitected", + "service/wisdom", + "service/workdocs", + "service/worklink", + "service/workmail", + "service/workmailmessageflow", + "service/workspaces", + "service/workspacesthinclient", + "service/workspacesweb", + "service/xray" + ] +} diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java index ebba21073ec..59037cc6994 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java @@ -72,8 +72,8 @@ public class AddAwsConfigFields implements GoIntegration { private static final String RESOLVE_AWS_CONFIG_RETRY_MAX_ATTEMPTS = "resolveAWSRetryMaxAttempts"; private static final String RESOLVE_AWS_CONFIG_RETRY_MODE = "resolveAWSRetryMode"; private static final String RESOLVE_AWS_CONFIG_RETRYER_PROVIDER = "resolveAWSRetryerProvider"; - - private static final String FINALIZE_RETRY_MAX_ATTEMPTS_OPTIONS = "finalizeRetryMaxAttemptOptions"; + private static final String FINALIZE_RETRY_MAX_ATTEMPTS = "finalizeRetryMaxAttempts"; + private static final String FINALIZE_OPERATION_RETRY_MAX_ATTEMPTS = "finalizeOperationRetryMaxAttempts"; private static final String SDK_APP_ID = "AppID"; @@ -116,7 +116,7 @@ public class AddAwsConfigFields implements GoIntegration { .addConfigFieldResolvers( ConfigFieldResolver.builder() .location(ConfigFieldResolver.Location.CLIENT) - .target(ConfigFieldResolver.Target.FINALIZATION) + .target(ConfigFieldResolver.Target.INITIALIZATION) .resolver(buildPackageSymbol(RESOLVE_RETRYER)) .build() ) @@ -132,22 +132,24 @@ public class AddAwsConfigFields implements GoIntegration { and will not be used to configure the API client created default retryer, or modify per operation call's retry max attempts. - When creating a new API Clients this member will only be used if the - Retryer Options member is nil. This value will be ignored if - Retryer is not nil. - If specified in an operation call's functional options with a value that is different than the constructed client's Options, the Client's Retryer will be wrapped to use the operation's specific RetryMaxAttempts value. """) .awsResolveFunction(SymbolUtils.createValueSymbolBuilder(RESOLVE_AWS_CONFIG_RETRY_MAX_ATTEMPTS) .build()) + .addConfigFieldResolvers( + ConfigFieldResolver.builder() + .location(ConfigFieldResolver.Location.CLIENT) + .target(ConfigFieldResolver.Target.FINALIZATION) + .resolver(buildPackageSymbol(FINALIZE_RETRY_MAX_ATTEMPTS)) + .build() + ) .addConfigFieldResolvers(ConfigFieldResolver.builder() .location(ConfigFieldResolver.Location.OPERATION) .target(ConfigFieldResolver.Target.FINALIZATION) .withClientInput(true) - .resolver(SymbolUtils.createValueSymbolBuilder( - FINALIZE_RETRY_MAX_ATTEMPTS_OPTIONS).build()) + .resolver(buildPackageSymbol(FINALIZE_OPERATION_RETRY_MAX_ATTEMPTS)) .build()) .build(), @@ -295,7 +297,7 @@ private static ConfigFieldResolver.Builder getClientInitializationResolver(Symbo private void writeAwsDefaultResolvers(GoWriter writer) { writeHttpClientResolver(writer); writeRetryerResolvers(writer); - writeRetryMaxAttemptsFinalizeResolver(writer); + writeRetryMaxAttemptsFinalizers(writer); writeAwsConfigEndpointResolver(writer); } @@ -394,15 +396,24 @@ private void writeRetryerResolvers(GoWriter writer) { writer.popState(); } - private void writeRetryMaxAttemptsFinalizeResolver(GoWriter writer) { + private void writeRetryMaxAttemptsFinalizers(GoWriter writer) { writer.pushState(); - writer.putContext("finalizeResolveName", FINALIZE_RETRY_MAX_ATTEMPTS_OPTIONS); + writer.putContext("clientFinalizeResolver", FINALIZE_RETRY_MAX_ATTEMPTS); + writer.putContext("operationFinalizeResolver", FINALIZE_OPERATION_RETRY_MAX_ATTEMPTS); writer.putContext("withMaxAttempts", SymbolUtils.createValueSymbolBuilder("AddWithMaxAttempts", AwsGoDependency.AWS_RETRY).build()); writer.write(""" - func $finalizeResolveName:L(o *Options, client Client) { + func $clientFinalizeResolver:L(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = $withMaxAttempts:T(o.Retryer, o.RetryMaxAttempts) + } + + func $operationFinalizeResolver:L(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } @@ -517,6 +528,10 @@ private void writeRetryResolverTests(GoWriter writer) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func (o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/config/shared_config_test.go b/config/shared_config_test.go index d448f50b2b7..4bf531b0f85 100644 --- a/config/shared_config_test.go +++ b/config/shared_config_test.go @@ -719,11 +719,11 @@ func TestNewSharedConfig(t *testing.T) { ServicesSectionName: "service_endpoint_url_services", Services: Services{ ServiceValues: map[string]map[string]string{ - "s3": map[string]string{ + "s3": { "endpoint_url": "http://127.0.0.1", "other": "foo", }, - "ec2": map[string]string{ + "ec2": { "endpoint_url": "http://127.0.0.1:81", }, }, diff --git a/internal/protocoltest/awsrestjson/api_client.go b/internal/protocoltest/awsrestjson/api_client.go index d4484e86a50..f39aaad726d 100644 --- a/internal/protocoltest/awsrestjson/api_client.go +++ b/internal/protocoltest/awsrestjson/api_client.go @@ -40,6 +40,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveIdempotencyTokenProvider(&options) @@ -52,7 +54,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -83,7 +85,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -326,7 +328,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/awsrestjson/api_client_test.go b/internal/protocoltest/awsrestjson/api_client_test.go index ef55f23a515..d4771b9a79b 100644 --- a/internal/protocoltest/awsrestjson/api_client_test.go +++ b/internal/protocoltest/awsrestjson/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/awsrestjson/options.go b/internal/protocoltest/awsrestjson/options.go index 0e164cc88a6..bd2bd6a9f84 100644 --- a/internal/protocoltest/awsrestjson/options.go +++ b/internal/protocoltest/awsrestjson/options.go @@ -72,11 +72,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/ec2query/api_client.go b/internal/protocoltest/ec2query/api_client.go index c4e39a96a57..3891cf31616 100644 --- a/internal/protocoltest/ec2query/api_client.go +++ b/internal/protocoltest/ec2query/api_client.go @@ -40,6 +40,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveIdempotencyTokenProvider(&options) @@ -52,7 +54,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -83,7 +85,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -326,7 +328,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/ec2query/api_client_test.go b/internal/protocoltest/ec2query/api_client_test.go index f3ea53b7ec2..722cc3459ad 100644 --- a/internal/protocoltest/ec2query/api_client_test.go +++ b/internal/protocoltest/ec2query/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/ec2query/options.go b/internal/protocoltest/ec2query/options.go index b43e137b70f..d8e99b30bb7 100644 --- a/internal/protocoltest/ec2query/options.go +++ b/internal/protocoltest/ec2query/options.go @@ -72,11 +72,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/jsonrpc/api_client.go b/internal/protocoltest/jsonrpc/api_client.go index 04697451cad..ff4a333d31d 100644 --- a/internal/protocoltest/jsonrpc/api_client.go +++ b/internal/protocoltest/jsonrpc/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/jsonrpc/api_client_test.go b/internal/protocoltest/jsonrpc/api_client_test.go index 01dd3911e33..3d1a4b65611 100644 --- a/internal/protocoltest/jsonrpc/api_client_test.go +++ b/internal/protocoltest/jsonrpc/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/jsonrpc/options.go b/internal/protocoltest/jsonrpc/options.go index d796e15c361..9630316047b 100644 --- a/internal/protocoltest/jsonrpc/options.go +++ b/internal/protocoltest/jsonrpc/options.go @@ -77,11 +77,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/jsonrpc10/api_client.go b/internal/protocoltest/jsonrpc10/api_client.go index 4c9259e3080..99dcc289328 100644 --- a/internal/protocoltest/jsonrpc10/api_client.go +++ b/internal/protocoltest/jsonrpc10/api_client.go @@ -38,6 +38,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveEndpointResolverV2(&options) @@ -48,7 +50,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -79,7 +81,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -322,7 +324,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/jsonrpc10/api_client_test.go b/internal/protocoltest/jsonrpc10/api_client_test.go index 5bd44ef9e8e..c63e55d6fb6 100644 --- a/internal/protocoltest/jsonrpc10/api_client_test.go +++ b/internal/protocoltest/jsonrpc10/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/jsonrpc10/options.go b/internal/protocoltest/jsonrpc10/options.go index 289110712bc..cefe9ff7d38 100644 --- a/internal/protocoltest/jsonrpc10/options.go +++ b/internal/protocoltest/jsonrpc10/options.go @@ -68,11 +68,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/query/api_client.go b/internal/protocoltest/query/api_client.go index 0cc8401a765..64a2d3e118a 100644 --- a/internal/protocoltest/query/api_client.go +++ b/internal/protocoltest/query/api_client.go @@ -40,6 +40,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveIdempotencyTokenProvider(&options) @@ -52,7 +54,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -83,7 +85,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -326,7 +328,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/query/api_client_test.go b/internal/protocoltest/query/api_client_test.go index 6bf63962df3..5d7006c855f 100644 --- a/internal/protocoltest/query/api_client_test.go +++ b/internal/protocoltest/query/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/query/options.go b/internal/protocoltest/query/options.go index ff78bf6632b..61469fff7a7 100644 --- a/internal/protocoltest/query/options.go +++ b/internal/protocoltest/query/options.go @@ -72,11 +72,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/restxml/api_client.go b/internal/protocoltest/restxml/api_client.go index 9548251dfc5..fc4c369fb43 100644 --- a/internal/protocoltest/restxml/api_client.go +++ b/internal/protocoltest/restxml/api_client.go @@ -40,6 +40,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveIdempotencyTokenProvider(&options) @@ -52,7 +54,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -83,7 +85,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -326,7 +328,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/restxml/api_client_test.go b/internal/protocoltest/restxml/api_client_test.go index d53654a841e..3429574c639 100644 --- a/internal/protocoltest/restxml/api_client_test.go +++ b/internal/protocoltest/restxml/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/restxml/options.go b/internal/protocoltest/restxml/options.go index 7bcf654e66a..e5c0a3daa4d 100644 --- a/internal/protocoltest/restxml/options.go +++ b/internal/protocoltest/restxml/options.go @@ -72,11 +72,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/internal/protocoltest/restxmlwithnamespace/api_client.go b/internal/protocoltest/restxmlwithnamespace/api_client.go index cb791e64154..f7f813d4425 100644 --- a/internal/protocoltest/restxmlwithnamespace/api_client.go +++ b/internal/protocoltest/restxmlwithnamespace/api_client.go @@ -38,6 +38,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveEndpointResolverV2(&options) @@ -48,7 +50,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -79,7 +81,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -320,7 +322,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/internal/protocoltest/restxmlwithnamespace/api_client_test.go b/internal/protocoltest/restxmlwithnamespace/api_client_test.go index b0b69a37442..88124ccce0d 100644 --- a/internal/protocoltest/restxmlwithnamespace/api_client_test.go +++ b/internal/protocoltest/restxmlwithnamespace/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/internal/protocoltest/restxmlwithnamespace/options.go b/internal/protocoltest/restxmlwithnamespace/options.go index 6c4330ac06c..0317b3c75c3 100644 --- a/internal/protocoltest/restxmlwithnamespace/options.go +++ b/internal/protocoltest/restxmlwithnamespace/options.go @@ -61,11 +61,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/accessanalyzer/api_client.go b/service/accessanalyzer/api_client.go index 72de07e1748..87752cca15f 100644 --- a/service/accessanalyzer/api_client.go +++ b/service/accessanalyzer/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/accessanalyzer/api_client_test.go b/service/accessanalyzer/api_client_test.go index 787209a5855..080e8398b77 100644 --- a/service/accessanalyzer/api_client_test.go +++ b/service/accessanalyzer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/accessanalyzer/options.go b/service/accessanalyzer/options.go index c974c390cf3..ca4b79fb918 100644 --- a/service/accessanalyzer/options.go +++ b/service/accessanalyzer/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/account/api_client.go b/service/account/api_client.go index 2f857a0f0e0..c6a89552b28 100644 --- a/service/account/api_client.go +++ b/service/account/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/account/api_client_test.go b/service/account/api_client_test.go index d7edb9761c6..6d9a34acfc9 100644 --- a/service/account/api_client_test.go +++ b/service/account/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/account/options.go b/service/account/options.go index ac766c6e7a8..b346281233b 100644 --- a/service/account/options.go +++ b/service/account/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/acm/api_client.go b/service/acm/api_client.go index 9f11b85db61..809d8f6c04d 100644 --- a/service/acm/api_client.go +++ b/service/acm/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/acm/api_client_test.go b/service/acm/api_client_test.go index 0b2a2346ce1..0ad608506ed 100644 --- a/service/acm/api_client_test.go +++ b/service/acm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/acm/options.go b/service/acm/options.go index 38e0fcffb29..77edd733ce1 100644 --- a/service/acm/options.go +++ b/service/acm/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/acmpca/api_client.go b/service/acmpca/api_client.go index 15cc8d37020..9bf06d8be05 100644 --- a/service/acmpca/api_client.go +++ b/service/acmpca/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/acmpca/api_client_test.go b/service/acmpca/api_client_test.go index 1da208c2bb2..b7b61b54220 100644 --- a/service/acmpca/api_client_test.go +++ b/service/acmpca/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/acmpca/options.go b/service/acmpca/options.go index 4f100a8919f..8ac2813ff96 100644 --- a/service/acmpca/options.go +++ b/service/acmpca/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/alexaforbusiness/api_client.go b/service/alexaforbusiness/api_client.go index 1cc65d0c1aa..c0959168693 100644 --- a/service/alexaforbusiness/api_client.go +++ b/service/alexaforbusiness/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/alexaforbusiness/api_client_test.go b/service/alexaforbusiness/api_client_test.go index 195f2841cbe..b098bb3ef92 100644 --- a/service/alexaforbusiness/api_client_test.go +++ b/service/alexaforbusiness/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/alexaforbusiness/options.go b/service/alexaforbusiness/options.go index 99d69ee43bb..5d9b44d937b 100644 --- a/service/alexaforbusiness/options.go +++ b/service/alexaforbusiness/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/amp/api_client.go b/service/amp/api_client.go index a26a88e4457..96a64cf9f3b 100644 --- a/service/amp/api_client.go +++ b/service/amp/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/amp/api_client_test.go b/service/amp/api_client_test.go index e08f9191108..da4901b3bf6 100644 --- a/service/amp/api_client_test.go +++ b/service/amp/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/amp/options.go b/service/amp/options.go index beb555a72bf..829dbabaa8f 100644 --- a/service/amp/options.go +++ b/service/amp/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/amplify/api_client.go b/service/amplify/api_client.go index 157cf93c468..73e329e4a84 100644 --- a/service/amplify/api_client.go +++ b/service/amplify/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/amplify/api_client_test.go b/service/amplify/api_client_test.go index f60dcaa8b6f..b0ebcde5ede 100644 --- a/service/amplify/api_client_test.go +++ b/service/amplify/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/amplify/options.go b/service/amplify/options.go index a1186111ff3..3a64da839b1 100644 --- a/service/amplify/options.go +++ b/service/amplify/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/amplifybackend/api_client.go b/service/amplifybackend/api_client.go index ceac5c6c805..47f64ea77b6 100644 --- a/service/amplifybackend/api_client.go +++ b/service/amplifybackend/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/amplifybackend/api_client_test.go b/service/amplifybackend/api_client_test.go index 9b21e26dc06..4ddd8f1cf80 100644 --- a/service/amplifybackend/api_client_test.go +++ b/service/amplifybackend/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/amplifybackend/options.go b/service/amplifybackend/options.go index 9962b349e30..0dac28bfee7 100644 --- a/service/amplifybackend/options.go +++ b/service/amplifybackend/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/amplifyuibuilder/api_client.go b/service/amplifyuibuilder/api_client.go index 2e11e2e1eb1..8c8b73ba9a9 100644 --- a/service/amplifyuibuilder/api_client.go +++ b/service/amplifyuibuilder/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/amplifyuibuilder/api_client_test.go b/service/amplifyuibuilder/api_client_test.go index dbc1747848d..de9b0e88b08 100644 --- a/service/amplifyuibuilder/api_client_test.go +++ b/service/amplifyuibuilder/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/amplifyuibuilder/options.go b/service/amplifyuibuilder/options.go index fdbb02a4e20..bdbd6f5f287 100644 --- a/service/amplifyuibuilder/options.go +++ b/service/amplifyuibuilder/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/apigateway/api_client.go b/service/apigateway/api_client.go index ca3a0e9951f..347be8c229e 100644 --- a/service/apigateway/api_client.go +++ b/service/apigateway/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/apigateway/api_client_test.go b/service/apigateway/api_client_test.go index 734456bf874..6bbde4750a2 100644 --- a/service/apigateway/api_client_test.go +++ b/service/apigateway/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/apigateway/options.go b/service/apigateway/options.go index 56bb46790bb..2eeaf81d95a 100644 --- a/service/apigateway/options.go +++ b/service/apigateway/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/apigatewaymanagementapi/api_client.go b/service/apigatewaymanagementapi/api_client.go index 4167422d984..d003244c276 100644 --- a/service/apigatewaymanagementapi/api_client.go +++ b/service/apigatewaymanagementapi/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/apigatewaymanagementapi/api_client_test.go b/service/apigatewaymanagementapi/api_client_test.go index 0402771df78..5ba069c09af 100644 --- a/service/apigatewaymanagementapi/api_client_test.go +++ b/service/apigatewaymanagementapi/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/apigatewaymanagementapi/options.go b/service/apigatewaymanagementapi/options.go index a1e983f28d1..f4d53167a7b 100644 --- a/service/apigatewaymanagementapi/options.go +++ b/service/apigatewaymanagementapi/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/apigatewayv2/api_client.go b/service/apigatewayv2/api_client.go index 200ab8c46e2..2e5b34201a9 100644 --- a/service/apigatewayv2/api_client.go +++ b/service/apigatewayv2/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/apigatewayv2/api_client_test.go b/service/apigatewayv2/api_client_test.go index 6a275365bda..14283face42 100644 --- a/service/apigatewayv2/api_client_test.go +++ b/service/apigatewayv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/apigatewayv2/options.go b/service/apigatewayv2/options.go index e47bff6bb48..2d335fa1572 100644 --- a/service/apigatewayv2/options.go +++ b/service/apigatewayv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appconfig/api_client.go b/service/appconfig/api_client.go index 404641fa9e5..fb123744c1c 100644 --- a/service/appconfig/api_client.go +++ b/service/appconfig/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appconfig/api_client_test.go b/service/appconfig/api_client_test.go index 4a7094ed502..a61e1f51f36 100644 --- a/service/appconfig/api_client_test.go +++ b/service/appconfig/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appconfig/options.go b/service/appconfig/options.go index 6d9871341e4..a9c45e0c8bb 100644 --- a/service/appconfig/options.go +++ b/service/appconfig/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appconfigdata/api_client.go b/service/appconfigdata/api_client.go index af60fa9de0a..ada9497da13 100644 --- a/service/appconfigdata/api_client.go +++ b/service/appconfigdata/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appconfigdata/api_client_test.go b/service/appconfigdata/api_client_test.go index 1346afd7b34..430745eda23 100644 --- a/service/appconfigdata/api_client_test.go +++ b/service/appconfigdata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appconfigdata/options.go b/service/appconfigdata/options.go index 28f6e4bc7ae..fb71991d3ed 100644 --- a/service/appconfigdata/options.go +++ b/service/appconfigdata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appfabric/api_client.go b/service/appfabric/api_client.go index b7762b5f9e4..84f4704dc85 100644 --- a/service/appfabric/api_client.go +++ b/service/appfabric/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appfabric/api_client_test.go b/service/appfabric/api_client_test.go index 552fd8da397..0496234ee50 100644 --- a/service/appfabric/api_client_test.go +++ b/service/appfabric/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appfabric/options.go b/service/appfabric/options.go index 17a46d604cb..c157deda065 100644 --- a/service/appfabric/options.go +++ b/service/appfabric/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appflow/api_client.go b/service/appflow/api_client.go index 4262e2e6346..d6a35f4133a 100644 --- a/service/appflow/api_client.go +++ b/service/appflow/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appflow/api_client_test.go b/service/appflow/api_client_test.go index 6ae83b2c8f6..68af8df3202 100644 --- a/service/appflow/api_client_test.go +++ b/service/appflow/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appflow/options.go b/service/appflow/options.go index 69fa42c815f..9949552f60c 100644 --- a/service/appflow/options.go +++ b/service/appflow/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appintegrations/api_client.go b/service/appintegrations/api_client.go index f20c6e80187..e67c782ca9f 100644 --- a/service/appintegrations/api_client.go +++ b/service/appintegrations/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appintegrations/api_client_test.go b/service/appintegrations/api_client_test.go index eb5bf895f56..b9e5eafc920 100644 --- a/service/appintegrations/api_client_test.go +++ b/service/appintegrations/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appintegrations/options.go b/service/appintegrations/options.go index b392e68c3f4..1987a53d2ee 100644 --- a/service/appintegrations/options.go +++ b/service/appintegrations/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/applicationautoscaling/api_client.go b/service/applicationautoscaling/api_client.go index 4a2d6c9a681..c2b1fdfb2cc 100644 --- a/service/applicationautoscaling/api_client.go +++ b/service/applicationautoscaling/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/applicationautoscaling/api_client_test.go b/service/applicationautoscaling/api_client_test.go index 9e62eb1cff3..eefdb4703cb 100644 --- a/service/applicationautoscaling/api_client_test.go +++ b/service/applicationautoscaling/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/applicationautoscaling/options.go b/service/applicationautoscaling/options.go index d7f07c47c99..f60a2d67a83 100644 --- a/service/applicationautoscaling/options.go +++ b/service/applicationautoscaling/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/applicationcostprofiler/api_client.go b/service/applicationcostprofiler/api_client.go index dca514bf309..1edbca985c9 100644 --- a/service/applicationcostprofiler/api_client.go +++ b/service/applicationcostprofiler/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/applicationcostprofiler/api_client_test.go b/service/applicationcostprofiler/api_client_test.go index 9d91970e868..fb2da646324 100644 --- a/service/applicationcostprofiler/api_client_test.go +++ b/service/applicationcostprofiler/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/applicationcostprofiler/options.go b/service/applicationcostprofiler/options.go index 036c3d711d7..1a5293d2d67 100644 --- a/service/applicationcostprofiler/options.go +++ b/service/applicationcostprofiler/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/applicationdiscoveryservice/api_client.go b/service/applicationdiscoveryservice/api_client.go index e032bf5d668..6f55246bdfa 100644 --- a/service/applicationdiscoveryservice/api_client.go +++ b/service/applicationdiscoveryservice/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/applicationdiscoveryservice/api_client_test.go b/service/applicationdiscoveryservice/api_client_test.go index 3e776110822..746479c1642 100644 --- a/service/applicationdiscoveryservice/api_client_test.go +++ b/service/applicationdiscoveryservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/applicationdiscoveryservice/options.go b/service/applicationdiscoveryservice/options.go index f3243c4210b..33bc3e728aa 100644 --- a/service/applicationdiscoveryservice/options.go +++ b/service/applicationdiscoveryservice/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/applicationinsights/api_client.go b/service/applicationinsights/api_client.go index 6b1385af55c..39b2102bd1e 100644 --- a/service/applicationinsights/api_client.go +++ b/service/applicationinsights/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/applicationinsights/api_client_test.go b/service/applicationinsights/api_client_test.go index b9a629f6660..2213766ca79 100644 --- a/service/applicationinsights/api_client_test.go +++ b/service/applicationinsights/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/applicationinsights/options.go b/service/applicationinsights/options.go index 881b0552fc1..0104b50bbfd 100644 --- a/service/applicationinsights/options.go +++ b/service/applicationinsights/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appmesh/api_client.go b/service/appmesh/api_client.go index 59a2af2d89f..252002f46c9 100644 --- a/service/appmesh/api_client.go +++ b/service/appmesh/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appmesh/api_client_test.go b/service/appmesh/api_client_test.go index d4dc6adb117..1e4c009f7c0 100644 --- a/service/appmesh/api_client_test.go +++ b/service/appmesh/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appmesh/options.go b/service/appmesh/options.go index 9a2ace7d992..1cab890736d 100644 --- a/service/appmesh/options.go +++ b/service/appmesh/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/apprunner/api_client.go b/service/apprunner/api_client.go index fb7f171e15e..840180e120f 100644 --- a/service/apprunner/api_client.go +++ b/service/apprunner/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/apprunner/api_client_test.go b/service/apprunner/api_client_test.go index f9aea5ecf56..416a139e110 100644 --- a/service/apprunner/api_client_test.go +++ b/service/apprunner/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/apprunner/options.go b/service/apprunner/options.go index 4f3741a09a9..dbab338d6df 100644 --- a/service/apprunner/options.go +++ b/service/apprunner/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appstream/api_client.go b/service/appstream/api_client.go index 777f9101249..b9a12d78d94 100644 --- a/service/appstream/api_client.go +++ b/service/appstream/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appstream/api_client_test.go b/service/appstream/api_client_test.go index 4ac51c7a079..7fb3cd44515 100644 --- a/service/appstream/api_client_test.go +++ b/service/appstream/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appstream/options.go b/service/appstream/options.go index 24237ac9514..7e745094409 100644 --- a/service/appstream/options.go +++ b/service/appstream/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/appsync/api_client.go b/service/appsync/api_client.go index f05233c7b48..3ce524e6908 100644 --- a/service/appsync/api_client.go +++ b/service/appsync/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/appsync/api_client_test.go b/service/appsync/api_client_test.go index 0a5b7a6acde..a2eda2e8e50 100644 --- a/service/appsync/api_client_test.go +++ b/service/appsync/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/appsync/options.go b/service/appsync/options.go index 8b6b06cf28f..8f4505d8489 100644 --- a/service/appsync/options.go +++ b/service/appsync/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/arczonalshift/api_client.go b/service/arczonalshift/api_client.go index d2c174401ca..60330e886b0 100644 --- a/service/arczonalshift/api_client.go +++ b/service/arczonalshift/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/arczonalshift/api_client_test.go b/service/arczonalshift/api_client_test.go index ef3a7c55f11..6eed5c6f5c7 100644 --- a/service/arczonalshift/api_client_test.go +++ b/service/arczonalshift/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/arczonalshift/options.go b/service/arczonalshift/options.go index 033da0c2d2f..2f88c457456 100644 --- a/service/arczonalshift/options.go +++ b/service/arczonalshift/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/athena/api_client.go b/service/athena/api_client.go index e0b563f21ce..8e264e29fa1 100644 --- a/service/athena/api_client.go +++ b/service/athena/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/athena/api_client_test.go b/service/athena/api_client_test.go index 45f53fd3d25..44a5fb56b70 100644 --- a/service/athena/api_client_test.go +++ b/service/athena/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/athena/options.go b/service/athena/options.go index 73f834130c0..f3f1f5fa505 100644 --- a/service/athena/options.go +++ b/service/athena/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/auditmanager/api_client.go b/service/auditmanager/api_client.go index 5ddef73d3e5..ee103eaf266 100644 --- a/service/auditmanager/api_client.go +++ b/service/auditmanager/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/auditmanager/api_client_test.go b/service/auditmanager/api_client_test.go index 0cc8ded1e89..26f76e483a6 100644 --- a/service/auditmanager/api_client_test.go +++ b/service/auditmanager/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/auditmanager/options.go b/service/auditmanager/options.go index 1967bce1f94..2844f7ba499 100644 --- a/service/auditmanager/options.go +++ b/service/auditmanager/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/autoscaling/api_client.go b/service/autoscaling/api_client.go index 4311b456abb..ebffefb3f0f 100644 --- a/service/autoscaling/api_client.go +++ b/service/autoscaling/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/autoscaling/api_client_test.go b/service/autoscaling/api_client_test.go index 31f3b388bff..8ac27c2f6f4 100644 --- a/service/autoscaling/api_client_test.go +++ b/service/autoscaling/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/autoscaling/options.go b/service/autoscaling/options.go index 049bac57942..9a183095a31 100644 --- a/service/autoscaling/options.go +++ b/service/autoscaling/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/autoscalingplans/api_client.go b/service/autoscalingplans/api_client.go index b5b263c585b..7512fcf7fda 100644 --- a/service/autoscalingplans/api_client.go +++ b/service/autoscalingplans/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/autoscalingplans/api_client_test.go b/service/autoscalingplans/api_client_test.go index d4a53782d34..0a2f225a144 100644 --- a/service/autoscalingplans/api_client_test.go +++ b/service/autoscalingplans/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/autoscalingplans/options.go b/service/autoscalingplans/options.go index 40dc129b6d9..05f31b55b77 100644 --- a/service/autoscalingplans/options.go +++ b/service/autoscalingplans/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/b2bi/api_client.go b/service/b2bi/api_client.go index d809378606f..c7d6ad9a48b 100644 --- a/service/b2bi/api_client.go +++ b/service/b2bi/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/b2bi/api_client_test.go b/service/b2bi/api_client_test.go index afd2185b956..ea834b03bfa 100644 --- a/service/b2bi/api_client_test.go +++ b/service/b2bi/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/b2bi/options.go b/service/b2bi/options.go index 676eb81bd15..83b7f186c3a 100644 --- a/service/b2bi/options.go +++ b/service/b2bi/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/backup/api_client.go b/service/backup/api_client.go index e0b1a1417fb..1b8de15e813 100644 --- a/service/backup/api_client.go +++ b/service/backup/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/backup/api_client_test.go b/service/backup/api_client_test.go index a9d77faaf56..e1360113678 100644 --- a/service/backup/api_client_test.go +++ b/service/backup/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/backup/options.go b/service/backup/options.go index 09a5be872a9..b6d89e22e7b 100644 --- a/service/backup/options.go +++ b/service/backup/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/backupgateway/api_client.go b/service/backupgateway/api_client.go index 0b216bb6db0..9a72e44e110 100644 --- a/service/backupgateway/api_client.go +++ b/service/backupgateway/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/backupgateway/api_client_test.go b/service/backupgateway/api_client_test.go index 9bcfc4cf0fa..f2114ed2147 100644 --- a/service/backupgateway/api_client_test.go +++ b/service/backupgateway/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/backupgateway/options.go b/service/backupgateway/options.go index 3dabc9dbace..ebb2d074e92 100644 --- a/service/backupgateway/options.go +++ b/service/backupgateway/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/backupstorage/api_client.go b/service/backupstorage/api_client.go index 26fb3db22a2..a18a99db7f1 100644 --- a/service/backupstorage/api_client.go +++ b/service/backupstorage/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/backupstorage/api_client_test.go b/service/backupstorage/api_client_test.go index 7361c7a4390..7f545b41c1e 100644 --- a/service/backupstorage/api_client_test.go +++ b/service/backupstorage/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/backupstorage/options.go b/service/backupstorage/options.go index 6f1a7ff35dd..83701b74b14 100644 --- a/service/backupstorage/options.go +++ b/service/backupstorage/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/batch/api_client.go b/service/batch/api_client.go index 0979f1b401d..fbb0f62684b 100644 --- a/service/batch/api_client.go +++ b/service/batch/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/batch/api_client_test.go b/service/batch/api_client_test.go index 8f3773c2082..9c4aea1f404 100644 --- a/service/batch/api_client_test.go +++ b/service/batch/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/batch/options.go b/service/batch/options.go index 5ea41de094d..c9038923519 100644 --- a/service/batch/options.go +++ b/service/batch/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/bcmdataexports/api_client.go b/service/bcmdataexports/api_client.go index 85d759094de..40d95ba6f2d 100644 --- a/service/bcmdataexports/api_client.go +++ b/service/bcmdataexports/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/bcmdataexports/api_client_test.go b/service/bcmdataexports/api_client_test.go index dda81b2b43d..1bbc3e1ae7a 100644 --- a/service/bcmdataexports/api_client_test.go +++ b/service/bcmdataexports/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/bcmdataexports/options.go b/service/bcmdataexports/options.go index 784cf9cbdba..396bd2bb7b2 100644 --- a/service/bcmdataexports/options.go +++ b/service/bcmdataexports/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/bedrock/api_client.go b/service/bedrock/api_client.go index 0ceac6e41ce..bec76d136d7 100644 --- a/service/bedrock/api_client.go +++ b/service/bedrock/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/bedrock/api_client_test.go b/service/bedrock/api_client_test.go index 84733433605..af2bf6663b9 100644 --- a/service/bedrock/api_client_test.go +++ b/service/bedrock/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/bedrock/options.go b/service/bedrock/options.go index 1daf0338f0b..0faea81e708 100644 --- a/service/bedrock/options.go +++ b/service/bedrock/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/bedrockagent/api_client.go b/service/bedrockagent/api_client.go index 9208d81dc6b..8b8902be1a5 100644 --- a/service/bedrockagent/api_client.go +++ b/service/bedrockagent/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/bedrockagent/api_client_test.go b/service/bedrockagent/api_client_test.go index 9a648ce8583..23de911382b 100644 --- a/service/bedrockagent/api_client_test.go +++ b/service/bedrockagent/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/bedrockagent/options.go b/service/bedrockagent/options.go index 9e43686ae36..763f8c1e7d7 100644 --- a/service/bedrockagent/options.go +++ b/service/bedrockagent/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/bedrockagentruntime/api_client.go b/service/bedrockagentruntime/api_client.go index 25707e64bcc..abb0323fcf0 100644 --- a/service/bedrockagentruntime/api_client.go +++ b/service/bedrockagentruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/bedrockagentruntime/api_client_test.go b/service/bedrockagentruntime/api_client_test.go index 78010b7b546..1d102984667 100644 --- a/service/bedrockagentruntime/api_client_test.go +++ b/service/bedrockagentruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/bedrockagentruntime/options.go b/service/bedrockagentruntime/options.go index 88048cc3427..bb0d5954e9c 100644 --- a/service/bedrockagentruntime/options.go +++ b/service/bedrockagentruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/bedrockruntime/api_client.go b/service/bedrockruntime/api_client.go index 06d0454237e..47a24f54641 100644 --- a/service/bedrockruntime/api_client.go +++ b/service/bedrockruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/bedrockruntime/api_client_test.go b/service/bedrockruntime/api_client_test.go index cbdf26ccd65..c76fb76736b 100644 --- a/service/bedrockruntime/api_client_test.go +++ b/service/bedrockruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/bedrockruntime/options.go b/service/bedrockruntime/options.go index a9a1d1eea7a..78b258a178b 100644 --- a/service/bedrockruntime/options.go +++ b/service/bedrockruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/billingconductor/api_client.go b/service/billingconductor/api_client.go index 5adb612cdfa..dbd40fcc41f 100644 --- a/service/billingconductor/api_client.go +++ b/service/billingconductor/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/billingconductor/api_client_test.go b/service/billingconductor/api_client_test.go index 305684c104b..f4bed609d8d 100644 --- a/service/billingconductor/api_client_test.go +++ b/service/billingconductor/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/billingconductor/options.go b/service/billingconductor/options.go index 7940bd28c9c..7e5c4bf6393 100644 --- a/service/billingconductor/options.go +++ b/service/billingconductor/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/braket/api_client.go b/service/braket/api_client.go index 01600705f1c..da1a292e9a5 100644 --- a/service/braket/api_client.go +++ b/service/braket/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/braket/api_client_test.go b/service/braket/api_client_test.go index ef1544c9728..2a1497b0ab6 100644 --- a/service/braket/api_client_test.go +++ b/service/braket/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/braket/options.go b/service/braket/options.go index 9ef3bc46bb7..6f2478af3c7 100644 --- a/service/braket/options.go +++ b/service/braket/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/budgets/api_client.go b/service/budgets/api_client.go index 689a6681fd4..8843511cb78 100644 --- a/service/budgets/api_client.go +++ b/service/budgets/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/budgets/api_client_test.go b/service/budgets/api_client_test.go index 00651b6e258..d8075cf9331 100644 --- a/service/budgets/api_client_test.go +++ b/service/budgets/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/budgets/options.go b/service/budgets/options.go index 213c58004b8..d34e144ab4a 100644 --- a/service/budgets/options.go +++ b/service/budgets/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chime/api_client.go b/service/chime/api_client.go index ca75899d09e..8990bfd76d9 100644 --- a/service/chime/api_client.go +++ b/service/chime/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chime/api_client_test.go b/service/chime/api_client_test.go index afdfc6617a5..90b90095b64 100644 --- a/service/chime/api_client_test.go +++ b/service/chime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chime/options.go b/service/chime/options.go index 7b9550b7284..daea71c83fe 100644 --- a/service/chime/options.go +++ b/service/chime/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chimesdkidentity/api_client.go b/service/chimesdkidentity/api_client.go index 85d357c279a..f5f2f973e19 100644 --- a/service/chimesdkidentity/api_client.go +++ b/service/chimesdkidentity/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chimesdkidentity/api_client_test.go b/service/chimesdkidentity/api_client_test.go index 2a9384d93b9..0bb38367e68 100644 --- a/service/chimesdkidentity/api_client_test.go +++ b/service/chimesdkidentity/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chimesdkidentity/options.go b/service/chimesdkidentity/options.go index 111a3896973..ab06461c37d 100644 --- a/service/chimesdkidentity/options.go +++ b/service/chimesdkidentity/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chimesdkmediapipelines/api_client.go b/service/chimesdkmediapipelines/api_client.go index bd2ef568e81..e093b76e616 100644 --- a/service/chimesdkmediapipelines/api_client.go +++ b/service/chimesdkmediapipelines/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chimesdkmediapipelines/api_client_test.go b/service/chimesdkmediapipelines/api_client_test.go index 60ce162f109..1583e345de1 100644 --- a/service/chimesdkmediapipelines/api_client_test.go +++ b/service/chimesdkmediapipelines/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chimesdkmediapipelines/options.go b/service/chimesdkmediapipelines/options.go index 3a413538674..aa4bc74301a 100644 --- a/service/chimesdkmediapipelines/options.go +++ b/service/chimesdkmediapipelines/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chimesdkmeetings/api_client.go b/service/chimesdkmeetings/api_client.go index c8686df09d5..b7c9704e75d 100644 --- a/service/chimesdkmeetings/api_client.go +++ b/service/chimesdkmeetings/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chimesdkmeetings/api_client_test.go b/service/chimesdkmeetings/api_client_test.go index 1bad194e362..2b32ce55d2a 100644 --- a/service/chimesdkmeetings/api_client_test.go +++ b/service/chimesdkmeetings/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chimesdkmeetings/options.go b/service/chimesdkmeetings/options.go index d43f27c1106..4818b1c243b 100644 --- a/service/chimesdkmeetings/options.go +++ b/service/chimesdkmeetings/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chimesdkmessaging/api_client.go b/service/chimesdkmessaging/api_client.go index f159865ce40..a8dd1bdb2a1 100644 --- a/service/chimesdkmessaging/api_client.go +++ b/service/chimesdkmessaging/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chimesdkmessaging/api_client_test.go b/service/chimesdkmessaging/api_client_test.go index c4846c5839d..a9487cf091e 100644 --- a/service/chimesdkmessaging/api_client_test.go +++ b/service/chimesdkmessaging/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chimesdkmessaging/options.go b/service/chimesdkmessaging/options.go index 737fbba7ae2..b397f55846c 100644 --- a/service/chimesdkmessaging/options.go +++ b/service/chimesdkmessaging/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/chimesdkvoice/api_client.go b/service/chimesdkvoice/api_client.go index 01dd2859bc4..3ca4d86c9c0 100644 --- a/service/chimesdkvoice/api_client.go +++ b/service/chimesdkvoice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/chimesdkvoice/api_client_test.go b/service/chimesdkvoice/api_client_test.go index 6cfec58ad98..eee6409617b 100644 --- a/service/chimesdkvoice/api_client_test.go +++ b/service/chimesdkvoice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/chimesdkvoice/options.go b/service/chimesdkvoice/options.go index 231e2d4d796..b74af6f12eb 100644 --- a/service/chimesdkvoice/options.go +++ b/service/chimesdkvoice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cleanrooms/api_client.go b/service/cleanrooms/api_client.go index ac33e4cbdec..e4ea9e6ec13 100644 --- a/service/cleanrooms/api_client.go +++ b/service/cleanrooms/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cleanrooms/api_client_test.go b/service/cleanrooms/api_client_test.go index 40b36861ebb..3305e032588 100644 --- a/service/cleanrooms/api_client_test.go +++ b/service/cleanrooms/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cleanrooms/options.go b/service/cleanrooms/options.go index e2984872643..722ec717498 100644 --- a/service/cleanrooms/options.go +++ b/service/cleanrooms/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cleanroomsml/api_client.go b/service/cleanroomsml/api_client.go index 75842aa376b..c8e761d3e30 100644 --- a/service/cleanroomsml/api_client.go +++ b/service/cleanroomsml/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cleanroomsml/api_client_test.go b/service/cleanroomsml/api_client_test.go index 20ba25ad087..d49feb12d10 100644 --- a/service/cleanroomsml/api_client_test.go +++ b/service/cleanroomsml/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cleanroomsml/options.go b/service/cleanroomsml/options.go index 316ffadcadc..cc25fe03792 100644 --- a/service/cleanroomsml/options.go +++ b/service/cleanroomsml/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloud9/api_client.go b/service/cloud9/api_client.go index 9e4ee0ca8d2..c728779f732 100644 --- a/service/cloud9/api_client.go +++ b/service/cloud9/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloud9/api_client_test.go b/service/cloud9/api_client_test.go index bc3e0389895..ece4aa4b00e 100644 --- a/service/cloud9/api_client_test.go +++ b/service/cloud9/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloud9/options.go b/service/cloud9/options.go index 8ff679193cd..b7b714646a8 100644 --- a/service/cloud9/options.go +++ b/service/cloud9/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudcontrol/api_client.go b/service/cloudcontrol/api_client.go index 64215a30287..1c5cdd74055 100644 --- a/service/cloudcontrol/api_client.go +++ b/service/cloudcontrol/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudcontrol/api_client_test.go b/service/cloudcontrol/api_client_test.go index d88c014f777..215cda1b52f 100644 --- a/service/cloudcontrol/api_client_test.go +++ b/service/cloudcontrol/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudcontrol/options.go b/service/cloudcontrol/options.go index 61fc759a181..10c7257720e 100644 --- a/service/cloudcontrol/options.go +++ b/service/cloudcontrol/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/clouddirectory/api_client.go b/service/clouddirectory/api_client.go index caa39f51351..823c7231ee0 100644 --- a/service/clouddirectory/api_client.go +++ b/service/clouddirectory/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/clouddirectory/api_client_test.go b/service/clouddirectory/api_client_test.go index 5daca0a3af8..54a139f1394 100644 --- a/service/clouddirectory/api_client_test.go +++ b/service/clouddirectory/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/clouddirectory/options.go b/service/clouddirectory/options.go index 713ad3a8653..6d320e151e0 100644 --- a/service/clouddirectory/options.go +++ b/service/clouddirectory/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudformation/api_client.go b/service/cloudformation/api_client.go index 49eff6a1f1e..4bbfff117a0 100644 --- a/service/cloudformation/api_client.go +++ b/service/cloudformation/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudformation/api_client_test.go b/service/cloudformation/api_client_test.go index efb558cd7e5..2e5a11c094b 100644 --- a/service/cloudformation/api_client_test.go +++ b/service/cloudformation/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudformation/options.go b/service/cloudformation/options.go index 47fc19be5ff..5357466b7bd 100644 --- a/service/cloudformation/options.go +++ b/service/cloudformation/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudfront/api_client.go b/service/cloudfront/api_client.go index 91d06d91c17..b3ea9db5454 100644 --- a/service/cloudfront/api_client.go +++ b/service/cloudfront/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudfront/api_client_test.go b/service/cloudfront/api_client_test.go index 142accee3e7..f15f5cef28a 100644 --- a/service/cloudfront/api_client_test.go +++ b/service/cloudfront/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudfront/options.go b/service/cloudfront/options.go index e44018250c7..502c0ce28de 100644 --- a/service/cloudfront/options.go +++ b/service/cloudfront/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudfrontkeyvaluestore/api_client.go b/service/cloudfrontkeyvaluestore/api_client.go index b1cfd830950..93ec74b0a81 100644 --- a/service/cloudfrontkeyvaluestore/api_client.go +++ b/service/cloudfrontkeyvaluestore/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudfrontkeyvaluestore/api_client_test.go b/service/cloudfrontkeyvaluestore/api_client_test.go index f77be76a511..4f3bab46b79 100644 --- a/service/cloudfrontkeyvaluestore/api_client_test.go +++ b/service/cloudfrontkeyvaluestore/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudfrontkeyvaluestore/options.go b/service/cloudfrontkeyvaluestore/options.go index 42b2c109c3a..4ffd85d42dd 100644 --- a/service/cloudfrontkeyvaluestore/options.go +++ b/service/cloudfrontkeyvaluestore/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudhsm/api_client.go b/service/cloudhsm/api_client.go index be1e04fdb37..b05be156506 100644 --- a/service/cloudhsm/api_client.go +++ b/service/cloudhsm/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudhsm/api_client_test.go b/service/cloudhsm/api_client_test.go index d4ff57e9516..4768de054aa 100644 --- a/service/cloudhsm/api_client_test.go +++ b/service/cloudhsm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudhsm/options.go b/service/cloudhsm/options.go index f9bb2777067..9dc12483622 100644 --- a/service/cloudhsm/options.go +++ b/service/cloudhsm/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudhsmv2/api_client.go b/service/cloudhsmv2/api_client.go index 6a9523ef3b4..2bd421266f8 100644 --- a/service/cloudhsmv2/api_client.go +++ b/service/cloudhsmv2/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudhsmv2/api_client_test.go b/service/cloudhsmv2/api_client_test.go index 36852f880e3..1ee56f864e1 100644 --- a/service/cloudhsmv2/api_client_test.go +++ b/service/cloudhsmv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudhsmv2/options.go b/service/cloudhsmv2/options.go index 87e421bb578..44c25a26f27 100644 --- a/service/cloudhsmv2/options.go +++ b/service/cloudhsmv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudsearch/api_client.go b/service/cloudsearch/api_client.go index 045784ac583..dadfd2f86e4 100644 --- a/service/cloudsearch/api_client.go +++ b/service/cloudsearch/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudsearch/api_client_test.go b/service/cloudsearch/api_client_test.go index 8042a7774e0..07b3fe22e9a 100644 --- a/service/cloudsearch/api_client_test.go +++ b/service/cloudsearch/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudsearch/options.go b/service/cloudsearch/options.go index 21f6c9d39f1..a5d00c96a33 100644 --- a/service/cloudsearch/options.go +++ b/service/cloudsearch/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudsearchdomain/api_client.go b/service/cloudsearchdomain/api_client.go index 44edcef086f..7ce19eeff61 100644 --- a/service/cloudsearchdomain/api_client.go +++ b/service/cloudsearchdomain/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudsearchdomain/api_client_test.go b/service/cloudsearchdomain/api_client_test.go index 57feddacd3b..1b9a37c74c0 100644 --- a/service/cloudsearchdomain/api_client_test.go +++ b/service/cloudsearchdomain/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudsearchdomain/options.go b/service/cloudsearchdomain/options.go index f38c1e9acb4..5858235da40 100644 --- a/service/cloudsearchdomain/options.go +++ b/service/cloudsearchdomain/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudtrail/api_client.go b/service/cloudtrail/api_client.go index 48fe95e962c..7ea04f926e4 100644 --- a/service/cloudtrail/api_client.go +++ b/service/cloudtrail/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudtrail/api_client_test.go b/service/cloudtrail/api_client_test.go index ae460a5d4b4..03400e717ee 100644 --- a/service/cloudtrail/api_client_test.go +++ b/service/cloudtrail/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudtrail/options.go b/service/cloudtrail/options.go index 0e7ddf1137b..3f41deae494 100644 --- a/service/cloudtrail/options.go +++ b/service/cloudtrail/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudtraildata/api_client.go b/service/cloudtraildata/api_client.go index 92ff57d8392..3f796feb2e0 100644 --- a/service/cloudtraildata/api_client.go +++ b/service/cloudtraildata/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudtraildata/api_client_test.go b/service/cloudtraildata/api_client_test.go index d8510173534..e7d4b8d919a 100644 --- a/service/cloudtraildata/api_client_test.go +++ b/service/cloudtraildata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudtraildata/options.go b/service/cloudtraildata/options.go index 95faf33ad90..e483254413e 100644 --- a/service/cloudtraildata/options.go +++ b/service/cloudtraildata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudwatch/api_client.go b/service/cloudwatch/api_client.go index ed6ed01dcf7..4159dba3b36 100644 --- a/service/cloudwatch/api_client.go +++ b/service/cloudwatch/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudwatch/api_client_test.go b/service/cloudwatch/api_client_test.go index d6c7f051d1c..b7ebc8bb927 100644 --- a/service/cloudwatch/api_client_test.go +++ b/service/cloudwatch/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudwatch/options.go b/service/cloudwatch/options.go index ad28771a6e9..69a23e5125d 100644 --- a/service/cloudwatch/options.go +++ b/service/cloudwatch/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudwatchevents/api_client.go b/service/cloudwatchevents/api_client.go index 6eda96f77f6..ffebc2f7d21 100644 --- a/service/cloudwatchevents/api_client.go +++ b/service/cloudwatchevents/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudwatchevents/api_client_test.go b/service/cloudwatchevents/api_client_test.go index 1ca5834d5fb..be4861a7260 100644 --- a/service/cloudwatchevents/api_client_test.go +++ b/service/cloudwatchevents/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudwatchevents/options.go b/service/cloudwatchevents/options.go index c73b183f00c..2552376ac33 100644 --- a/service/cloudwatchevents/options.go +++ b/service/cloudwatchevents/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cloudwatchlogs/api_client.go b/service/cloudwatchlogs/api_client.go index 5f12149d504..39906cde5b7 100644 --- a/service/cloudwatchlogs/api_client.go +++ b/service/cloudwatchlogs/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cloudwatchlogs/api_client_test.go b/service/cloudwatchlogs/api_client_test.go index a751cbd2dfd..93b8717e11d 100644 --- a/service/cloudwatchlogs/api_client_test.go +++ b/service/cloudwatchlogs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cloudwatchlogs/options.go b/service/cloudwatchlogs/options.go index 87f8c97dd52..33256f3d76f 100644 --- a/service/cloudwatchlogs/options.go +++ b/service/cloudwatchlogs/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codeartifact/api_client.go b/service/codeartifact/api_client.go index 6d316790c4c..e4c0f80c862 100644 --- a/service/codeartifact/api_client.go +++ b/service/codeartifact/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codeartifact/api_client_test.go b/service/codeartifact/api_client_test.go index 9c6ba06ec5c..a061658d00d 100644 --- a/service/codeartifact/api_client_test.go +++ b/service/codeartifact/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codeartifact/options.go b/service/codeartifact/options.go index b2761a75414..5e5558ae758 100644 --- a/service/codeartifact/options.go +++ b/service/codeartifact/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codebuild/api_client.go b/service/codebuild/api_client.go index 2f285d542ed..5d03878e2f6 100644 --- a/service/codebuild/api_client.go +++ b/service/codebuild/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codebuild/api_client_test.go b/service/codebuild/api_client_test.go index 04246f96b64..b8037338519 100644 --- a/service/codebuild/api_client_test.go +++ b/service/codebuild/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codebuild/options.go b/service/codebuild/options.go index 632ff39e2fc..c8dce451d25 100644 --- a/service/codebuild/options.go +++ b/service/codebuild/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codecatalyst/api_client.go b/service/codecatalyst/api_client.go index 648abd59025..b8e5c800548 100644 --- a/service/codecatalyst/api_client.go +++ b/service/codecatalyst/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveIdempotencyTokenProvider(&options) @@ -57,7 +59,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) wrapWithAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -332,7 +334,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codecatalyst/api_client_test.go b/service/codecatalyst/api_client_test.go index 1cab3295e8c..bd1d0430007 100644 --- a/service/codecatalyst/api_client_test.go +++ b/service/codecatalyst/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codecatalyst/options.go b/service/codecatalyst/options.go index 85d772cb0a2..742da5bef2f 100644 --- a/service/codecatalyst/options.go +++ b/service/codecatalyst/options.go @@ -73,11 +73,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codecommit/api_client.go b/service/codecommit/api_client.go index bda75a17230..bb5d92ffd86 100644 --- a/service/codecommit/api_client.go +++ b/service/codecommit/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codecommit/api_client_test.go b/service/codecommit/api_client_test.go index a82b49f8798..ba60bc44fbb 100644 --- a/service/codecommit/api_client_test.go +++ b/service/codecommit/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codecommit/options.go b/service/codecommit/options.go index b8366d5c39b..22ae7feaed4 100644 --- a/service/codecommit/options.go +++ b/service/codecommit/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codedeploy/api_client.go b/service/codedeploy/api_client.go index 9a42eecfa6e..a02a5633fb3 100644 --- a/service/codedeploy/api_client.go +++ b/service/codedeploy/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codedeploy/api_client_test.go b/service/codedeploy/api_client_test.go index 00e50d8240e..3de728e1111 100644 --- a/service/codedeploy/api_client_test.go +++ b/service/codedeploy/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codedeploy/options.go b/service/codedeploy/options.go index e118eed09ba..33557f60913 100644 --- a/service/codedeploy/options.go +++ b/service/codedeploy/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codeguruprofiler/api_client.go b/service/codeguruprofiler/api_client.go index 2d86ae04aed..18790253d25 100644 --- a/service/codeguruprofiler/api_client.go +++ b/service/codeguruprofiler/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codeguruprofiler/api_client_test.go b/service/codeguruprofiler/api_client_test.go index 32c3aefb534..4248ed30c6a 100644 --- a/service/codeguruprofiler/api_client_test.go +++ b/service/codeguruprofiler/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codeguruprofiler/options.go b/service/codeguruprofiler/options.go index 6ea9de22b5d..79b4bbbc346 100644 --- a/service/codeguruprofiler/options.go +++ b/service/codeguruprofiler/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codegurureviewer/api_client.go b/service/codegurureviewer/api_client.go index 4d21180576d..bd0e6c520fb 100644 --- a/service/codegurureviewer/api_client.go +++ b/service/codegurureviewer/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codegurureviewer/api_client_test.go b/service/codegurureviewer/api_client_test.go index 26e0244a039..e70b45cea33 100644 --- a/service/codegurureviewer/api_client_test.go +++ b/service/codegurureviewer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codegurureviewer/options.go b/service/codegurureviewer/options.go index 61c72bb8ee4..e2323cec481 100644 --- a/service/codegurureviewer/options.go +++ b/service/codegurureviewer/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codegurusecurity/api_client.go b/service/codegurusecurity/api_client.go index 68e34c56509..76aefb15708 100644 --- a/service/codegurusecurity/api_client.go +++ b/service/codegurusecurity/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codegurusecurity/api_client_test.go b/service/codegurusecurity/api_client_test.go index 8d38e7bcf7b..33726a31a47 100644 --- a/service/codegurusecurity/api_client_test.go +++ b/service/codegurusecurity/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codegurusecurity/options.go b/service/codegurusecurity/options.go index cf2c2b618c5..bd97b809f04 100644 --- a/service/codegurusecurity/options.go +++ b/service/codegurusecurity/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codepipeline/api_client.go b/service/codepipeline/api_client.go index 71c28944c21..708d6e42b19 100644 --- a/service/codepipeline/api_client.go +++ b/service/codepipeline/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codepipeline/api_client_test.go b/service/codepipeline/api_client_test.go index 951a89780f5..1ea0b0d37c6 100644 --- a/service/codepipeline/api_client_test.go +++ b/service/codepipeline/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codepipeline/options.go b/service/codepipeline/options.go index 56223a36146..4d6c61126da 100644 --- a/service/codepipeline/options.go +++ b/service/codepipeline/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codestar/api_client.go b/service/codestar/api_client.go index 188bfc1127e..0c7a7dc55c1 100644 --- a/service/codestar/api_client.go +++ b/service/codestar/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codestar/api_client_test.go b/service/codestar/api_client_test.go index 7d2f20faaab..4cc64c925da 100644 --- a/service/codestar/api_client_test.go +++ b/service/codestar/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codestar/options.go b/service/codestar/options.go index bc184a0209e..eb0b3a3769d 100644 --- a/service/codestar/options.go +++ b/service/codestar/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codestarconnections/api_client.go b/service/codestarconnections/api_client.go index 59606805415..9ebc922b780 100644 --- a/service/codestarconnections/api_client.go +++ b/service/codestarconnections/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codestarconnections/api_client_test.go b/service/codestarconnections/api_client_test.go index 387f5240014..33f2a2cf2d4 100644 --- a/service/codestarconnections/api_client_test.go +++ b/service/codestarconnections/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codestarconnections/options.go b/service/codestarconnections/options.go index 6910f3816c5..a6b2a51cc33 100644 --- a/service/codestarconnections/options.go +++ b/service/codestarconnections/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/codestarnotifications/api_client.go b/service/codestarnotifications/api_client.go index 51223c3d4a1..089831e8323 100644 --- a/service/codestarnotifications/api_client.go +++ b/service/codestarnotifications/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/codestarnotifications/api_client_test.go b/service/codestarnotifications/api_client_test.go index ac5bfbeaab9..b921c86f327 100644 --- a/service/codestarnotifications/api_client_test.go +++ b/service/codestarnotifications/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/codestarnotifications/options.go b/service/codestarnotifications/options.go index 7c3cf5d9ff6..589676ba4fe 100644 --- a/service/codestarnotifications/options.go +++ b/service/codestarnotifications/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cognitoidentity/api_client.go b/service/cognitoidentity/api_client.go index 0d4670120c6..5831e373997 100644 --- a/service/cognitoidentity/api_client.go +++ b/service/cognitoidentity/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cognitoidentity/api_client_test.go b/service/cognitoidentity/api_client_test.go index 9c3eaaf87af..1d657af9731 100644 --- a/service/cognitoidentity/api_client_test.go +++ b/service/cognitoidentity/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cognitoidentity/options.go b/service/cognitoidentity/options.go index e33e070cc88..118fe1e4b11 100644 --- a/service/cognitoidentity/options.go +++ b/service/cognitoidentity/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cognitoidentityprovider/api_client.go b/service/cognitoidentityprovider/api_client.go index 5d4e67b073e..8c094e0cbf4 100644 --- a/service/cognitoidentityprovider/api_client.go +++ b/service/cognitoidentityprovider/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cognitoidentityprovider/api_client_test.go b/service/cognitoidentityprovider/api_client_test.go index d50606f4c49..462f013d473 100644 --- a/service/cognitoidentityprovider/api_client_test.go +++ b/service/cognitoidentityprovider/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cognitoidentityprovider/options.go b/service/cognitoidentityprovider/options.go index 8f7598eabd3..ee635438352 100644 --- a/service/cognitoidentityprovider/options.go +++ b/service/cognitoidentityprovider/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/cognitosync/api_client.go b/service/cognitosync/api_client.go index 949cbf7ee98..cd952a6973b 100644 --- a/service/cognitosync/api_client.go +++ b/service/cognitosync/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/cognitosync/api_client_test.go b/service/cognitosync/api_client_test.go index 18d5713069a..5c64e84a8c5 100644 --- a/service/cognitosync/api_client_test.go +++ b/service/cognitosync/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/cognitosync/options.go b/service/cognitosync/options.go index dd58e3fbf6f..f8e75f64a9c 100644 --- a/service/cognitosync/options.go +++ b/service/cognitosync/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/comprehend/api_client.go b/service/comprehend/api_client.go index aed8f92708e..5b87feeed5c 100644 --- a/service/comprehend/api_client.go +++ b/service/comprehend/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/comprehend/api_client_test.go b/service/comprehend/api_client_test.go index 68ca9a4dedb..27bb923d688 100644 --- a/service/comprehend/api_client_test.go +++ b/service/comprehend/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/comprehend/options.go b/service/comprehend/options.go index b629fee4580..0c234fdb245 100644 --- a/service/comprehend/options.go +++ b/service/comprehend/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/comprehendmedical/api_client.go b/service/comprehendmedical/api_client.go index f60dbe8283a..7cf4131074d 100644 --- a/service/comprehendmedical/api_client.go +++ b/service/comprehendmedical/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/comprehendmedical/api_client_test.go b/service/comprehendmedical/api_client_test.go index 9bb3b1375b4..3740ecd27b8 100644 --- a/service/comprehendmedical/api_client_test.go +++ b/service/comprehendmedical/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/comprehendmedical/options.go b/service/comprehendmedical/options.go index 731c2b1d308..35f3814474e 100644 --- a/service/comprehendmedical/options.go +++ b/service/comprehendmedical/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/computeoptimizer/api_client.go b/service/computeoptimizer/api_client.go index ff41ed22d77..d4667e3c36c 100644 --- a/service/computeoptimizer/api_client.go +++ b/service/computeoptimizer/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/computeoptimizer/api_client_test.go b/service/computeoptimizer/api_client_test.go index 62a56f17cba..8fd9dad8367 100644 --- a/service/computeoptimizer/api_client_test.go +++ b/service/computeoptimizer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/computeoptimizer/options.go b/service/computeoptimizer/options.go index 40a0d88c8fd..4de24e20256 100644 --- a/service/computeoptimizer/options.go +++ b/service/computeoptimizer/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/configservice/api_client.go b/service/configservice/api_client.go index 7ac635d6294..3e7c6b33026 100644 --- a/service/configservice/api_client.go +++ b/service/configservice/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/configservice/api_client_test.go b/service/configservice/api_client_test.go index 567b838215e..0d26f106eb8 100644 --- a/service/configservice/api_client_test.go +++ b/service/configservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/configservice/options.go b/service/configservice/options.go index b0ba55a36f3..0d4c3c628c3 100644 --- a/service/configservice/options.go +++ b/service/configservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/connect/api_client.go b/service/connect/api_client.go index 8957975c8f6..30fe7e1077e 100644 --- a/service/connect/api_client.go +++ b/service/connect/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/connect/api_client_test.go b/service/connect/api_client_test.go index 12766f4dc80..8c657baa3af 100644 --- a/service/connect/api_client_test.go +++ b/service/connect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/connect/options.go b/service/connect/options.go index 22a86938bf8..637a92c76a4 100644 --- a/service/connect/options.go +++ b/service/connect/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/connectcampaigns/api_client.go b/service/connectcampaigns/api_client.go index 0724a34e40a..1e7ccbb025f 100644 --- a/service/connectcampaigns/api_client.go +++ b/service/connectcampaigns/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/connectcampaigns/api_client_test.go b/service/connectcampaigns/api_client_test.go index 36aad7cc533..3deafa1d961 100644 --- a/service/connectcampaigns/api_client_test.go +++ b/service/connectcampaigns/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/connectcampaigns/options.go b/service/connectcampaigns/options.go index 5d4b41c0d45..9a90478641f 100644 --- a/service/connectcampaigns/options.go +++ b/service/connectcampaigns/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/connectcases/api_client.go b/service/connectcases/api_client.go index 35deae7ea88..b8752124bf3 100644 --- a/service/connectcases/api_client.go +++ b/service/connectcases/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/connectcases/api_client_test.go b/service/connectcases/api_client_test.go index 76a439a00f3..0f1a5500b52 100644 --- a/service/connectcases/api_client_test.go +++ b/service/connectcases/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/connectcases/options.go b/service/connectcases/options.go index ca167e7055e..ad2305f38de 100644 --- a/service/connectcases/options.go +++ b/service/connectcases/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/connectcontactlens/api_client.go b/service/connectcontactlens/api_client.go index 732ad2db681..081d036414b 100644 --- a/service/connectcontactlens/api_client.go +++ b/service/connectcontactlens/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/connectcontactlens/api_client_test.go b/service/connectcontactlens/api_client_test.go index 69294f76003..ba079361afb 100644 --- a/service/connectcontactlens/api_client_test.go +++ b/service/connectcontactlens/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/connectcontactlens/options.go b/service/connectcontactlens/options.go index 28455ee762f..fbbeed58bba 100644 --- a/service/connectcontactlens/options.go +++ b/service/connectcontactlens/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/connectparticipant/api_client.go b/service/connectparticipant/api_client.go index bb79226ef75..eda4f324775 100644 --- a/service/connectparticipant/api_client.go +++ b/service/connectparticipant/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/connectparticipant/api_client_test.go b/service/connectparticipant/api_client_test.go index d2474efdd5d..c7c5a4f5b56 100644 --- a/service/connectparticipant/api_client_test.go +++ b/service/connectparticipant/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/connectparticipant/options.go b/service/connectparticipant/options.go index 30aa3a9591a..014b8e0bd42 100644 --- a/service/connectparticipant/options.go +++ b/service/connectparticipant/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/controltower/api_client.go b/service/controltower/api_client.go index 5123bb40901..9f75b82fb0b 100644 --- a/service/controltower/api_client.go +++ b/service/controltower/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/controltower/api_client_test.go b/service/controltower/api_client_test.go index 2da39fc1cd0..4e55dd3481f 100644 --- a/service/controltower/api_client_test.go +++ b/service/controltower/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/controltower/options.go b/service/controltower/options.go index 1e46739d68f..b4a656b1f8d 100644 --- a/service/controltower/options.go +++ b/service/controltower/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/costandusagereportservice/api_client.go b/service/costandusagereportservice/api_client.go index 98705089a69..5a9f088fe7d 100644 --- a/service/costandusagereportservice/api_client.go +++ b/service/costandusagereportservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/costandusagereportservice/api_client_test.go b/service/costandusagereportservice/api_client_test.go index 43b854da770..b212c2c780d 100644 --- a/service/costandusagereportservice/api_client_test.go +++ b/service/costandusagereportservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/costandusagereportservice/options.go b/service/costandusagereportservice/options.go index 7c4169b1b75..7efede34119 100644 --- a/service/costandusagereportservice/options.go +++ b/service/costandusagereportservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/costexplorer/api_client.go b/service/costexplorer/api_client.go index 8092a8f0a09..6512bc3aadb 100644 --- a/service/costexplorer/api_client.go +++ b/service/costexplorer/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/costexplorer/api_client_test.go b/service/costexplorer/api_client_test.go index 9fbc7d9f870..70a1149b880 100644 --- a/service/costexplorer/api_client_test.go +++ b/service/costexplorer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/costexplorer/options.go b/service/costexplorer/options.go index 05922092123..7303fa50a6e 100644 --- a/service/costexplorer/options.go +++ b/service/costexplorer/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/costoptimizationhub/api_client.go b/service/costoptimizationhub/api_client.go index 739767bc456..324177d268f 100644 --- a/service/costoptimizationhub/api_client.go +++ b/service/costoptimizationhub/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/costoptimizationhub/api_client_test.go b/service/costoptimizationhub/api_client_test.go index 265ff9311c1..d440cc366bf 100644 --- a/service/costoptimizationhub/api_client_test.go +++ b/service/costoptimizationhub/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/costoptimizationhub/options.go b/service/costoptimizationhub/options.go index 39941255691..3f035a3ed94 100644 --- a/service/costoptimizationhub/options.go +++ b/service/costoptimizationhub/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/customerprofiles/api_client.go b/service/customerprofiles/api_client.go index 1f73e9009cf..18b06256da3 100644 --- a/service/customerprofiles/api_client.go +++ b/service/customerprofiles/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/customerprofiles/api_client_test.go b/service/customerprofiles/api_client_test.go index efee63a5be4..ee6314647dd 100644 --- a/service/customerprofiles/api_client_test.go +++ b/service/customerprofiles/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/customerprofiles/options.go b/service/customerprofiles/options.go index c90f1ea0318..a35d77298a9 100644 --- a/service/customerprofiles/options.go +++ b/service/customerprofiles/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/databasemigrationservice/api_client.go b/service/databasemigrationservice/api_client.go index 00125b4996f..e2fa662bb3d 100644 --- a/service/databasemigrationservice/api_client.go +++ b/service/databasemigrationservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/databasemigrationservice/api_client_test.go b/service/databasemigrationservice/api_client_test.go index f7d3a7af651..74e1fa3af55 100644 --- a/service/databasemigrationservice/api_client_test.go +++ b/service/databasemigrationservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/databasemigrationservice/options.go b/service/databasemigrationservice/options.go index 9df0bb93e4e..58bf0bb961d 100644 --- a/service/databasemigrationservice/options.go +++ b/service/databasemigrationservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/databrew/api_client.go b/service/databrew/api_client.go index 7565aacfdad..59108ee9493 100644 --- a/service/databrew/api_client.go +++ b/service/databrew/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/databrew/api_client_test.go b/service/databrew/api_client_test.go index 125c614bd83..da3b27f45a5 100644 --- a/service/databrew/api_client_test.go +++ b/service/databrew/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/databrew/options.go b/service/databrew/options.go index 2a825c21f79..ce023fb8984 100644 --- a/service/databrew/options.go +++ b/service/databrew/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/dataexchange/api_client.go b/service/dataexchange/api_client.go index a512e26dc21..d64eb547ab4 100644 --- a/service/dataexchange/api_client.go +++ b/service/dataexchange/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/dataexchange/api_client_test.go b/service/dataexchange/api_client_test.go index 98246c5e304..7fff583b6f5 100644 --- a/service/dataexchange/api_client_test.go +++ b/service/dataexchange/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/dataexchange/options.go b/service/dataexchange/options.go index 2454169c899..e2a2012d48c 100644 --- a/service/dataexchange/options.go +++ b/service/dataexchange/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/datapipeline/api_client.go b/service/datapipeline/api_client.go index c8e2f7b7624..60d6709fd88 100644 --- a/service/datapipeline/api_client.go +++ b/service/datapipeline/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/datapipeline/api_client_test.go b/service/datapipeline/api_client_test.go index 01144e1f337..dda8d14913c 100644 --- a/service/datapipeline/api_client_test.go +++ b/service/datapipeline/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/datapipeline/options.go b/service/datapipeline/options.go index 727fb49d5d3..74ee6db58a9 100644 --- a/service/datapipeline/options.go +++ b/service/datapipeline/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/datasync/api_client.go b/service/datasync/api_client.go index 39cbb2480fd..0f913672e4a 100644 --- a/service/datasync/api_client.go +++ b/service/datasync/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/datasync/api_client_test.go b/service/datasync/api_client_test.go index fd05c8b1c07..b41d3a05446 100644 --- a/service/datasync/api_client_test.go +++ b/service/datasync/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/datasync/options.go b/service/datasync/options.go index 3b8c1675a95..454e8cedd9e 100644 --- a/service/datasync/options.go +++ b/service/datasync/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/datazone/api_client.go b/service/datazone/api_client.go index 6cab458dd3a..eaf9c878622 100644 --- a/service/datazone/api_client.go +++ b/service/datazone/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/datazone/api_client_test.go b/service/datazone/api_client_test.go index de5ed129556..e106f3dc8db 100644 --- a/service/datazone/api_client_test.go +++ b/service/datazone/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/datazone/options.go b/service/datazone/options.go index a8b27c4a8f9..5d525a95222 100644 --- a/service/datazone/options.go +++ b/service/datazone/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/dax/api_client.go b/service/dax/api_client.go index 12791756c5e..8217caf2a8e 100644 --- a/service/dax/api_client.go +++ b/service/dax/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/dax/api_client_test.go b/service/dax/api_client_test.go index 74f8b88b325..2106d173c6b 100644 --- a/service/dax/api_client_test.go +++ b/service/dax/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/dax/options.go b/service/dax/options.go index e07ae364ddc..4694ed39c0d 100644 --- a/service/dax/options.go +++ b/service/dax/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/detective/api_client.go b/service/detective/api_client.go index 537e918ee38..38bcebc6697 100644 --- a/service/detective/api_client.go +++ b/service/detective/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/detective/api_client_test.go b/service/detective/api_client_test.go index fdc7cf534e2..89c2d6e52a9 100644 --- a/service/detective/api_client_test.go +++ b/service/detective/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/detective/options.go b/service/detective/options.go index 392cb3b24a0..044d87d1e20 100644 --- a/service/detective/options.go +++ b/service/detective/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/devicefarm/api_client.go b/service/devicefarm/api_client.go index 8990aca3ecf..1ec7b650a63 100644 --- a/service/devicefarm/api_client.go +++ b/service/devicefarm/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/devicefarm/api_client_test.go b/service/devicefarm/api_client_test.go index 3c6db91397d..8d1c0db6112 100644 --- a/service/devicefarm/api_client_test.go +++ b/service/devicefarm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/devicefarm/options.go b/service/devicefarm/options.go index 037aecc00d1..6ea0d54a1ed 100644 --- a/service/devicefarm/options.go +++ b/service/devicefarm/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/devopsguru/api_client.go b/service/devopsguru/api_client.go index 6727ebaf62e..9e9755a8dd3 100644 --- a/service/devopsguru/api_client.go +++ b/service/devopsguru/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/devopsguru/api_client_test.go b/service/devopsguru/api_client_test.go index 82d6dc04197..602895e77d9 100644 --- a/service/devopsguru/api_client_test.go +++ b/service/devopsguru/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/devopsguru/options.go b/service/devopsguru/options.go index 8e8082ac588..07e231ee379 100644 --- a/service/devopsguru/options.go +++ b/service/devopsguru/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/directconnect/api_client.go b/service/directconnect/api_client.go index 2ab039de6b6..091dff66601 100644 --- a/service/directconnect/api_client.go +++ b/service/directconnect/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/directconnect/api_client_test.go b/service/directconnect/api_client_test.go index 0f05cd2641f..8f6cd6ed345 100644 --- a/service/directconnect/api_client_test.go +++ b/service/directconnect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/directconnect/options.go b/service/directconnect/options.go index 33cc83020c3..fc3615a5bbf 100644 --- a/service/directconnect/options.go +++ b/service/directconnect/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/directoryservice/api_client.go b/service/directoryservice/api_client.go index cac03cac497..9feb14aff56 100644 --- a/service/directoryservice/api_client.go +++ b/service/directoryservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/directoryservice/api_client_test.go b/service/directoryservice/api_client_test.go index 346e69ad780..321efbaf9ca 100644 --- a/service/directoryservice/api_client_test.go +++ b/service/directoryservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/directoryservice/options.go b/service/directoryservice/options.go index 5879887d4e7..24f9d04a966 100644 --- a/service/directoryservice/options.go +++ b/service/directoryservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/dlm/api_client.go b/service/dlm/api_client.go index fe36801e513..daf7fe7ab14 100644 --- a/service/dlm/api_client.go +++ b/service/dlm/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/dlm/api_client_test.go b/service/dlm/api_client_test.go index 4fc6e60c0d4..b1e9b11df98 100644 --- a/service/dlm/api_client_test.go +++ b/service/dlm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/dlm/options.go b/service/dlm/options.go index 29b8571233e..2d56b3befc2 100644 --- a/service/dlm/options.go +++ b/service/dlm/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/docdb/api_client.go b/service/docdb/api_client.go index d067c130089..b7f8b686a03 100644 --- a/service/docdb/api_client.go +++ b/service/docdb/api_client.go @@ -46,6 +46,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/docdb/api_client_test.go b/service/docdb/api_client_test.go index ce99298d8c8..eecd9cc0200 100644 --- a/service/docdb/api_client_test.go +++ b/service/docdb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/docdb/options.go b/service/docdb/options.go index a9ad411ea5a..c5964e219ad 100644 --- a/service/docdb/options.go +++ b/service/docdb/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/docdbelastic/api_client.go b/service/docdbelastic/api_client.go index 5e26c123f4d..798abfa0f9e 100644 --- a/service/docdbelastic/api_client.go +++ b/service/docdbelastic/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/docdbelastic/api_client_test.go b/service/docdbelastic/api_client_test.go index 92acccbb306..9089bc16d8d 100644 --- a/service/docdbelastic/api_client_test.go +++ b/service/docdbelastic/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/docdbelastic/options.go b/service/docdbelastic/options.go index f305f3640fc..c02ac3d11f2 100644 --- a/service/docdbelastic/options.go +++ b/service/docdbelastic/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/drs/api_client.go b/service/drs/api_client.go index a6527933c95..1347cef14c2 100644 --- a/service/drs/api_client.go +++ b/service/drs/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/drs/api_client_test.go b/service/drs/api_client_test.go index b494976ac38..a097bffe141 100644 --- a/service/drs/api_client_test.go +++ b/service/drs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/drs/options.go b/service/drs/options.go index 10caa52299e..cdf5589f34d 100644 --- a/service/drs/options.go +++ b/service/drs/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/dynamodb/api_client.go b/service/dynamodb/api_client.go index a554342e9e2..6e54d0328d2 100644 --- a/service/dynamodb/api_client.go +++ b/service/dynamodb/api_client.go @@ -52,6 +52,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -68,7 +70,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -103,7 +105,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -352,7 +354,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/dynamodb/api_client_test.go b/service/dynamodb/api_client_test.go index 6660a65b954..9232e3346e4 100644 --- a/service/dynamodb/api_client_test.go +++ b/service/dynamodb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/dynamodb/options.go b/service/dynamodb/options.go index ee8897f83c5..bf88e3b7635 100644 --- a/service/dynamodb/options.go +++ b/service/dynamodb/options.go @@ -85,11 +85,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/dynamodbstreams/api_client.go b/service/dynamodbstreams/api_client.go index 6081947e0b2..5bb9b0dc4b0 100644 --- a/service/dynamodbstreams/api_client.go +++ b/service/dynamodbstreams/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/dynamodbstreams/api_client_test.go b/service/dynamodbstreams/api_client_test.go index 70998ffc104..1d3ed1152e8 100644 --- a/service/dynamodbstreams/api_client_test.go +++ b/service/dynamodbstreams/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/dynamodbstreams/options.go b/service/dynamodbstreams/options.go index f5a191832f1..6304b262f06 100644 --- a/service/dynamodbstreams/options.go +++ b/service/dynamodbstreams/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ebs/api_client.go b/service/ebs/api_client.go index 9e481af8c9c..1158ab14ff0 100644 --- a/service/ebs/api_client.go +++ b/service/ebs/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ebs/api_client_test.go b/service/ebs/api_client_test.go index 83e457d48ca..f8d7f6b8a96 100644 --- a/service/ebs/api_client_test.go +++ b/service/ebs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ebs/options.go b/service/ebs/options.go index 8ae34c5423a..f36c486c948 100644 --- a/service/ebs/options.go +++ b/service/ebs/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ec2/api_client.go b/service/ec2/api_client.go index da76d590215..d8456843cab 100644 --- a/service/ec2/api_client.go +++ b/service/ec2/api_client.go @@ -48,6 +48,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -62,7 +64,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -95,7 +97,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -343,7 +345,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ec2/api_client_test.go b/service/ec2/api_client_test.go index 088e3d70da0..af524d9da09 100644 --- a/service/ec2/api_client_test.go +++ b/service/ec2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ec2/options.go b/service/ec2/options.go index 171ecd009f3..37cb69d205f 100644 --- a/service/ec2/options.go +++ b/service/ec2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ec2instanceconnect/api_client.go b/service/ec2instanceconnect/api_client.go index 82ca7d0417c..7ff6311ca28 100644 --- a/service/ec2instanceconnect/api_client.go +++ b/service/ec2instanceconnect/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ec2instanceconnect/api_client_test.go b/service/ec2instanceconnect/api_client_test.go index 2772294100f..87e174fcaeb 100644 --- a/service/ec2instanceconnect/api_client_test.go +++ b/service/ec2instanceconnect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ec2instanceconnect/options.go b/service/ec2instanceconnect/options.go index 0e863c7eaec..2816b454b5d 100644 --- a/service/ec2instanceconnect/options.go +++ b/service/ec2instanceconnect/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ecr/api_client.go b/service/ecr/api_client.go index 17ca3499401..f74882130ee 100644 --- a/service/ecr/api_client.go +++ b/service/ecr/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ecr/api_client_test.go b/service/ecr/api_client_test.go index cba7b8d99b1..bae4bc00985 100644 --- a/service/ecr/api_client_test.go +++ b/service/ecr/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ecr/options.go b/service/ecr/options.go index 356747f13ee..0de783e381c 100644 --- a/service/ecr/options.go +++ b/service/ecr/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ecrpublic/api_client.go b/service/ecrpublic/api_client.go index 581917e81bf..a9e71d814a1 100644 --- a/service/ecrpublic/api_client.go +++ b/service/ecrpublic/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ecrpublic/api_client_test.go b/service/ecrpublic/api_client_test.go index b04c466efd5..7b2aefed131 100644 --- a/service/ecrpublic/api_client_test.go +++ b/service/ecrpublic/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ecrpublic/options.go b/service/ecrpublic/options.go index 43e516a33e5..2845b43a8dd 100644 --- a/service/ecrpublic/options.go +++ b/service/ecrpublic/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ecs/api_client.go b/service/ecs/api_client.go index 3110e629762..93f29da2d20 100644 --- a/service/ecs/api_client.go +++ b/service/ecs/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ecs/api_client_test.go b/service/ecs/api_client_test.go index 83a1cf80997..9529d851a0d 100644 --- a/service/ecs/api_client_test.go +++ b/service/ecs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ecs/options.go b/service/ecs/options.go index c991e0a5df9..9ecc7a35755 100644 --- a/service/ecs/options.go +++ b/service/ecs/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/efs/api_client.go b/service/efs/api_client.go index 5669e1d2dd2..f066b2f68eb 100644 --- a/service/efs/api_client.go +++ b/service/efs/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/efs/api_client_test.go b/service/efs/api_client_test.go index aa9027baf1a..c60c8c3a3a0 100644 --- a/service/efs/api_client_test.go +++ b/service/efs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/efs/options.go b/service/efs/options.go index 85aa3e5e86f..069a24e4a55 100644 --- a/service/efs/options.go +++ b/service/efs/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/eks/api_client.go b/service/eks/api_client.go index 70afb30e9a8..f7bcc7c3d8a 100644 --- a/service/eks/api_client.go +++ b/service/eks/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/eks/api_client_test.go b/service/eks/api_client_test.go index 9c66035907f..db8a8dd18ba 100644 --- a/service/eks/api_client_test.go +++ b/service/eks/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/eks/options.go b/service/eks/options.go index ee1fae70615..631a8c6e949 100644 --- a/service/eks/options.go +++ b/service/eks/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/eksauth/api_client.go b/service/eksauth/api_client.go index 73f70937bf5..aef6d70c767 100644 --- a/service/eksauth/api_client.go +++ b/service/eksauth/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/eksauth/api_client_test.go b/service/eksauth/api_client_test.go index 5565b26608f..06df7fe026a 100644 --- a/service/eksauth/api_client_test.go +++ b/service/eksauth/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/eksauth/options.go b/service/eksauth/options.go index eb71ce5f467..9332828cd7b 100644 --- a/service/eksauth/options.go +++ b/service/eksauth/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticache/api_client.go b/service/elasticache/api_client.go index 67c38d29cd0..a2134c011db 100644 --- a/service/elasticache/api_client.go +++ b/service/elasticache/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticache/api_client_test.go b/service/elasticache/api_client_test.go index 508593e2a4c..8c9105dfcd3 100644 --- a/service/elasticache/api_client_test.go +++ b/service/elasticache/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticache/options.go b/service/elasticache/options.go index 7dbadf7e2ea..8ff05b5d872 100644 --- a/service/elasticache/options.go +++ b/service/elasticache/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticbeanstalk/api_client.go b/service/elasticbeanstalk/api_client.go index 42467361982..de60613ee01 100644 --- a/service/elasticbeanstalk/api_client.go +++ b/service/elasticbeanstalk/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticbeanstalk/api_client_test.go b/service/elasticbeanstalk/api_client_test.go index 0bda1249483..e57a01a3c07 100644 --- a/service/elasticbeanstalk/api_client_test.go +++ b/service/elasticbeanstalk/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticbeanstalk/options.go b/service/elasticbeanstalk/options.go index c92838e98f4..556136385fd 100644 --- a/service/elasticbeanstalk/options.go +++ b/service/elasticbeanstalk/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticinference/api_client.go b/service/elasticinference/api_client.go index 2ee5eeaec84..e295a0ba91f 100644 --- a/service/elasticinference/api_client.go +++ b/service/elasticinference/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticinference/api_client_test.go b/service/elasticinference/api_client_test.go index 09c5d8dcd7e..a95c1de4324 100644 --- a/service/elasticinference/api_client_test.go +++ b/service/elasticinference/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticinference/options.go b/service/elasticinference/options.go index 42c5d83a8db..a85a7dd5a28 100644 --- a/service/elasticinference/options.go +++ b/service/elasticinference/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticloadbalancing/api_client.go b/service/elasticloadbalancing/api_client.go index 663b2de3b0a..27ea617cd76 100644 --- a/service/elasticloadbalancing/api_client.go +++ b/service/elasticloadbalancing/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticloadbalancing/api_client_test.go b/service/elasticloadbalancing/api_client_test.go index bab15536c79..c531d5f21e5 100644 --- a/service/elasticloadbalancing/api_client_test.go +++ b/service/elasticloadbalancing/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticloadbalancing/options.go b/service/elasticloadbalancing/options.go index 894327e7119..e727763ea75 100644 --- a/service/elasticloadbalancing/options.go +++ b/service/elasticloadbalancing/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticloadbalancingv2/api_client.go b/service/elasticloadbalancingv2/api_client.go index fb4092a6a34..a15c94adb83 100644 --- a/service/elasticloadbalancingv2/api_client.go +++ b/service/elasticloadbalancingv2/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticloadbalancingv2/api_client_test.go b/service/elasticloadbalancingv2/api_client_test.go index 6b3134896a1..79be12c1e37 100644 --- a/service/elasticloadbalancingv2/api_client_test.go +++ b/service/elasticloadbalancingv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticloadbalancingv2/options.go b/service/elasticloadbalancingv2/options.go index 9e8fdb5aec8..8d973890d08 100644 --- a/service/elasticloadbalancingv2/options.go +++ b/service/elasticloadbalancingv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elasticsearchservice/api_client.go b/service/elasticsearchservice/api_client.go index 6eeb3d388b1..9e58807ddfa 100644 --- a/service/elasticsearchservice/api_client.go +++ b/service/elasticsearchservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elasticsearchservice/api_client_test.go b/service/elasticsearchservice/api_client_test.go index 820e0aef655..ec82307fac6 100644 --- a/service/elasticsearchservice/api_client_test.go +++ b/service/elasticsearchservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elasticsearchservice/options.go b/service/elasticsearchservice/options.go index 65170862fdb..c3e0bd9f3dc 100644 --- a/service/elasticsearchservice/options.go +++ b/service/elasticsearchservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/elastictranscoder/api_client.go b/service/elastictranscoder/api_client.go index 9769d091103..7b64bdb4541 100644 --- a/service/elastictranscoder/api_client.go +++ b/service/elastictranscoder/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/elastictranscoder/api_client_test.go b/service/elastictranscoder/api_client_test.go index a8b8f9fcb32..010d348f015 100644 --- a/service/elastictranscoder/api_client_test.go +++ b/service/elastictranscoder/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/elastictranscoder/options.go b/service/elastictranscoder/options.go index 7686a2f0cb0..f079c228073 100644 --- a/service/elastictranscoder/options.go +++ b/service/elastictranscoder/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/emr/api_client.go b/service/emr/api_client.go index 1cad0b849dd..52a6ab728c9 100644 --- a/service/emr/api_client.go +++ b/service/emr/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/emr/api_client_test.go b/service/emr/api_client_test.go index de185a91bd6..66f3bf058fc 100644 --- a/service/emr/api_client_test.go +++ b/service/emr/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/emr/options.go b/service/emr/options.go index 34fe982daa6..1eec3a958dc 100644 --- a/service/emr/options.go +++ b/service/emr/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/emrcontainers/api_client.go b/service/emrcontainers/api_client.go index afe2d5d01ac..3756ca2ab46 100644 --- a/service/emrcontainers/api_client.go +++ b/service/emrcontainers/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/emrcontainers/api_client_test.go b/service/emrcontainers/api_client_test.go index 9c70faff5df..418a92b47d8 100644 --- a/service/emrcontainers/api_client_test.go +++ b/service/emrcontainers/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/emrcontainers/options.go b/service/emrcontainers/options.go index 9bedd3f10a0..44235eaa69e 100644 --- a/service/emrcontainers/options.go +++ b/service/emrcontainers/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/emrserverless/api_client.go b/service/emrserverless/api_client.go index 731380d9803..cc257d7576c 100644 --- a/service/emrserverless/api_client.go +++ b/service/emrserverless/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/emrserverless/api_client_test.go b/service/emrserverless/api_client_test.go index 6f04f97969e..24bfa914165 100644 --- a/service/emrserverless/api_client_test.go +++ b/service/emrserverless/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/emrserverless/options.go b/service/emrserverless/options.go index 77182470f7c..9846f62e8c8 100644 --- a/service/emrserverless/options.go +++ b/service/emrserverless/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/entityresolution/api_client.go b/service/entityresolution/api_client.go index 2e389ff5b68..ba5fb293cf5 100644 --- a/service/entityresolution/api_client.go +++ b/service/entityresolution/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/entityresolution/api_client_test.go b/service/entityresolution/api_client_test.go index 7433efd5a97..4c94dcd57ce 100644 --- a/service/entityresolution/api_client_test.go +++ b/service/entityresolution/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/entityresolution/options.go b/service/entityresolution/options.go index 2b03b82546a..6ed3e8aa213 100644 --- a/service/entityresolution/options.go +++ b/service/entityresolution/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/eventbridge/api_client.go b/service/eventbridge/api_client.go index d3d9f681743..b5da74926ff 100644 --- a/service/eventbridge/api_client.go +++ b/service/eventbridge/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) resolveCredentialProvider(&options) @@ -93,7 +95,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -350,7 +352,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/eventbridge/api_client_test.go b/service/eventbridge/api_client_test.go index 149b27c5aac..8aa95178693 100644 --- a/service/eventbridge/api_client_test.go +++ b/service/eventbridge/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/eventbridge/options.go b/service/eventbridge/options.go index bd92d1a31f4..8784fd46d99 100644 --- a/service/eventbridge/options.go +++ b/service/eventbridge/options.go @@ -72,11 +72,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/evidently/api_client.go b/service/evidently/api_client.go index 4d0be6b0afe..aed8455a685 100644 --- a/service/evidently/api_client.go +++ b/service/evidently/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/evidently/api_client_test.go b/service/evidently/api_client_test.go index 4c1a2c16a9d..cc246fbda19 100644 --- a/service/evidently/api_client_test.go +++ b/service/evidently/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/evidently/options.go b/service/evidently/options.go index 45695851784..d48d85e5264 100644 --- a/service/evidently/options.go +++ b/service/evidently/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/finspace/api_client.go b/service/finspace/api_client.go index e829150a0ac..486a6799118 100644 --- a/service/finspace/api_client.go +++ b/service/finspace/api_client.go @@ -46,6 +46,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -60,7 +62,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -93,7 +95,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -341,7 +343,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/finspace/api_client_test.go b/service/finspace/api_client_test.go index 0c7f6030bcd..a397fca1916 100644 --- a/service/finspace/api_client_test.go +++ b/service/finspace/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/finspace/options.go b/service/finspace/options.go index 7431bc9a1e3..d05e3f637db 100644 --- a/service/finspace/options.go +++ b/service/finspace/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/finspacedata/api_client.go b/service/finspacedata/api_client.go index e9ff85bf39a..f845e2efab4 100644 --- a/service/finspacedata/api_client.go +++ b/service/finspacedata/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/finspacedata/api_client_test.go b/service/finspacedata/api_client_test.go index 0e9759d3fbd..2d03552d0a2 100644 --- a/service/finspacedata/api_client_test.go +++ b/service/finspacedata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/finspacedata/options.go b/service/finspacedata/options.go index a43803a6333..ce1e20d6833 100644 --- a/service/finspacedata/options.go +++ b/service/finspacedata/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/firehose/api_client.go b/service/firehose/api_client.go index b21452576f1..b82b5493162 100644 --- a/service/firehose/api_client.go +++ b/service/firehose/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/firehose/api_client_test.go b/service/firehose/api_client_test.go index af11390365e..492ec5d8014 100644 --- a/service/firehose/api_client_test.go +++ b/service/firehose/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/firehose/options.go b/service/firehose/options.go index a25da4fcad2..3cd93b7b433 100644 --- a/service/firehose/options.go +++ b/service/firehose/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/fis/api_client.go b/service/fis/api_client.go index 5d8ce17508c..33f8df0c913 100644 --- a/service/fis/api_client.go +++ b/service/fis/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/fis/api_client_test.go b/service/fis/api_client_test.go index 993d2539943..38492b814e6 100644 --- a/service/fis/api_client_test.go +++ b/service/fis/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/fis/options.go b/service/fis/options.go index 16bb3680b6f..0e200e39066 100644 --- a/service/fis/options.go +++ b/service/fis/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/fms/api_client.go b/service/fms/api_client.go index 3eeb310c417..dc13905d692 100644 --- a/service/fms/api_client.go +++ b/service/fms/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/fms/api_client_test.go b/service/fms/api_client_test.go index 7f0089f4ab5..305d7d97954 100644 --- a/service/fms/api_client_test.go +++ b/service/fms/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/fms/options.go b/service/fms/options.go index fffcf95b3f4..2105e2eabb0 100644 --- a/service/fms/options.go +++ b/service/fms/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/forecast/api_client.go b/service/forecast/api_client.go index aa44ce23c3f..ea72a0e3fbf 100644 --- a/service/forecast/api_client.go +++ b/service/forecast/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/forecast/api_client_test.go b/service/forecast/api_client_test.go index 7e8ec57878a..6c59f3dbedc 100644 --- a/service/forecast/api_client_test.go +++ b/service/forecast/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/forecast/options.go b/service/forecast/options.go index 1264f451689..0cbc85cecd7 100644 --- a/service/forecast/options.go +++ b/service/forecast/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/forecastquery/api_client.go b/service/forecastquery/api_client.go index 61d1817ba1b..7da40e8caed 100644 --- a/service/forecastquery/api_client.go +++ b/service/forecastquery/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/forecastquery/api_client_test.go b/service/forecastquery/api_client_test.go index a21782807a9..2c5be237298 100644 --- a/service/forecastquery/api_client_test.go +++ b/service/forecastquery/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/forecastquery/options.go b/service/forecastquery/options.go index 156f6066201..bfd8c7ed464 100644 --- a/service/forecastquery/options.go +++ b/service/forecastquery/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/frauddetector/api_client.go b/service/frauddetector/api_client.go index 4591384c275..b0b690a2d56 100644 --- a/service/frauddetector/api_client.go +++ b/service/frauddetector/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/frauddetector/api_client_test.go b/service/frauddetector/api_client_test.go index 243e72419cd..2ece1a477ed 100644 --- a/service/frauddetector/api_client_test.go +++ b/service/frauddetector/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/frauddetector/options.go b/service/frauddetector/options.go index c8d88a52aaf..1d2051b056b 100644 --- a/service/frauddetector/options.go +++ b/service/frauddetector/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/freetier/api_client.go b/service/freetier/api_client.go index 16e84927d8b..19b4c569a04 100644 --- a/service/freetier/api_client.go +++ b/service/freetier/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/freetier/api_client_test.go b/service/freetier/api_client_test.go index c2ca03724c7..0efd75982b9 100644 --- a/service/freetier/api_client_test.go +++ b/service/freetier/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/freetier/options.go b/service/freetier/options.go index 3517d989c67..432e3f85ff0 100644 --- a/service/freetier/options.go +++ b/service/freetier/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/fsx/api_client.go b/service/fsx/api_client.go index 45ee611d6ab..4bc87eca7b0 100644 --- a/service/fsx/api_client.go +++ b/service/fsx/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/fsx/api_client_test.go b/service/fsx/api_client_test.go index ef03a9e21b3..55286ab5ea0 100644 --- a/service/fsx/api_client_test.go +++ b/service/fsx/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/fsx/options.go b/service/fsx/options.go index ad3e7b0f896..b5ee9bcef82 100644 --- a/service/fsx/options.go +++ b/service/fsx/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/gamelift/api_client.go b/service/gamelift/api_client.go index f8c3769c9f7..9c91f0d2803 100644 --- a/service/gamelift/api_client.go +++ b/service/gamelift/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/gamelift/api_client_test.go b/service/gamelift/api_client_test.go index f67a0dcfe09..ecc91875a78 100644 --- a/service/gamelift/api_client_test.go +++ b/service/gamelift/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/gamelift/options.go b/service/gamelift/options.go index 36e75fd5be8..e7f7d52575c 100644 --- a/service/gamelift/options.go +++ b/service/gamelift/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/glacier/api_client.go b/service/glacier/api_client.go index 27d348368d3..766f83f35ff 100644 --- a/service/glacier/api_client.go +++ b/service/glacier/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/glacier/api_client_test.go b/service/glacier/api_client_test.go index a04eef1d730..559303468f4 100644 --- a/service/glacier/api_client_test.go +++ b/service/glacier/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/glacier/options.go b/service/glacier/options.go index 841f87e2f6c..d2555d6d115 100644 --- a/service/glacier/options.go +++ b/service/glacier/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/globalaccelerator/api_client.go b/service/globalaccelerator/api_client.go index a7ce8f1ccdb..baf05e611d8 100644 --- a/service/globalaccelerator/api_client.go +++ b/service/globalaccelerator/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/globalaccelerator/api_client_test.go b/service/globalaccelerator/api_client_test.go index 0d8223e908e..54f99bb702f 100644 --- a/service/globalaccelerator/api_client_test.go +++ b/service/globalaccelerator/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/globalaccelerator/options.go b/service/globalaccelerator/options.go index f1b6a63f9e8..06c47c2a1c4 100644 --- a/service/globalaccelerator/options.go +++ b/service/globalaccelerator/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/glue/api_client.go b/service/glue/api_client.go index f585e8e3aff..40bd84bb622 100644 --- a/service/glue/api_client.go +++ b/service/glue/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/glue/api_client_test.go b/service/glue/api_client_test.go index 8c0d9a17aaa..40ecb7c91de 100644 --- a/service/glue/api_client_test.go +++ b/service/glue/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/glue/options.go b/service/glue/options.go index 6afeed444e7..421fb06101a 100644 --- a/service/glue/options.go +++ b/service/glue/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/grafana/api_client.go b/service/grafana/api_client.go index dc8e3cf8534..1c53c378a3b 100644 --- a/service/grafana/api_client.go +++ b/service/grafana/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/grafana/api_client_test.go b/service/grafana/api_client_test.go index 575507efd98..68155c39dbd 100644 --- a/service/grafana/api_client_test.go +++ b/service/grafana/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/grafana/options.go b/service/grafana/options.go index 2ba89e44622..07343295723 100644 --- a/service/grafana/options.go +++ b/service/grafana/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/greengrass/api_client.go b/service/greengrass/api_client.go index 1f240b37342..7239e78f5d1 100644 --- a/service/greengrass/api_client.go +++ b/service/greengrass/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/greengrass/api_client_test.go b/service/greengrass/api_client_test.go index 2e989e0c140..44615e8cdd3 100644 --- a/service/greengrass/api_client_test.go +++ b/service/greengrass/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/greengrass/options.go b/service/greengrass/options.go index b52006133ce..0d05863cc73 100644 --- a/service/greengrass/options.go +++ b/service/greengrass/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/greengrassv2/api_client.go b/service/greengrassv2/api_client.go index dcfac712120..1ab48153aed 100644 --- a/service/greengrassv2/api_client.go +++ b/service/greengrassv2/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/greengrassv2/api_client_test.go b/service/greengrassv2/api_client_test.go index 1cbb0581b5b..3792432895e 100644 --- a/service/greengrassv2/api_client_test.go +++ b/service/greengrassv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/greengrassv2/options.go b/service/greengrassv2/options.go index a55cda59f18..92d1b73838b 100644 --- a/service/greengrassv2/options.go +++ b/service/greengrassv2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/groundstation/api_client.go b/service/groundstation/api_client.go index e12ffabff75..e9bcc1b5cea 100644 --- a/service/groundstation/api_client.go +++ b/service/groundstation/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/groundstation/api_client_test.go b/service/groundstation/api_client_test.go index 9da860e8e91..90479c81a87 100644 --- a/service/groundstation/api_client_test.go +++ b/service/groundstation/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/groundstation/options.go b/service/groundstation/options.go index 3f4e9938823..c744e570d72 100644 --- a/service/groundstation/options.go +++ b/service/groundstation/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/guardduty/api_client.go b/service/guardduty/api_client.go index 31b75aa71c7..124e639eb78 100644 --- a/service/guardduty/api_client.go +++ b/service/guardduty/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/guardduty/api_client_test.go b/service/guardduty/api_client_test.go index 7722957a468..2e7cb6187d1 100644 --- a/service/guardduty/api_client_test.go +++ b/service/guardduty/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/guardduty/options.go b/service/guardduty/options.go index 9b5f0cdd64f..8c40066092d 100644 --- a/service/guardduty/options.go +++ b/service/guardduty/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/health/api_client.go b/service/health/api_client.go index 8c9b663155e..a5fab6c9875 100644 --- a/service/health/api_client.go +++ b/service/health/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/health/api_client_test.go b/service/health/api_client_test.go index 5d9c5f1d4b0..11beeac8c57 100644 --- a/service/health/api_client_test.go +++ b/service/health/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/health/options.go b/service/health/options.go index 620b052aa5a..a820fd9d525 100644 --- a/service/health/options.go +++ b/service/health/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/healthlake/api_client.go b/service/healthlake/api_client.go index 09ba20bb6ed..005ff95cbc3 100644 --- a/service/healthlake/api_client.go +++ b/service/healthlake/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/healthlake/api_client_test.go b/service/healthlake/api_client_test.go index 54ff81eb140..6e6a2480469 100644 --- a/service/healthlake/api_client_test.go +++ b/service/healthlake/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/healthlake/options.go b/service/healthlake/options.go index dc8dd288c34..49ab3b42377 100644 --- a/service/healthlake/options.go +++ b/service/healthlake/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/honeycode/api_client.go b/service/honeycode/api_client.go index 76b2c591e73..a5572474d14 100644 --- a/service/honeycode/api_client.go +++ b/service/honeycode/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/honeycode/api_client_test.go b/service/honeycode/api_client_test.go index e4ecfc98925..c797e8f20d7 100644 --- a/service/honeycode/api_client_test.go +++ b/service/honeycode/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/honeycode/options.go b/service/honeycode/options.go index d1a70b9ca32..aee88c423f5 100644 --- a/service/honeycode/options.go +++ b/service/honeycode/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iam/api_client.go b/service/iam/api_client.go index f77be1578f8..5d38106aecc 100644 --- a/service/iam/api_client.go +++ b/service/iam/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iam/api_client_test.go b/service/iam/api_client_test.go index eafb244c676..8a7908aaf84 100644 --- a/service/iam/api_client_test.go +++ b/service/iam/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iam/options.go b/service/iam/options.go index e95e9851252..9dc917618cf 100644 --- a/service/iam/options.go +++ b/service/iam/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/identitystore/api_client.go b/service/identitystore/api_client.go index 7fa193ae0fa..89d6c42e671 100644 --- a/service/identitystore/api_client.go +++ b/service/identitystore/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/identitystore/api_client_test.go b/service/identitystore/api_client_test.go index b163b64222a..fc3dbdd3441 100644 --- a/service/identitystore/api_client_test.go +++ b/service/identitystore/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/identitystore/options.go b/service/identitystore/options.go index 278ca3b7fb2..4d799bfbe1d 100644 --- a/service/identitystore/options.go +++ b/service/identitystore/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/imagebuilder/api_client.go b/service/imagebuilder/api_client.go index 11f4eccff31..1675f1a7bdb 100644 --- a/service/imagebuilder/api_client.go +++ b/service/imagebuilder/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/imagebuilder/api_client_test.go b/service/imagebuilder/api_client_test.go index 91ff93fd60a..b92a3e23d65 100644 --- a/service/imagebuilder/api_client_test.go +++ b/service/imagebuilder/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/imagebuilder/options.go b/service/imagebuilder/options.go index 7c1adcd85f3..8d6360bb408 100644 --- a/service/imagebuilder/options.go +++ b/service/imagebuilder/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/inspector/api_client.go b/service/inspector/api_client.go index 6d0c547240a..f4d1ff8b807 100644 --- a/service/inspector/api_client.go +++ b/service/inspector/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/inspector/api_client_test.go b/service/inspector/api_client_test.go index fcedad2590d..0ef0b02fd38 100644 --- a/service/inspector/api_client_test.go +++ b/service/inspector/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/inspector/options.go b/service/inspector/options.go index edb6290e3d5..61d1610916f 100644 --- a/service/inspector/options.go +++ b/service/inspector/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/inspector2/api_client.go b/service/inspector2/api_client.go index 7239884f5b7..9afceaf2f10 100644 --- a/service/inspector2/api_client.go +++ b/service/inspector2/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/inspector2/api_client_test.go b/service/inspector2/api_client_test.go index 7e2b64b26e3..04ad37c1081 100644 --- a/service/inspector2/api_client_test.go +++ b/service/inspector2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/inspector2/options.go b/service/inspector2/options.go index 72ec2a36b08..7f2ffd7de25 100644 --- a/service/inspector2/options.go +++ b/service/inspector2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/inspectorscan/api_client.go b/service/inspectorscan/api_client.go index 94dbd881654..3b146a7116a 100644 --- a/service/inspectorscan/api_client.go +++ b/service/inspectorscan/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/inspectorscan/api_client_test.go b/service/inspectorscan/api_client_test.go index 9da644c59b6..d31766a8751 100644 --- a/service/inspectorscan/api_client_test.go +++ b/service/inspectorscan/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/inspectorscan/options.go b/service/inspectorscan/options.go index 8403491a573..bb5adfd027c 100644 --- a/service/inspectorscan/options.go +++ b/service/inspectorscan/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/internetmonitor/api_client.go b/service/internetmonitor/api_client.go index 6d6f7db2152..c31b53565d3 100644 --- a/service/internetmonitor/api_client.go +++ b/service/internetmonitor/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/internetmonitor/api_client_test.go b/service/internetmonitor/api_client_test.go index c8fc40d2fd3..c2076873af6 100644 --- a/service/internetmonitor/api_client_test.go +++ b/service/internetmonitor/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/internetmonitor/options.go b/service/internetmonitor/options.go index fbb26f955af..eb145a63961 100644 --- a/service/internetmonitor/options.go +++ b/service/internetmonitor/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iot/api_client.go b/service/iot/api_client.go index 0430253100e..519b3ec012f 100644 --- a/service/iot/api_client.go +++ b/service/iot/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iot/api_client_test.go b/service/iot/api_client_test.go index 00a7c45541c..8389f8e5be8 100644 --- a/service/iot/api_client_test.go +++ b/service/iot/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iot/options.go b/service/iot/options.go index 33b3e2fac4b..199ca1c2b5f 100644 --- a/service/iot/options.go +++ b/service/iot/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iot1clickdevicesservice/api_client.go b/service/iot1clickdevicesservice/api_client.go index 8c9e87e65a9..3c7b030d2c9 100644 --- a/service/iot1clickdevicesservice/api_client.go +++ b/service/iot1clickdevicesservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iot1clickdevicesservice/api_client_test.go b/service/iot1clickdevicesservice/api_client_test.go index 45449134c1f..54323d736e2 100644 --- a/service/iot1clickdevicesservice/api_client_test.go +++ b/service/iot1clickdevicesservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iot1clickdevicesservice/options.go b/service/iot1clickdevicesservice/options.go index db81768461d..2fa8d97b754 100644 --- a/service/iot1clickdevicesservice/options.go +++ b/service/iot1clickdevicesservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iot1clickprojects/api_client.go b/service/iot1clickprojects/api_client.go index 72f597e3158..df1f9a7b0d7 100644 --- a/service/iot1clickprojects/api_client.go +++ b/service/iot1clickprojects/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iot1clickprojects/api_client_test.go b/service/iot1clickprojects/api_client_test.go index fabe3424600..6e3d4725e82 100644 --- a/service/iot1clickprojects/api_client_test.go +++ b/service/iot1clickprojects/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iot1clickprojects/options.go b/service/iot1clickprojects/options.go index 3eb8ff9d7b6..c13808d2377 100644 --- a/service/iot1clickprojects/options.go +++ b/service/iot1clickprojects/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotanalytics/api_client.go b/service/iotanalytics/api_client.go index 85af1a489f0..492acc2b50c 100644 --- a/service/iotanalytics/api_client.go +++ b/service/iotanalytics/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotanalytics/api_client_test.go b/service/iotanalytics/api_client_test.go index 2459ab861e5..0d820fb61c4 100644 --- a/service/iotanalytics/api_client_test.go +++ b/service/iotanalytics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotanalytics/options.go b/service/iotanalytics/options.go index c1829e5162b..ab3fe3f26d8 100644 --- a/service/iotanalytics/options.go +++ b/service/iotanalytics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotdataplane/api_client.go b/service/iotdataplane/api_client.go index 2512ee050b8..3818b6fd2d4 100644 --- a/service/iotdataplane/api_client.go +++ b/service/iotdataplane/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotdataplane/api_client_test.go b/service/iotdataplane/api_client_test.go index ae103007040..e4ff95cfece 100644 --- a/service/iotdataplane/api_client_test.go +++ b/service/iotdataplane/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotdataplane/options.go b/service/iotdataplane/options.go index 33acd92838c..8e802fe6d09 100644 --- a/service/iotdataplane/options.go +++ b/service/iotdataplane/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotdeviceadvisor/api_client.go b/service/iotdeviceadvisor/api_client.go index e4981fb28ce..25496ac786d 100644 --- a/service/iotdeviceadvisor/api_client.go +++ b/service/iotdeviceadvisor/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotdeviceadvisor/api_client_test.go b/service/iotdeviceadvisor/api_client_test.go index c161f8e0d33..0d5a466ebfb 100644 --- a/service/iotdeviceadvisor/api_client_test.go +++ b/service/iotdeviceadvisor/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotdeviceadvisor/options.go b/service/iotdeviceadvisor/options.go index ba7fb3ffee5..caba27c91ba 100644 --- a/service/iotdeviceadvisor/options.go +++ b/service/iotdeviceadvisor/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotevents/api_client.go b/service/iotevents/api_client.go index 76cf98c71fd..c9d98db9733 100644 --- a/service/iotevents/api_client.go +++ b/service/iotevents/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotevents/api_client_test.go b/service/iotevents/api_client_test.go index 8812d15d9ef..370df150475 100644 --- a/service/iotevents/api_client_test.go +++ b/service/iotevents/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotevents/options.go b/service/iotevents/options.go index d3d39579f74..27666fc52a3 100644 --- a/service/iotevents/options.go +++ b/service/iotevents/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ioteventsdata/api_client.go b/service/ioteventsdata/api_client.go index bca737f0797..d95a7b2511c 100644 --- a/service/ioteventsdata/api_client.go +++ b/service/ioteventsdata/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ioteventsdata/api_client_test.go b/service/ioteventsdata/api_client_test.go index 6c736fca1e5..67e9851177d 100644 --- a/service/ioteventsdata/api_client_test.go +++ b/service/ioteventsdata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ioteventsdata/options.go b/service/ioteventsdata/options.go index d171eeec5b3..a3338820dd7 100644 --- a/service/ioteventsdata/options.go +++ b/service/ioteventsdata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotfleethub/api_client.go b/service/iotfleethub/api_client.go index 5dc3681e8a3..229e658030d 100644 --- a/service/iotfleethub/api_client.go +++ b/service/iotfleethub/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotfleethub/api_client_test.go b/service/iotfleethub/api_client_test.go index 09f62c53ce6..c98a51bcfcc 100644 --- a/service/iotfleethub/api_client_test.go +++ b/service/iotfleethub/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotfleethub/options.go b/service/iotfleethub/options.go index fb2d5b63829..5914b462b71 100644 --- a/service/iotfleethub/options.go +++ b/service/iotfleethub/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotfleetwise/api_client.go b/service/iotfleetwise/api_client.go index c696b97b9ca..f12a101247d 100644 --- a/service/iotfleetwise/api_client.go +++ b/service/iotfleetwise/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotfleetwise/api_client_test.go b/service/iotfleetwise/api_client_test.go index 49778ae9ceb..ecfb2d3d79c 100644 --- a/service/iotfleetwise/api_client_test.go +++ b/service/iotfleetwise/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotfleetwise/options.go b/service/iotfleetwise/options.go index adc67277582..3bc794cb501 100644 --- a/service/iotfleetwise/options.go +++ b/service/iotfleetwise/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotjobsdataplane/api_client.go b/service/iotjobsdataplane/api_client.go index 49838f07ae4..9cf1529cc03 100644 --- a/service/iotjobsdataplane/api_client.go +++ b/service/iotjobsdataplane/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotjobsdataplane/api_client_test.go b/service/iotjobsdataplane/api_client_test.go index 056f3dcf423..446ecc20393 100644 --- a/service/iotjobsdataplane/api_client_test.go +++ b/service/iotjobsdataplane/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotjobsdataplane/options.go b/service/iotjobsdataplane/options.go index f2434d18afb..036fc7d5a3d 100644 --- a/service/iotjobsdataplane/options.go +++ b/service/iotjobsdataplane/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotroborunner/api_client.go b/service/iotroborunner/api_client.go index ccb4ff8860c..0c17961849b 100644 --- a/service/iotroborunner/api_client.go +++ b/service/iotroborunner/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotroborunner/api_client_test.go b/service/iotroborunner/api_client_test.go index bd6b285d6df..90396e238a8 100644 --- a/service/iotroborunner/api_client_test.go +++ b/service/iotroborunner/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotroborunner/options.go b/service/iotroborunner/options.go index e60af1f18ad..66da194453c 100644 --- a/service/iotroborunner/options.go +++ b/service/iotroborunner/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotsecuretunneling/api_client.go b/service/iotsecuretunneling/api_client.go index 3141eba1d7a..4b053479eb6 100644 --- a/service/iotsecuretunneling/api_client.go +++ b/service/iotsecuretunneling/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotsecuretunneling/api_client_test.go b/service/iotsecuretunneling/api_client_test.go index 867694b3066..02bd6f48b31 100644 --- a/service/iotsecuretunneling/api_client_test.go +++ b/service/iotsecuretunneling/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotsecuretunneling/options.go b/service/iotsecuretunneling/options.go index 3b6023d9cd7..25e5ad67504 100644 --- a/service/iotsecuretunneling/options.go +++ b/service/iotsecuretunneling/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotsitewise/api_client.go b/service/iotsitewise/api_client.go index 736d3b1e3a9..d41c68d0b0a 100644 --- a/service/iotsitewise/api_client.go +++ b/service/iotsitewise/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotsitewise/api_client_test.go b/service/iotsitewise/api_client_test.go index 409a0996053..c73e0fc9eb6 100644 --- a/service/iotsitewise/api_client_test.go +++ b/service/iotsitewise/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotsitewise/options.go b/service/iotsitewise/options.go index 35fe799a7e6..af7c6568caf 100644 --- a/service/iotsitewise/options.go +++ b/service/iotsitewise/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotthingsgraph/api_client.go b/service/iotthingsgraph/api_client.go index bf2f5044af0..bfc8e4f9899 100644 --- a/service/iotthingsgraph/api_client.go +++ b/service/iotthingsgraph/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotthingsgraph/api_client_test.go b/service/iotthingsgraph/api_client_test.go index a6c0cb4a014..315d7b6f3bd 100644 --- a/service/iotthingsgraph/api_client_test.go +++ b/service/iotthingsgraph/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotthingsgraph/options.go b/service/iotthingsgraph/options.go index 514ad73f7cb..489330e364f 100644 --- a/service/iotthingsgraph/options.go +++ b/service/iotthingsgraph/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iottwinmaker/api_client.go b/service/iottwinmaker/api_client.go index ccec2c8a673..cc32e441eb0 100644 --- a/service/iottwinmaker/api_client.go +++ b/service/iottwinmaker/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iottwinmaker/api_client_test.go b/service/iottwinmaker/api_client_test.go index a7fbae4ed05..0ccd9939b0f 100644 --- a/service/iottwinmaker/api_client_test.go +++ b/service/iottwinmaker/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iottwinmaker/options.go b/service/iottwinmaker/options.go index c090b42fc02..b383a8eefbd 100644 --- a/service/iottwinmaker/options.go +++ b/service/iottwinmaker/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/iotwireless/api_client.go b/service/iotwireless/api_client.go index a542874a652..f1af554281f 100644 --- a/service/iotwireless/api_client.go +++ b/service/iotwireless/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/iotwireless/api_client_test.go b/service/iotwireless/api_client_test.go index c8acbdbf48b..a59ee9252af 100644 --- a/service/iotwireless/api_client_test.go +++ b/service/iotwireless/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/iotwireless/options.go b/service/iotwireless/options.go index 68fe6fa1303..e09b0f114a6 100644 --- a/service/iotwireless/options.go +++ b/service/iotwireless/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ivs/api_client.go b/service/ivs/api_client.go index e506e9c00e9..407e79125d3 100644 --- a/service/ivs/api_client.go +++ b/service/ivs/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ivs/api_client_test.go b/service/ivs/api_client_test.go index 917e6706de9..1891cf3311d 100644 --- a/service/ivs/api_client_test.go +++ b/service/ivs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ivs/options.go b/service/ivs/options.go index c506c324986..42de105a27b 100644 --- a/service/ivs/options.go +++ b/service/ivs/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ivschat/api_client.go b/service/ivschat/api_client.go index d968f78cc8a..70c10bcbbd4 100644 --- a/service/ivschat/api_client.go +++ b/service/ivschat/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ivschat/api_client_test.go b/service/ivschat/api_client_test.go index cefadda0cc0..5d42f594b2c 100644 --- a/service/ivschat/api_client_test.go +++ b/service/ivschat/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ivschat/options.go b/service/ivschat/options.go index a2cd7ba0531..5ac40291045 100644 --- a/service/ivschat/options.go +++ b/service/ivschat/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ivsrealtime/api_client.go b/service/ivsrealtime/api_client.go index 6affda49c41..f0d26f99e1c 100644 --- a/service/ivsrealtime/api_client.go +++ b/service/ivsrealtime/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ivsrealtime/api_client_test.go b/service/ivsrealtime/api_client_test.go index 48212898d14..5e5d2344a8e 100644 --- a/service/ivsrealtime/api_client_test.go +++ b/service/ivsrealtime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ivsrealtime/options.go b/service/ivsrealtime/options.go index f90f51e9302..fe1efedca94 100644 --- a/service/ivsrealtime/options.go +++ b/service/ivsrealtime/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kafka/api_client.go b/service/kafka/api_client.go index 8ff975aaf1a..ddd2ad02516 100644 --- a/service/kafka/api_client.go +++ b/service/kafka/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kafka/api_client_test.go b/service/kafka/api_client_test.go index a6137bf32db..ac4fc1e00c2 100644 --- a/service/kafka/api_client_test.go +++ b/service/kafka/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kafka/options.go b/service/kafka/options.go index cb635b007d2..54a2483b5ed 100644 --- a/service/kafka/options.go +++ b/service/kafka/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kafkaconnect/api_client.go b/service/kafkaconnect/api_client.go index e8b477e945c..81d5230e4b8 100644 --- a/service/kafkaconnect/api_client.go +++ b/service/kafkaconnect/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kafkaconnect/api_client_test.go b/service/kafkaconnect/api_client_test.go index 576bc2fe807..108616c20c6 100644 --- a/service/kafkaconnect/api_client_test.go +++ b/service/kafkaconnect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kafkaconnect/options.go b/service/kafkaconnect/options.go index eb8b2012732..fdedd8301b6 100644 --- a/service/kafkaconnect/options.go +++ b/service/kafkaconnect/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kendra/api_client.go b/service/kendra/api_client.go index a10c61dd0b1..1b8d9916446 100644 --- a/service/kendra/api_client.go +++ b/service/kendra/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kendra/api_client_test.go b/service/kendra/api_client_test.go index b22ed20352b..84df309393e 100644 --- a/service/kendra/api_client_test.go +++ b/service/kendra/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kendra/options.go b/service/kendra/options.go index d5466823c1e..8e9db820070 100644 --- a/service/kendra/options.go +++ b/service/kendra/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kendraranking/api_client.go b/service/kendraranking/api_client.go index 4fb82b42ead..a1ae08835d4 100644 --- a/service/kendraranking/api_client.go +++ b/service/kendraranking/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kendraranking/api_client_test.go b/service/kendraranking/api_client_test.go index 2ba6b0508dd..458a869f5b1 100644 --- a/service/kendraranking/api_client_test.go +++ b/service/kendraranking/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kendraranking/options.go b/service/kendraranking/options.go index d271f00d698..5aab840a035 100644 --- a/service/kendraranking/options.go +++ b/service/kendraranking/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/keyspaces/api_client.go b/service/keyspaces/api_client.go index ab2c21e30de..2fed93d4d2e 100644 --- a/service/keyspaces/api_client.go +++ b/service/keyspaces/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/keyspaces/api_client_test.go b/service/keyspaces/api_client_test.go index 478bb1654d1..cc91257ccab 100644 --- a/service/keyspaces/api_client_test.go +++ b/service/keyspaces/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/keyspaces/options.go b/service/keyspaces/options.go index b29b44f7f76..1cf9545f6fe 100644 --- a/service/keyspaces/options.go +++ b/service/keyspaces/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesis/api_client.go b/service/kinesis/api_client.go index ee780f199e8..e5903efe291 100644 --- a/service/kinesis/api_client.go +++ b/service/kinesis/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -89,7 +91,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -337,7 +339,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesis/api_client_test.go b/service/kinesis/api_client_test.go index 39ee365aca4..61e7278796b 100644 --- a/service/kinesis/api_client_test.go +++ b/service/kinesis/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesis/options.go b/service/kinesis/options.go index 0922b8ad14c..155ced3b14e 100644 --- a/service/kinesis/options.go +++ b/service/kinesis/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisanalytics/api_client.go b/service/kinesisanalytics/api_client.go index 4454d1fa8e5..001245171df 100644 --- a/service/kinesisanalytics/api_client.go +++ b/service/kinesisanalytics/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisanalytics/api_client_test.go b/service/kinesisanalytics/api_client_test.go index 0ff518481e8..fbaa332b199 100644 --- a/service/kinesisanalytics/api_client_test.go +++ b/service/kinesisanalytics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisanalytics/options.go b/service/kinesisanalytics/options.go index 0d6b91ba68d..678065e55f0 100644 --- a/service/kinesisanalytics/options.go +++ b/service/kinesisanalytics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisanalyticsv2/api_client.go b/service/kinesisanalyticsv2/api_client.go index 6a7a09e494e..c911134ef43 100644 --- a/service/kinesisanalyticsv2/api_client.go +++ b/service/kinesisanalyticsv2/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisanalyticsv2/api_client_test.go b/service/kinesisanalyticsv2/api_client_test.go index 5e05c404dc2..727b2532385 100644 --- a/service/kinesisanalyticsv2/api_client_test.go +++ b/service/kinesisanalyticsv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisanalyticsv2/options.go b/service/kinesisanalyticsv2/options.go index 983bcd11d07..5feab711b94 100644 --- a/service/kinesisanalyticsv2/options.go +++ b/service/kinesisanalyticsv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisvideo/api_client.go b/service/kinesisvideo/api_client.go index 62ff7cb468c..73258f4b0a5 100644 --- a/service/kinesisvideo/api_client.go +++ b/service/kinesisvideo/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisvideo/api_client_test.go b/service/kinesisvideo/api_client_test.go index 66e4131f682..f1e5ef48622 100644 --- a/service/kinesisvideo/api_client_test.go +++ b/service/kinesisvideo/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisvideo/options.go b/service/kinesisvideo/options.go index 76fd2aad82f..92065738972 100644 --- a/service/kinesisvideo/options.go +++ b/service/kinesisvideo/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisvideoarchivedmedia/api_client.go b/service/kinesisvideoarchivedmedia/api_client.go index 4973259a020..02f3104137d 100644 --- a/service/kinesisvideoarchivedmedia/api_client.go +++ b/service/kinesisvideoarchivedmedia/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisvideoarchivedmedia/api_client_test.go b/service/kinesisvideoarchivedmedia/api_client_test.go index 9af67b801a0..03ddc753dbc 100644 --- a/service/kinesisvideoarchivedmedia/api_client_test.go +++ b/service/kinesisvideoarchivedmedia/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisvideoarchivedmedia/options.go b/service/kinesisvideoarchivedmedia/options.go index ddf3cf2814f..b277a36e668 100644 --- a/service/kinesisvideoarchivedmedia/options.go +++ b/service/kinesisvideoarchivedmedia/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisvideomedia/api_client.go b/service/kinesisvideomedia/api_client.go index a6c52110a4e..57d1add87f2 100644 --- a/service/kinesisvideomedia/api_client.go +++ b/service/kinesisvideomedia/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisvideomedia/api_client_test.go b/service/kinesisvideomedia/api_client_test.go index ff640c90b8d..69dc3bfb324 100644 --- a/service/kinesisvideomedia/api_client_test.go +++ b/service/kinesisvideomedia/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisvideomedia/options.go b/service/kinesisvideomedia/options.go index 4abaa356be6..f8da0363744 100644 --- a/service/kinesisvideomedia/options.go +++ b/service/kinesisvideomedia/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisvideosignaling/api_client.go b/service/kinesisvideosignaling/api_client.go index 6fe9c637a3d..abeb789548c 100644 --- a/service/kinesisvideosignaling/api_client.go +++ b/service/kinesisvideosignaling/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisvideosignaling/api_client_test.go b/service/kinesisvideosignaling/api_client_test.go index 43c75df0b56..9865dcdca0f 100644 --- a/service/kinesisvideosignaling/api_client_test.go +++ b/service/kinesisvideosignaling/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisvideosignaling/options.go b/service/kinesisvideosignaling/options.go index 7f8f3c8bbe6..adbe7cd35e6 100644 --- a/service/kinesisvideosignaling/options.go +++ b/service/kinesisvideosignaling/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kinesisvideowebrtcstorage/api_client.go b/service/kinesisvideowebrtcstorage/api_client.go index 03afefef6fd..a8242ccb12b 100644 --- a/service/kinesisvideowebrtcstorage/api_client.go +++ b/service/kinesisvideowebrtcstorage/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kinesisvideowebrtcstorage/api_client_test.go b/service/kinesisvideowebrtcstorage/api_client_test.go index 6a2bca92f4c..6ad731d0b71 100644 --- a/service/kinesisvideowebrtcstorage/api_client_test.go +++ b/service/kinesisvideowebrtcstorage/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kinesisvideowebrtcstorage/options.go b/service/kinesisvideowebrtcstorage/options.go index 0ce1464a114..31c132932f3 100644 --- a/service/kinesisvideowebrtcstorage/options.go +++ b/service/kinesisvideowebrtcstorage/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/kms/api_client.go b/service/kms/api_client.go index fe6e86d4059..d1af622670f 100644 --- a/service/kms/api_client.go +++ b/service/kms/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/kms/api_client_test.go b/service/kms/api_client_test.go index ec9b43f033e..8a7b5335734 100644 --- a/service/kms/api_client_test.go +++ b/service/kms/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/kms/options.go b/service/kms/options.go index b4057f7eb59..b24e2565947 100644 --- a/service/kms/options.go +++ b/service/kms/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lakeformation/api_client.go b/service/lakeformation/api_client.go index 26a31746c55..53da5289e06 100644 --- a/service/lakeformation/api_client.go +++ b/service/lakeformation/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lakeformation/api_client_test.go b/service/lakeformation/api_client_test.go index 02f25a67809..9f987860661 100644 --- a/service/lakeformation/api_client_test.go +++ b/service/lakeformation/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lakeformation/options.go b/service/lakeformation/options.go index 32ad2d97d3c..012d57d12fa 100644 --- a/service/lakeformation/options.go +++ b/service/lakeformation/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lambda/api_client.go b/service/lambda/api_client.go index c051fa84cea..13b202fb74d 100644 --- a/service/lambda/api_client.go +++ b/service/lambda/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -89,7 +91,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -337,7 +339,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lambda/api_client_test.go b/service/lambda/api_client_test.go index 0ee9bcb53af..1c5d4ebbd35 100644 --- a/service/lambda/api_client_test.go +++ b/service/lambda/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lambda/options.go b/service/lambda/options.go index 4db32eeafbe..e76e46c8a01 100644 --- a/service/lambda/options.go +++ b/service/lambda/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/launchwizard/api_client.go b/service/launchwizard/api_client.go index 344f572d10f..edeb3e75dc7 100644 --- a/service/launchwizard/api_client.go +++ b/service/launchwizard/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/launchwizard/api_client_test.go b/service/launchwizard/api_client_test.go index 8f1f9d7b992..08ddff4b910 100644 --- a/service/launchwizard/api_client_test.go +++ b/service/launchwizard/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/launchwizard/options.go b/service/launchwizard/options.go index 57067d3d50a..a41eb676711 100644 --- a/service/launchwizard/options.go +++ b/service/launchwizard/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lexmodelbuildingservice/api_client.go b/service/lexmodelbuildingservice/api_client.go index 3a1fa0b0741..53088b6bfd9 100644 --- a/service/lexmodelbuildingservice/api_client.go +++ b/service/lexmodelbuildingservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lexmodelbuildingservice/api_client_test.go b/service/lexmodelbuildingservice/api_client_test.go index 27fed1c20be..682fea30297 100644 --- a/service/lexmodelbuildingservice/api_client_test.go +++ b/service/lexmodelbuildingservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lexmodelbuildingservice/options.go b/service/lexmodelbuildingservice/options.go index 89866c75ccc..18157169360 100644 --- a/service/lexmodelbuildingservice/options.go +++ b/service/lexmodelbuildingservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lexmodelsv2/api_client.go b/service/lexmodelsv2/api_client.go index 9bab6926256..03d774e4259 100644 --- a/service/lexmodelsv2/api_client.go +++ b/service/lexmodelsv2/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lexmodelsv2/api_client_test.go b/service/lexmodelsv2/api_client_test.go index c05b52a20dd..d900585796d 100644 --- a/service/lexmodelsv2/api_client_test.go +++ b/service/lexmodelsv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lexmodelsv2/options.go b/service/lexmodelsv2/options.go index 0b787a3e1d8..a26948027ae 100644 --- a/service/lexmodelsv2/options.go +++ b/service/lexmodelsv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lexruntimeservice/api_client.go b/service/lexruntimeservice/api_client.go index c6aaf751742..019ba17822a 100644 --- a/service/lexruntimeservice/api_client.go +++ b/service/lexruntimeservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lexruntimeservice/api_client_test.go b/service/lexruntimeservice/api_client_test.go index fc759657df7..a59240d95a6 100644 --- a/service/lexruntimeservice/api_client_test.go +++ b/service/lexruntimeservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lexruntimeservice/options.go b/service/lexruntimeservice/options.go index 8b99c119b6e..adef318e20c 100644 --- a/service/lexruntimeservice/options.go +++ b/service/lexruntimeservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lexruntimev2/api_client.go b/service/lexruntimev2/api_client.go index 2e29b5661b9..ea81162288d 100644 --- a/service/lexruntimev2/api_client.go +++ b/service/lexruntimev2/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lexruntimev2/api_client_test.go b/service/lexruntimev2/api_client_test.go index 5b0dcb7d484..b0bb577b2ff 100644 --- a/service/lexruntimev2/api_client_test.go +++ b/service/lexruntimev2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lexruntimev2/options.go b/service/lexruntimev2/options.go index a9f34b8c03b..9f4d6b480db 100644 --- a/service/lexruntimev2/options.go +++ b/service/lexruntimev2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/licensemanager/api_client.go b/service/licensemanager/api_client.go index ca3750e02ac..e3c31e05e57 100644 --- a/service/licensemanager/api_client.go +++ b/service/licensemanager/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/licensemanager/api_client_test.go b/service/licensemanager/api_client_test.go index cad84210a11..91a344b5acc 100644 --- a/service/licensemanager/api_client_test.go +++ b/service/licensemanager/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/licensemanager/options.go b/service/licensemanager/options.go index f525b33ca7f..ee36a821e3c 100644 --- a/service/licensemanager/options.go +++ b/service/licensemanager/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/licensemanagerlinuxsubscriptions/api_client.go b/service/licensemanagerlinuxsubscriptions/api_client.go index cf04c6a4200..7717700004c 100644 --- a/service/licensemanagerlinuxsubscriptions/api_client.go +++ b/service/licensemanagerlinuxsubscriptions/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/licensemanagerlinuxsubscriptions/api_client_test.go b/service/licensemanagerlinuxsubscriptions/api_client_test.go index 4d7ec7b695a..a8797a5fb84 100644 --- a/service/licensemanagerlinuxsubscriptions/api_client_test.go +++ b/service/licensemanagerlinuxsubscriptions/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/licensemanagerlinuxsubscriptions/options.go b/service/licensemanagerlinuxsubscriptions/options.go index 46b5673b683..c8dd48f8d40 100644 --- a/service/licensemanagerlinuxsubscriptions/options.go +++ b/service/licensemanagerlinuxsubscriptions/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/licensemanagerusersubscriptions/api_client.go b/service/licensemanagerusersubscriptions/api_client.go index 7dc34f2c5df..74dcf96df9c 100644 --- a/service/licensemanagerusersubscriptions/api_client.go +++ b/service/licensemanagerusersubscriptions/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/licensemanagerusersubscriptions/api_client_test.go b/service/licensemanagerusersubscriptions/api_client_test.go index 1a187076dcc..b4f35a6ebc7 100644 --- a/service/licensemanagerusersubscriptions/api_client_test.go +++ b/service/licensemanagerusersubscriptions/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/licensemanagerusersubscriptions/options.go b/service/licensemanagerusersubscriptions/options.go index d051a41e877..cdbf6317e85 100644 --- a/service/licensemanagerusersubscriptions/options.go +++ b/service/licensemanagerusersubscriptions/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lightsail/api_client.go b/service/lightsail/api_client.go index 3a842e845b8..044f62c4932 100644 --- a/service/lightsail/api_client.go +++ b/service/lightsail/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lightsail/api_client_test.go b/service/lightsail/api_client_test.go index 0c205e25f90..6db7a01060d 100644 --- a/service/lightsail/api_client_test.go +++ b/service/lightsail/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lightsail/options.go b/service/lightsail/options.go index cad1bc173ae..ec95be44fc2 100644 --- a/service/lightsail/options.go +++ b/service/lightsail/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/location/api_client.go b/service/location/api_client.go index 62f60acaeca..2df8ba8a5eb 100644 --- a/service/location/api_client.go +++ b/service/location/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/location/api_client_test.go b/service/location/api_client_test.go index 40e0728b91e..cda1c97982e 100644 --- a/service/location/api_client_test.go +++ b/service/location/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/location/options.go b/service/location/options.go index 811a297e4de..b2f09612356 100644 --- a/service/location/options.go +++ b/service/location/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lookoutequipment/api_client.go b/service/lookoutequipment/api_client.go index 080630697e7..51e382cdebf 100644 --- a/service/lookoutequipment/api_client.go +++ b/service/lookoutequipment/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lookoutequipment/api_client_test.go b/service/lookoutequipment/api_client_test.go index dd09a27c797..fbff323eb49 100644 --- a/service/lookoutequipment/api_client_test.go +++ b/service/lookoutequipment/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lookoutequipment/options.go b/service/lookoutequipment/options.go index 0b15ee266d8..dbb223aa037 100644 --- a/service/lookoutequipment/options.go +++ b/service/lookoutequipment/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lookoutmetrics/api_client.go b/service/lookoutmetrics/api_client.go index a1cfa5d5717..99ebf1c1a07 100644 --- a/service/lookoutmetrics/api_client.go +++ b/service/lookoutmetrics/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lookoutmetrics/api_client_test.go b/service/lookoutmetrics/api_client_test.go index 1248293b5e5..1385622af15 100644 --- a/service/lookoutmetrics/api_client_test.go +++ b/service/lookoutmetrics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lookoutmetrics/options.go b/service/lookoutmetrics/options.go index aa787b0a1ce..2438aeaa481 100644 --- a/service/lookoutmetrics/options.go +++ b/service/lookoutmetrics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/lookoutvision/api_client.go b/service/lookoutvision/api_client.go index 08e5e3be381..f8c1d6214fe 100644 --- a/service/lookoutvision/api_client.go +++ b/service/lookoutvision/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/lookoutvision/api_client_test.go b/service/lookoutvision/api_client_test.go index 59fc18d029b..a36d8846522 100644 --- a/service/lookoutvision/api_client_test.go +++ b/service/lookoutvision/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/lookoutvision/options.go b/service/lookoutvision/options.go index 1819cef6163..ba9ea96c772 100644 --- a/service/lookoutvision/options.go +++ b/service/lookoutvision/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/m2/api_client.go b/service/m2/api_client.go index 93885e719b4..b5ed62e95f0 100644 --- a/service/m2/api_client.go +++ b/service/m2/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/m2/api_client_test.go b/service/m2/api_client_test.go index aea78169e6f..0b578cc1986 100644 --- a/service/m2/api_client_test.go +++ b/service/m2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/m2/options.go b/service/m2/options.go index 6f17c1df54e..eaa056a41d4 100644 --- a/service/m2/options.go +++ b/service/m2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/machinelearning/api_client.go b/service/machinelearning/api_client.go index ee40382f891..d4aa4264e49 100644 --- a/service/machinelearning/api_client.go +++ b/service/machinelearning/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/machinelearning/api_client_test.go b/service/machinelearning/api_client_test.go index 74535681582..cffba0fcc8d 100644 --- a/service/machinelearning/api_client_test.go +++ b/service/machinelearning/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/machinelearning/options.go b/service/machinelearning/options.go index 6e158adba6d..daf5223a2f6 100644 --- a/service/machinelearning/options.go +++ b/service/machinelearning/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/macie2/api_client.go b/service/macie2/api_client.go index e2d618c92a3..0bf2e931cc2 100644 --- a/service/macie2/api_client.go +++ b/service/macie2/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/macie2/api_client_test.go b/service/macie2/api_client_test.go index 8c853ffb126..46053b4bbaf 100644 --- a/service/macie2/api_client_test.go +++ b/service/macie2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/macie2/options.go b/service/macie2/options.go index 6cd8edf85d3..bf8cee97437 100644 --- a/service/macie2/options.go +++ b/service/macie2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/managedblockchain/api_client.go b/service/managedblockchain/api_client.go index 09a85304135..1e298400fa4 100644 --- a/service/managedblockchain/api_client.go +++ b/service/managedblockchain/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/managedblockchain/api_client_test.go b/service/managedblockchain/api_client_test.go index 613ef3a48b1..1bd547ffa68 100644 --- a/service/managedblockchain/api_client_test.go +++ b/service/managedblockchain/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/managedblockchain/options.go b/service/managedblockchain/options.go index 82c9a944680..d6b01206e49 100644 --- a/service/managedblockchain/options.go +++ b/service/managedblockchain/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/managedblockchainquery/api_client.go b/service/managedblockchainquery/api_client.go index b682468eb61..fc2c5ad82e2 100644 --- a/service/managedblockchainquery/api_client.go +++ b/service/managedblockchainquery/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/managedblockchainquery/api_client_test.go b/service/managedblockchainquery/api_client_test.go index e7988c7e6fa..24d8ad16021 100644 --- a/service/managedblockchainquery/api_client_test.go +++ b/service/managedblockchainquery/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/managedblockchainquery/options.go b/service/managedblockchainquery/options.go index 12b0058ad1f..8738f17a254 100644 --- a/service/managedblockchainquery/options.go +++ b/service/managedblockchainquery/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplaceagreement/api_client.go b/service/marketplaceagreement/api_client.go index c30ae2ec6ac..7f31cb35e23 100644 --- a/service/marketplaceagreement/api_client.go +++ b/service/marketplaceagreement/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplaceagreement/api_client_test.go b/service/marketplaceagreement/api_client_test.go index 5075a5b2a81..b20a6ae4865 100644 --- a/service/marketplaceagreement/api_client_test.go +++ b/service/marketplaceagreement/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplaceagreement/options.go b/service/marketplaceagreement/options.go index fbc4c361f95..9ee60337932 100644 --- a/service/marketplaceagreement/options.go +++ b/service/marketplaceagreement/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplacecatalog/api_client.go b/service/marketplacecatalog/api_client.go index d84fa68f924..a94eff98f03 100644 --- a/service/marketplacecatalog/api_client.go +++ b/service/marketplacecatalog/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplacecatalog/api_client_test.go b/service/marketplacecatalog/api_client_test.go index d76864052ec..59d5598261f 100644 --- a/service/marketplacecatalog/api_client_test.go +++ b/service/marketplacecatalog/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplacecatalog/options.go b/service/marketplacecatalog/options.go index 10d21ee2f45..8b1efa9bf6c 100644 --- a/service/marketplacecatalog/options.go +++ b/service/marketplacecatalog/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplacecommerceanalytics/api_client.go b/service/marketplacecommerceanalytics/api_client.go index 422a47c9281..f4737961f1f 100644 --- a/service/marketplacecommerceanalytics/api_client.go +++ b/service/marketplacecommerceanalytics/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplacecommerceanalytics/api_client_test.go b/service/marketplacecommerceanalytics/api_client_test.go index 340a438b4c9..9bd0b9dc087 100644 --- a/service/marketplacecommerceanalytics/api_client_test.go +++ b/service/marketplacecommerceanalytics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplacecommerceanalytics/options.go b/service/marketplacecommerceanalytics/options.go index d9790aa4853..1330c0fc695 100644 --- a/service/marketplacecommerceanalytics/options.go +++ b/service/marketplacecommerceanalytics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplacedeployment/api_client.go b/service/marketplacedeployment/api_client.go index 2523075be1b..bff64b9f55c 100644 --- a/service/marketplacedeployment/api_client.go +++ b/service/marketplacedeployment/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplacedeployment/api_client_test.go b/service/marketplacedeployment/api_client_test.go index 5d01442b363..178e0dfb8ff 100644 --- a/service/marketplacedeployment/api_client_test.go +++ b/service/marketplacedeployment/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplacedeployment/options.go b/service/marketplacedeployment/options.go index 3b4a96805ce..8389de8c430 100644 --- a/service/marketplacedeployment/options.go +++ b/service/marketplacedeployment/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplaceentitlementservice/api_client.go b/service/marketplaceentitlementservice/api_client.go index b240810e07c..36162952e35 100644 --- a/service/marketplaceentitlementservice/api_client.go +++ b/service/marketplaceentitlementservice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplaceentitlementservice/api_client_test.go b/service/marketplaceentitlementservice/api_client_test.go index e257e175c72..133e5e1873e 100644 --- a/service/marketplaceentitlementservice/api_client_test.go +++ b/service/marketplaceentitlementservice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplaceentitlementservice/options.go b/service/marketplaceentitlementservice/options.go index 66bed9b8d99..c2184e89dfb 100644 --- a/service/marketplaceentitlementservice/options.go +++ b/service/marketplaceentitlementservice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/marketplacemetering/api_client.go b/service/marketplacemetering/api_client.go index e61e2d88394..fcee0835df1 100644 --- a/service/marketplacemetering/api_client.go +++ b/service/marketplacemetering/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/marketplacemetering/api_client_test.go b/service/marketplacemetering/api_client_test.go index 13bb71f727e..61f096a9377 100644 --- a/service/marketplacemetering/api_client_test.go +++ b/service/marketplacemetering/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/marketplacemetering/options.go b/service/marketplacemetering/options.go index 7793f1c2131..37da8e25dcc 100644 --- a/service/marketplacemetering/options.go +++ b/service/marketplacemetering/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediaconnect/api_client.go b/service/mediaconnect/api_client.go index 9a34c528a79..9ac8bbee459 100644 --- a/service/mediaconnect/api_client.go +++ b/service/mediaconnect/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediaconnect/api_client_test.go b/service/mediaconnect/api_client_test.go index 39259c79d69..63129a9f7f2 100644 --- a/service/mediaconnect/api_client_test.go +++ b/service/mediaconnect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediaconnect/options.go b/service/mediaconnect/options.go index 2c7fd89ebcc..ee6b25da336 100644 --- a/service/mediaconnect/options.go +++ b/service/mediaconnect/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediaconvert/api_client.go b/service/mediaconvert/api_client.go index 28420ecba12..daa31c39223 100644 --- a/service/mediaconvert/api_client.go +++ b/service/mediaconvert/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediaconvert/api_client_test.go b/service/mediaconvert/api_client_test.go index 8aae4d66575..cf262a10a00 100644 --- a/service/mediaconvert/api_client_test.go +++ b/service/mediaconvert/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediaconvert/options.go b/service/mediaconvert/options.go index 992224ebd72..4fe061edf71 100644 --- a/service/mediaconvert/options.go +++ b/service/mediaconvert/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/medialive/api_client.go b/service/medialive/api_client.go index 7e0a047f97c..f44853ad5ed 100644 --- a/service/medialive/api_client.go +++ b/service/medialive/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/medialive/api_client_test.go b/service/medialive/api_client_test.go index 65086852c38..2495477b021 100644 --- a/service/medialive/api_client_test.go +++ b/service/medialive/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/medialive/options.go b/service/medialive/options.go index bdf61d9fb59..ec81cc5dee8 100644 --- a/service/medialive/options.go +++ b/service/medialive/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediapackage/api_client.go b/service/mediapackage/api_client.go index 381bbdbe4da..8b0165e9f20 100644 --- a/service/mediapackage/api_client.go +++ b/service/mediapackage/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediapackage/api_client_test.go b/service/mediapackage/api_client_test.go index 24caf54feb9..7bbe24b1617 100644 --- a/service/mediapackage/api_client_test.go +++ b/service/mediapackage/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediapackage/options.go b/service/mediapackage/options.go index 455a87dfad8..39ec32fa1d3 100644 --- a/service/mediapackage/options.go +++ b/service/mediapackage/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediapackagev2/api_client.go b/service/mediapackagev2/api_client.go index d37facea292..7760163f498 100644 --- a/service/mediapackagev2/api_client.go +++ b/service/mediapackagev2/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediapackagev2/api_client_test.go b/service/mediapackagev2/api_client_test.go index 0915867740e..fc7ffcd88c8 100644 --- a/service/mediapackagev2/api_client_test.go +++ b/service/mediapackagev2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediapackagev2/options.go b/service/mediapackagev2/options.go index 7f2aa7d0814..1675fdc9ee6 100644 --- a/service/mediapackagev2/options.go +++ b/service/mediapackagev2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediapackagevod/api_client.go b/service/mediapackagevod/api_client.go index c40723ef4fd..cca6e4fe24f 100644 --- a/service/mediapackagevod/api_client.go +++ b/service/mediapackagevod/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediapackagevod/api_client_test.go b/service/mediapackagevod/api_client_test.go index 7dc9204e473..d2934e4f92c 100644 --- a/service/mediapackagevod/api_client_test.go +++ b/service/mediapackagevod/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediapackagevod/options.go b/service/mediapackagevod/options.go index 87c6e1655e6..c442d68e51b 100644 --- a/service/mediapackagevod/options.go +++ b/service/mediapackagevod/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediastore/api_client.go b/service/mediastore/api_client.go index f2b92a1cfde..7d7beff274b 100644 --- a/service/mediastore/api_client.go +++ b/service/mediastore/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediastore/api_client_test.go b/service/mediastore/api_client_test.go index 533508b502b..99bb09b2d67 100644 --- a/service/mediastore/api_client_test.go +++ b/service/mediastore/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediastore/options.go b/service/mediastore/options.go index 5732e4a2c9c..eb2dfdac997 100644 --- a/service/mediastore/options.go +++ b/service/mediastore/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediastoredata/api_client.go b/service/mediastoredata/api_client.go index 4e3edb06f17..87910bd1e6c 100644 --- a/service/mediastoredata/api_client.go +++ b/service/mediastoredata/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediastoredata/api_client_test.go b/service/mediastoredata/api_client_test.go index 70280ca001f..90e33e40736 100644 --- a/service/mediastoredata/api_client_test.go +++ b/service/mediastoredata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediastoredata/options.go b/service/mediastoredata/options.go index c016b8ff710..dc72f32ff42 100644 --- a/service/mediastoredata/options.go +++ b/service/mediastoredata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mediatailor/api_client.go b/service/mediatailor/api_client.go index 7977fda3426..7d4ed37034b 100644 --- a/service/mediatailor/api_client.go +++ b/service/mediatailor/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mediatailor/api_client_test.go b/service/mediatailor/api_client_test.go index 92587d84254..d0206767598 100644 --- a/service/mediatailor/api_client_test.go +++ b/service/mediatailor/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mediatailor/options.go b/service/mediatailor/options.go index ca9c1618c28..6a54a999684 100644 --- a/service/mediatailor/options.go +++ b/service/mediatailor/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/medicalimaging/api_client.go b/service/medicalimaging/api_client.go index 14ac627accb..cdead324fbe 100644 --- a/service/medicalimaging/api_client.go +++ b/service/medicalimaging/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/medicalimaging/api_client_test.go b/service/medicalimaging/api_client_test.go index a12d8d8e347..3ac478873a7 100644 --- a/service/medicalimaging/api_client_test.go +++ b/service/medicalimaging/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/medicalimaging/options.go b/service/medicalimaging/options.go index d76f87724e4..e58a40aff2c 100644 --- a/service/medicalimaging/options.go +++ b/service/medicalimaging/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/memorydb/api_client.go b/service/memorydb/api_client.go index d8cf56d8673..c74e8a286d4 100644 --- a/service/memorydb/api_client.go +++ b/service/memorydb/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/memorydb/api_client_test.go b/service/memorydb/api_client_test.go index 56279a32e2f..8a2416310d2 100644 --- a/service/memorydb/api_client_test.go +++ b/service/memorydb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/memorydb/options.go b/service/memorydb/options.go index a70680960cc..8f1b5c652a2 100644 --- a/service/memorydb/options.go +++ b/service/memorydb/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mgn/api_client.go b/service/mgn/api_client.go index eef09fabd57..f5ec7e498d0 100644 --- a/service/mgn/api_client.go +++ b/service/mgn/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mgn/api_client_test.go b/service/mgn/api_client_test.go index 396a50bb5ce..99caebf52b7 100644 --- a/service/mgn/api_client_test.go +++ b/service/mgn/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mgn/options.go b/service/mgn/options.go index 693fa0a4cd8..a9c905a99dc 100644 --- a/service/mgn/options.go +++ b/service/mgn/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/migrationhub/api_client.go b/service/migrationhub/api_client.go index 48cd7924dff..dc6d33a9adf 100644 --- a/service/migrationhub/api_client.go +++ b/service/migrationhub/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/migrationhub/api_client_test.go b/service/migrationhub/api_client_test.go index d6fea053c48..45a9a5c750f 100644 --- a/service/migrationhub/api_client_test.go +++ b/service/migrationhub/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/migrationhub/options.go b/service/migrationhub/options.go index 094ad6e146f..63b9a730057 100644 --- a/service/migrationhub/options.go +++ b/service/migrationhub/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/migrationhubconfig/api_client.go b/service/migrationhubconfig/api_client.go index a1d0e2343b4..1e18de4f824 100644 --- a/service/migrationhubconfig/api_client.go +++ b/service/migrationhubconfig/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/migrationhubconfig/api_client_test.go b/service/migrationhubconfig/api_client_test.go index b37e0838d5a..3565c564edb 100644 --- a/service/migrationhubconfig/api_client_test.go +++ b/service/migrationhubconfig/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/migrationhubconfig/options.go b/service/migrationhubconfig/options.go index 434f09c868b..e769426399a 100644 --- a/service/migrationhubconfig/options.go +++ b/service/migrationhubconfig/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/migrationhuborchestrator/api_client.go b/service/migrationhuborchestrator/api_client.go index 7242be8a5d0..2490eefc969 100644 --- a/service/migrationhuborchestrator/api_client.go +++ b/service/migrationhuborchestrator/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/migrationhuborchestrator/api_client_test.go b/service/migrationhuborchestrator/api_client_test.go index d509f3028e3..7cca10961c2 100644 --- a/service/migrationhuborchestrator/api_client_test.go +++ b/service/migrationhuborchestrator/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/migrationhuborchestrator/options.go b/service/migrationhuborchestrator/options.go index dc7275d42c3..99e3e91c710 100644 --- a/service/migrationhuborchestrator/options.go +++ b/service/migrationhuborchestrator/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/migrationhubrefactorspaces/api_client.go b/service/migrationhubrefactorspaces/api_client.go index bdce214e0d8..c1a5ac35d41 100644 --- a/service/migrationhubrefactorspaces/api_client.go +++ b/service/migrationhubrefactorspaces/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/migrationhubrefactorspaces/api_client_test.go b/service/migrationhubrefactorspaces/api_client_test.go index 846c59282b3..878d00ff3aa 100644 --- a/service/migrationhubrefactorspaces/api_client_test.go +++ b/service/migrationhubrefactorspaces/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/migrationhubrefactorspaces/options.go b/service/migrationhubrefactorspaces/options.go index 586aac02845..dc47d3edcc7 100644 --- a/service/migrationhubrefactorspaces/options.go +++ b/service/migrationhubrefactorspaces/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/migrationhubstrategy/api_client.go b/service/migrationhubstrategy/api_client.go index 119c4d94006..e02e10bd6cf 100644 --- a/service/migrationhubstrategy/api_client.go +++ b/service/migrationhubstrategy/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/migrationhubstrategy/api_client_test.go b/service/migrationhubstrategy/api_client_test.go index 178baada8c6..d159481cbf2 100644 --- a/service/migrationhubstrategy/api_client_test.go +++ b/service/migrationhubstrategy/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/migrationhubstrategy/options.go b/service/migrationhubstrategy/options.go index 7030a6ebcc2..988fd79ade1 100644 --- a/service/migrationhubstrategy/options.go +++ b/service/migrationhubstrategy/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mobile/api_client.go b/service/mobile/api_client.go index 65d53f04dc4..86e53f7f4a3 100644 --- a/service/mobile/api_client.go +++ b/service/mobile/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mobile/api_client_test.go b/service/mobile/api_client_test.go index 71c3bdfaebf..19dbd4ecafa 100644 --- a/service/mobile/api_client_test.go +++ b/service/mobile/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mobile/options.go b/service/mobile/options.go index bda4edd6aa8..6d00135e699 100644 --- a/service/mobile/options.go +++ b/service/mobile/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mq/api_client.go b/service/mq/api_client.go index 80ee1af832c..9007e3b28fd 100644 --- a/service/mq/api_client.go +++ b/service/mq/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mq/api_client_test.go b/service/mq/api_client_test.go index 6a2407172e4..a8b21801502 100644 --- a/service/mq/api_client_test.go +++ b/service/mq/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mq/options.go b/service/mq/options.go index ec4d26257d5..8f7eb0483e4 100644 --- a/service/mq/options.go +++ b/service/mq/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mturk/api_client.go b/service/mturk/api_client.go index a0391bb52d9..f99e2dc0611 100644 --- a/service/mturk/api_client.go +++ b/service/mturk/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mturk/api_client_test.go b/service/mturk/api_client_test.go index 22345a83925..ad49215fece 100644 --- a/service/mturk/api_client_test.go +++ b/service/mturk/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mturk/options.go b/service/mturk/options.go index f5bc27043c9..a3035071e59 100644 --- a/service/mturk/options.go +++ b/service/mturk/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/mwaa/api_client.go b/service/mwaa/api_client.go index acfcb909f51..8586f146941 100644 --- a/service/mwaa/api_client.go +++ b/service/mwaa/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/mwaa/api_client_test.go b/service/mwaa/api_client_test.go index aa6611569c0..19964b99c97 100644 --- a/service/mwaa/api_client_test.go +++ b/service/mwaa/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/mwaa/options.go b/service/mwaa/options.go index 83a977cb721..406e538271a 100644 --- a/service/mwaa/options.go +++ b/service/mwaa/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/neptune/api_client.go b/service/neptune/api_client.go index 84872ba10ee..37c3747798d 100644 --- a/service/neptune/api_client.go +++ b/service/neptune/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -57,7 +59,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/neptune/api_client_test.go b/service/neptune/api_client_test.go index 95cb284aae5..d4a65b5b430 100644 --- a/service/neptune/api_client_test.go +++ b/service/neptune/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/neptune/options.go b/service/neptune/options.go index 67458766bcf..2ca079c69a3 100644 --- a/service/neptune/options.go +++ b/service/neptune/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/neptunedata/api_client.go b/service/neptunedata/api_client.go index 8592ca9d371..6ac9b95908f 100644 --- a/service/neptunedata/api_client.go +++ b/service/neptunedata/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/neptunedata/api_client_test.go b/service/neptunedata/api_client_test.go index 88b5c0b9369..ca1af286d38 100644 --- a/service/neptunedata/api_client_test.go +++ b/service/neptunedata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/neptunedata/options.go b/service/neptunedata/options.go index 4c759b09efd..447aae298a4 100644 --- a/service/neptunedata/options.go +++ b/service/neptunedata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/networkfirewall/api_client.go b/service/networkfirewall/api_client.go index 0ca0d76c687..41c436676fb 100644 --- a/service/networkfirewall/api_client.go +++ b/service/networkfirewall/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/networkfirewall/api_client_test.go b/service/networkfirewall/api_client_test.go index 2f0c495e123..3448bec7b9e 100644 --- a/service/networkfirewall/api_client_test.go +++ b/service/networkfirewall/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/networkfirewall/options.go b/service/networkfirewall/options.go index edfcbede0dd..062e8dc6628 100644 --- a/service/networkfirewall/options.go +++ b/service/networkfirewall/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/networkmanager/api_client.go b/service/networkmanager/api_client.go index 6c77c2c808b..4c22e95584b 100644 --- a/service/networkmanager/api_client.go +++ b/service/networkmanager/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/networkmanager/api_client_test.go b/service/networkmanager/api_client_test.go index 770e15e59b7..c0927eda2f7 100644 --- a/service/networkmanager/api_client_test.go +++ b/service/networkmanager/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/networkmanager/options.go b/service/networkmanager/options.go index a29cc28de5b..c3a80a8f19f 100644 --- a/service/networkmanager/options.go +++ b/service/networkmanager/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/nimble/api_client.go b/service/nimble/api_client.go index 7e306a6ee94..355c015e228 100644 --- a/service/nimble/api_client.go +++ b/service/nimble/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/nimble/api_client_test.go b/service/nimble/api_client_test.go index 499da1a14f6..0d9387c6dbe 100644 --- a/service/nimble/api_client_test.go +++ b/service/nimble/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/nimble/options.go b/service/nimble/options.go index 66d7d02f577..d839d14c433 100644 --- a/service/nimble/options.go +++ b/service/nimble/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/oam/api_client.go b/service/oam/api_client.go index 264fc18709b..5a356fa9614 100644 --- a/service/oam/api_client.go +++ b/service/oam/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/oam/api_client_test.go b/service/oam/api_client_test.go index 23bde2d56cf..0ade74d8e1b 100644 --- a/service/oam/api_client_test.go +++ b/service/oam/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/oam/options.go b/service/oam/options.go index 2c27435937a..24180adaa4e 100644 --- a/service/oam/options.go +++ b/service/oam/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/omics/api_client.go b/service/omics/api_client.go index ad4c3493163..08ba6cf5462 100644 --- a/service/omics/api_client.go +++ b/service/omics/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/omics/api_client_test.go b/service/omics/api_client_test.go index c111518402c..026ebd4f524 100644 --- a/service/omics/api_client_test.go +++ b/service/omics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/omics/options.go b/service/omics/options.go index 8ebeb9089bc..2f58759c3b9 100644 --- a/service/omics/options.go +++ b/service/omics/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/opensearch/api_client.go b/service/opensearch/api_client.go index eb9f1f50d75..c421bcdf014 100644 --- a/service/opensearch/api_client.go +++ b/service/opensearch/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/opensearch/api_client_test.go b/service/opensearch/api_client_test.go index f9f4dd9d394..f53841915ea 100644 --- a/service/opensearch/api_client_test.go +++ b/service/opensearch/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/opensearch/options.go b/service/opensearch/options.go index 30fb0030f38..e2478fcd762 100644 --- a/service/opensearch/options.go +++ b/service/opensearch/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/opensearchserverless/api_client.go b/service/opensearchserverless/api_client.go index 5524ec1ec35..f4fa44027b2 100644 --- a/service/opensearchserverless/api_client.go +++ b/service/opensearchserverless/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/opensearchserverless/api_client_test.go b/service/opensearchserverless/api_client_test.go index 608bc80d59a..9881e51a6e9 100644 --- a/service/opensearchserverless/api_client_test.go +++ b/service/opensearchserverless/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/opensearchserverless/options.go b/service/opensearchserverless/options.go index 2055e36f3b0..5ae7820a093 100644 --- a/service/opensearchserverless/options.go +++ b/service/opensearchserverless/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/opsworks/api_client.go b/service/opsworks/api_client.go index 3a4bec7e66d..3b85b3cd7aa 100644 --- a/service/opsworks/api_client.go +++ b/service/opsworks/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/opsworks/api_client_test.go b/service/opsworks/api_client_test.go index bd06a3b68c3..150d5f6ab21 100644 --- a/service/opsworks/api_client_test.go +++ b/service/opsworks/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/opsworks/options.go b/service/opsworks/options.go index c393cbb0735..2f822c32416 100644 --- a/service/opsworks/options.go +++ b/service/opsworks/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/opsworkscm/api_client.go b/service/opsworkscm/api_client.go index 23dd72c6f7a..606b51f6483 100644 --- a/service/opsworkscm/api_client.go +++ b/service/opsworkscm/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/opsworkscm/api_client_test.go b/service/opsworkscm/api_client_test.go index c380021e1cc..19e2f3e63ed 100644 --- a/service/opsworkscm/api_client_test.go +++ b/service/opsworkscm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/opsworkscm/options.go b/service/opsworkscm/options.go index 7aff3026d53..e70c2ac0ffb 100644 --- a/service/opsworkscm/options.go +++ b/service/opsworkscm/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/organizations/api_client.go b/service/organizations/api_client.go index 220670f5014..2b38af470ff 100644 --- a/service/organizations/api_client.go +++ b/service/organizations/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/organizations/api_client_test.go b/service/organizations/api_client_test.go index d0ebbe928b0..a0dd66a3ed0 100644 --- a/service/organizations/api_client_test.go +++ b/service/organizations/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/organizations/options.go b/service/organizations/options.go index 60ef27824ba..ba05eb89a41 100644 --- a/service/organizations/options.go +++ b/service/organizations/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/osis/api_client.go b/service/osis/api_client.go index 442514566d6..fc33b2be48f 100644 --- a/service/osis/api_client.go +++ b/service/osis/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/osis/api_client_test.go b/service/osis/api_client_test.go index f3e28a75ac9..010ed1e8c47 100644 --- a/service/osis/api_client_test.go +++ b/service/osis/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/osis/options.go b/service/osis/options.go index 9af297ad134..467d937e6f0 100644 --- a/service/osis/options.go +++ b/service/osis/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/outposts/api_client.go b/service/outposts/api_client.go index 3f14f774932..4eb96aeec7c 100644 --- a/service/outposts/api_client.go +++ b/service/outposts/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/outposts/api_client_test.go b/service/outposts/api_client_test.go index b45204e5b2d..8dfa5638220 100644 --- a/service/outposts/api_client_test.go +++ b/service/outposts/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/outposts/options.go b/service/outposts/options.go index c25ff0e9955..5c4fa3244f0 100644 --- a/service/outposts/options.go +++ b/service/outposts/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/panorama/api_client.go b/service/panorama/api_client.go index 9c3b71a2886..857bfb1c2c0 100644 --- a/service/panorama/api_client.go +++ b/service/panorama/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/panorama/api_client_test.go b/service/panorama/api_client_test.go index 5bb7b6171c8..c0be9ecc379 100644 --- a/service/panorama/api_client_test.go +++ b/service/panorama/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/panorama/options.go b/service/panorama/options.go index 3a17ba1de43..7586bafeb49 100644 --- a/service/panorama/options.go +++ b/service/panorama/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/paymentcryptography/api_client.go b/service/paymentcryptography/api_client.go index 9a26618f38a..3dbb67e916a 100644 --- a/service/paymentcryptography/api_client.go +++ b/service/paymentcryptography/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/paymentcryptography/api_client_test.go b/service/paymentcryptography/api_client_test.go index d6d3ffe20fe..1828288f846 100644 --- a/service/paymentcryptography/api_client_test.go +++ b/service/paymentcryptography/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/paymentcryptography/options.go b/service/paymentcryptography/options.go index 790184916fa..af359cb2b43 100644 --- a/service/paymentcryptography/options.go +++ b/service/paymentcryptography/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/paymentcryptographydata/api_client.go b/service/paymentcryptographydata/api_client.go index 11cf78ff1ee..5241f23ee7e 100644 --- a/service/paymentcryptographydata/api_client.go +++ b/service/paymentcryptographydata/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/paymentcryptographydata/api_client_test.go b/service/paymentcryptographydata/api_client_test.go index 53b16cb1e31..282fd31a5c1 100644 --- a/service/paymentcryptographydata/api_client_test.go +++ b/service/paymentcryptographydata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/paymentcryptographydata/options.go b/service/paymentcryptographydata/options.go index 540f59f4d6d..3eda695222a 100644 --- a/service/paymentcryptographydata/options.go +++ b/service/paymentcryptographydata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pcaconnectorad/api_client.go b/service/pcaconnectorad/api_client.go index a6f299bc2f7..94ab171e0a0 100644 --- a/service/pcaconnectorad/api_client.go +++ b/service/pcaconnectorad/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pcaconnectorad/api_client_test.go b/service/pcaconnectorad/api_client_test.go index d41cc271c6c..c98be83eb87 100644 --- a/service/pcaconnectorad/api_client_test.go +++ b/service/pcaconnectorad/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pcaconnectorad/options.go b/service/pcaconnectorad/options.go index 405f7ea7cbc..083818f4014 100644 --- a/service/pcaconnectorad/options.go +++ b/service/pcaconnectorad/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/personalize/api_client.go b/service/personalize/api_client.go index f95f6fd5217..aba4b45a56f 100644 --- a/service/personalize/api_client.go +++ b/service/personalize/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/personalize/api_client_test.go b/service/personalize/api_client_test.go index 48d4a6cb596..592855570f2 100644 --- a/service/personalize/api_client_test.go +++ b/service/personalize/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/personalize/options.go b/service/personalize/options.go index 22ef323edfc..7ae259d20af 100644 --- a/service/personalize/options.go +++ b/service/personalize/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/personalizeevents/api_client.go b/service/personalizeevents/api_client.go index d453d14340e..d6db4f36812 100644 --- a/service/personalizeevents/api_client.go +++ b/service/personalizeevents/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/personalizeevents/api_client_test.go b/service/personalizeevents/api_client_test.go index 66d9642ad1d..6272cd2188d 100644 --- a/service/personalizeevents/api_client_test.go +++ b/service/personalizeevents/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/personalizeevents/options.go b/service/personalizeevents/options.go index c84a1b199e8..55912cfdb51 100644 --- a/service/personalizeevents/options.go +++ b/service/personalizeevents/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/personalizeruntime/api_client.go b/service/personalizeruntime/api_client.go index 4ce58dac9a4..fee4e90dd44 100644 --- a/service/personalizeruntime/api_client.go +++ b/service/personalizeruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/personalizeruntime/api_client_test.go b/service/personalizeruntime/api_client_test.go index 711d9c9d3b6..94f62743f67 100644 --- a/service/personalizeruntime/api_client_test.go +++ b/service/personalizeruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/personalizeruntime/options.go b/service/personalizeruntime/options.go index 09714196fc8..2151d25767a 100644 --- a/service/personalizeruntime/options.go +++ b/service/personalizeruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pi/api_client.go b/service/pi/api_client.go index 14c00d47df9..9be04518dcd 100644 --- a/service/pi/api_client.go +++ b/service/pi/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pi/api_client_test.go b/service/pi/api_client_test.go index 44b432ec744..dd1331f2f32 100644 --- a/service/pi/api_client_test.go +++ b/service/pi/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pi/options.go b/service/pi/options.go index 1d3cbbe4415..45e4e44cfc3 100644 --- a/service/pi/options.go +++ b/service/pi/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pinpoint/api_client.go b/service/pinpoint/api_client.go index 8a15fcf53e5..8b9d2324a1c 100644 --- a/service/pinpoint/api_client.go +++ b/service/pinpoint/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pinpoint/api_client_test.go b/service/pinpoint/api_client_test.go index 44c589fb3c1..d7174e70c7d 100644 --- a/service/pinpoint/api_client_test.go +++ b/service/pinpoint/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pinpoint/options.go b/service/pinpoint/options.go index 70acddb379e..8637dc98f5e 100644 --- a/service/pinpoint/options.go +++ b/service/pinpoint/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pinpointemail/api_client.go b/service/pinpointemail/api_client.go index d6217c238c1..4f40eaa3cf2 100644 --- a/service/pinpointemail/api_client.go +++ b/service/pinpointemail/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pinpointemail/api_client_test.go b/service/pinpointemail/api_client_test.go index ed7264aa8b7..21b709faec5 100644 --- a/service/pinpointemail/api_client_test.go +++ b/service/pinpointemail/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pinpointemail/options.go b/service/pinpointemail/options.go index 97c27ddf49c..a6031918084 100644 --- a/service/pinpointemail/options.go +++ b/service/pinpointemail/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pinpointsmsvoice/api_client.go b/service/pinpointsmsvoice/api_client.go index 0f66d9f89d4..10c941de73d 100644 --- a/service/pinpointsmsvoice/api_client.go +++ b/service/pinpointsmsvoice/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pinpointsmsvoice/api_client_test.go b/service/pinpointsmsvoice/api_client_test.go index f2e9e6e0bc3..6650d131399 100644 --- a/service/pinpointsmsvoice/api_client_test.go +++ b/service/pinpointsmsvoice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pinpointsmsvoice/options.go b/service/pinpointsmsvoice/options.go index cdf2dbc1bae..a0f22871ffa 100644 --- a/service/pinpointsmsvoice/options.go +++ b/service/pinpointsmsvoice/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pinpointsmsvoicev2/api_client.go b/service/pinpointsmsvoicev2/api_client.go index 708d141cad6..123dab90690 100644 --- a/service/pinpointsmsvoicev2/api_client.go +++ b/service/pinpointsmsvoicev2/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pinpointsmsvoicev2/api_client_test.go b/service/pinpointsmsvoicev2/api_client_test.go index 09fbed96923..89504a0af80 100644 --- a/service/pinpointsmsvoicev2/api_client_test.go +++ b/service/pinpointsmsvoicev2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pinpointsmsvoicev2/options.go b/service/pinpointsmsvoicev2/options.go index 11927e81d99..48eb5cd75c2 100644 --- a/service/pinpointsmsvoicev2/options.go +++ b/service/pinpointsmsvoicev2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pipes/api_client.go b/service/pipes/api_client.go index f153a8414c3..c9e2b00ac33 100644 --- a/service/pipes/api_client.go +++ b/service/pipes/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pipes/api_client_test.go b/service/pipes/api_client_test.go index dc877153c7a..b5b61c98aee 100644 --- a/service/pipes/api_client_test.go +++ b/service/pipes/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pipes/options.go b/service/pipes/options.go index 9b5edfbe05c..f3d862a64b0 100644 --- a/service/pipes/options.go +++ b/service/pipes/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/polly/api_client.go b/service/polly/api_client.go index 307e9240053..24a8dbf0742 100644 --- a/service/polly/api_client.go +++ b/service/polly/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -57,7 +59,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/polly/api_client_test.go b/service/polly/api_client_test.go index 1a609de421f..9bfccdac9f4 100644 --- a/service/polly/api_client_test.go +++ b/service/polly/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/polly/options.go b/service/polly/options.go index 0f3ab554a86..0941ae37fe2 100644 --- a/service/polly/options.go +++ b/service/polly/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/pricing/api_client.go b/service/pricing/api_client.go index 6d3c2e7923c..3185fe07dbd 100644 --- a/service/pricing/api_client.go +++ b/service/pricing/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/pricing/api_client_test.go b/service/pricing/api_client_test.go index 80e61a39e29..fee59752027 100644 --- a/service/pricing/api_client_test.go +++ b/service/pricing/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/pricing/options.go b/service/pricing/options.go index 56457cc8a76..75cf87de816 100644 --- a/service/pricing/options.go +++ b/service/pricing/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/privatenetworks/api_client.go b/service/privatenetworks/api_client.go index 66280e5ed82..a3ea5b4b90a 100644 --- a/service/privatenetworks/api_client.go +++ b/service/privatenetworks/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/privatenetworks/api_client_test.go b/service/privatenetworks/api_client_test.go index 5d6dae189f3..e164b545466 100644 --- a/service/privatenetworks/api_client_test.go +++ b/service/privatenetworks/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/privatenetworks/options.go b/service/privatenetworks/options.go index 8302431fa1d..e48aa49665e 100644 --- a/service/privatenetworks/options.go +++ b/service/privatenetworks/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/proton/api_client.go b/service/proton/api_client.go index 49d206745c8..437c082b320 100644 --- a/service/proton/api_client.go +++ b/service/proton/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/proton/api_client_test.go b/service/proton/api_client_test.go index c85127d119f..af43747235f 100644 --- a/service/proton/api_client_test.go +++ b/service/proton/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/proton/options.go b/service/proton/options.go index 24da38215d0..58fa104099b 100644 --- a/service/proton/options.go +++ b/service/proton/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/qbusiness/api_client.go b/service/qbusiness/api_client.go index bab5cc6721b..a949e8d47b9 100644 --- a/service/qbusiness/api_client.go +++ b/service/qbusiness/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/qbusiness/api_client_test.go b/service/qbusiness/api_client_test.go index 4426adf6ff5..650bb436dc9 100644 --- a/service/qbusiness/api_client_test.go +++ b/service/qbusiness/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/qbusiness/options.go b/service/qbusiness/options.go index 4689343b19b..963714ee904 100644 --- a/service/qbusiness/options.go +++ b/service/qbusiness/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/qconnect/api_client.go b/service/qconnect/api_client.go index 29549c8094c..824271643ae 100644 --- a/service/qconnect/api_client.go +++ b/service/qconnect/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/qconnect/api_client_test.go b/service/qconnect/api_client_test.go index 71c4f93576d..e689b7f949e 100644 --- a/service/qconnect/api_client_test.go +++ b/service/qconnect/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/qconnect/options.go b/service/qconnect/options.go index c6dfe4f788a..42c2b4fba85 100644 --- a/service/qconnect/options.go +++ b/service/qconnect/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/qldb/api_client.go b/service/qldb/api_client.go index 7cc62422f32..5207dc64109 100644 --- a/service/qldb/api_client.go +++ b/service/qldb/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/qldb/api_client_test.go b/service/qldb/api_client_test.go index b9eb6117537..7d897920de9 100644 --- a/service/qldb/api_client_test.go +++ b/service/qldb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/qldb/options.go b/service/qldb/options.go index 4d55212e48e..28bc949451c 100644 --- a/service/qldb/options.go +++ b/service/qldb/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/qldbsession/api_client.go b/service/qldbsession/api_client.go index 2c74ecc05ad..7338fe6362e 100644 --- a/service/qldbsession/api_client.go +++ b/service/qldbsession/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/qldbsession/api_client_test.go b/service/qldbsession/api_client_test.go index bf2c9b11cc0..cbb71c865a4 100644 --- a/service/qldbsession/api_client_test.go +++ b/service/qldbsession/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/qldbsession/options.go b/service/qldbsession/options.go index 4e096d3c0ca..b79b15fb87f 100644 --- a/service/qldbsession/options.go +++ b/service/qldbsession/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/quicksight/api_client.go b/service/quicksight/api_client.go index f5950bc6f5f..6cfb1f2a856 100644 --- a/service/quicksight/api_client.go +++ b/service/quicksight/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/quicksight/api_client_test.go b/service/quicksight/api_client_test.go index 4448730cdd0..a0a5bb2372c 100644 --- a/service/quicksight/api_client_test.go +++ b/service/quicksight/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/quicksight/options.go b/service/quicksight/options.go index e1a51552b3c..bef20fecb97 100644 --- a/service/quicksight/options.go +++ b/service/quicksight/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ram/api_client.go b/service/ram/api_client.go index f21765c4771..c93034433b8 100644 --- a/service/ram/api_client.go +++ b/service/ram/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ram/api_client_test.go b/service/ram/api_client_test.go index 64c1f26fdc9..38e5eac4291 100644 --- a/service/ram/api_client_test.go +++ b/service/ram/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ram/options.go b/service/ram/options.go index 734335bbf51..53cb5ed0457 100644 --- a/service/ram/options.go +++ b/service/ram/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rbin/api_client.go b/service/rbin/api_client.go index e09c1df6190..ff3b4f9f84e 100644 --- a/service/rbin/api_client.go +++ b/service/rbin/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rbin/api_client_test.go b/service/rbin/api_client_test.go index eaa5037c795..4439a50b1e0 100644 --- a/service/rbin/api_client_test.go +++ b/service/rbin/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rbin/options.go b/service/rbin/options.go index b57ab844be2..8ab81fcf059 100644 --- a/service/rbin/options.go +++ b/service/rbin/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rds/api_client.go b/service/rds/api_client.go index ab6600b2081..4ceb38aabe6 100644 --- a/service/rds/api_client.go +++ b/service/rds/api_client.go @@ -46,6 +46,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rds/api_client_test.go b/service/rds/api_client_test.go index 528446db00a..4bd78335990 100644 --- a/service/rds/api_client_test.go +++ b/service/rds/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rds/options.go b/service/rds/options.go index efbcab1d673..f7d3a50892d 100644 --- a/service/rds/options.go +++ b/service/rds/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rdsdata/api_client.go b/service/rdsdata/api_client.go index 0ccc3786b37..50e49aa2645 100644 --- a/service/rdsdata/api_client.go +++ b/service/rdsdata/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rdsdata/api_client_test.go b/service/rdsdata/api_client_test.go index c0998e07785..d219d7a6051 100644 --- a/service/rdsdata/api_client_test.go +++ b/service/rdsdata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rdsdata/options.go b/service/rdsdata/options.go index 899c68fc6a7..3d459c5681a 100644 --- a/service/rdsdata/options.go +++ b/service/rdsdata/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/redshift/api_client.go b/service/redshift/api_client.go index 1d5bab47658..09c9f3c9c08 100644 --- a/service/redshift/api_client.go +++ b/service/redshift/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/redshift/api_client_test.go b/service/redshift/api_client_test.go index 857c59bd0e6..33f3d02064f 100644 --- a/service/redshift/api_client_test.go +++ b/service/redshift/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/redshift/options.go b/service/redshift/options.go index b5a923af944..1131fd4e7ff 100644 --- a/service/redshift/options.go +++ b/service/redshift/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/redshiftdata/api_client.go b/service/redshiftdata/api_client.go index f14cbe0581f..945d89a5e2b 100644 --- a/service/redshiftdata/api_client.go +++ b/service/redshiftdata/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/redshiftdata/api_client_test.go b/service/redshiftdata/api_client_test.go index 38c8e0eef98..ddf38324219 100644 --- a/service/redshiftdata/api_client_test.go +++ b/service/redshiftdata/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/redshiftdata/options.go b/service/redshiftdata/options.go index 02b3ceaeb5c..75274d1da99 100644 --- a/service/redshiftdata/options.go +++ b/service/redshiftdata/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/redshiftserverless/api_client.go b/service/redshiftserverless/api_client.go index 4f6c4ad6cf2..29267f3a8b1 100644 --- a/service/redshiftserverless/api_client.go +++ b/service/redshiftserverless/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/redshiftserverless/api_client_test.go b/service/redshiftserverless/api_client_test.go index eefa23411b3..3152f3d7776 100644 --- a/service/redshiftserverless/api_client_test.go +++ b/service/redshiftserverless/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/redshiftserverless/options.go b/service/redshiftserverless/options.go index c9e21327870..3037bef5056 100644 --- a/service/redshiftserverless/options.go +++ b/service/redshiftserverless/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rekognition/api_client.go b/service/rekognition/api_client.go index e96ec824bce..07aa39ac796 100644 --- a/service/rekognition/api_client.go +++ b/service/rekognition/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rekognition/api_client_test.go b/service/rekognition/api_client_test.go index 5f45b10d0b5..03c8fd29d1b 100644 --- a/service/rekognition/api_client_test.go +++ b/service/rekognition/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rekognition/options.go b/service/rekognition/options.go index 01edbea3e9b..98ebd9c8f26 100644 --- a/service/rekognition/options.go +++ b/service/rekognition/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/repostspace/api_client.go b/service/repostspace/api_client.go index 2e9aca6e185..f90bf60f41f 100644 --- a/service/repostspace/api_client.go +++ b/service/repostspace/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/repostspace/api_client_test.go b/service/repostspace/api_client_test.go index 969ec8059b5..0229a9f3015 100644 --- a/service/repostspace/api_client_test.go +++ b/service/repostspace/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/repostspace/options.go b/service/repostspace/options.go index 65b185d6bd5..0370fd9d196 100644 --- a/service/repostspace/options.go +++ b/service/repostspace/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/resiliencehub/api_client.go b/service/resiliencehub/api_client.go index a15c05c82ae..4717d710047 100644 --- a/service/resiliencehub/api_client.go +++ b/service/resiliencehub/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/resiliencehub/api_client_test.go b/service/resiliencehub/api_client_test.go index 1465dbb6875..ada28d95265 100644 --- a/service/resiliencehub/api_client_test.go +++ b/service/resiliencehub/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/resiliencehub/options.go b/service/resiliencehub/options.go index 2644cd5d02e..0f88fcee0b4 100644 --- a/service/resiliencehub/options.go +++ b/service/resiliencehub/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/resourceexplorer2/api_client.go b/service/resourceexplorer2/api_client.go index 50de79b1b5d..1bcf778b426 100644 --- a/service/resourceexplorer2/api_client.go +++ b/service/resourceexplorer2/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/resourceexplorer2/api_client_test.go b/service/resourceexplorer2/api_client_test.go index 33fb34be558..42c921ca5f5 100644 --- a/service/resourceexplorer2/api_client_test.go +++ b/service/resourceexplorer2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/resourceexplorer2/options.go b/service/resourceexplorer2/options.go index e3964198555..a5bab79f58d 100644 --- a/service/resourceexplorer2/options.go +++ b/service/resourceexplorer2/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/resourcegroups/api_client.go b/service/resourcegroups/api_client.go index e72e6a80667..481293664ec 100644 --- a/service/resourcegroups/api_client.go +++ b/service/resourcegroups/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/resourcegroups/api_client_test.go b/service/resourcegroups/api_client_test.go index 7f809daa3b0..c92b7167d33 100644 --- a/service/resourcegroups/api_client_test.go +++ b/service/resourcegroups/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/resourcegroups/options.go b/service/resourcegroups/options.go index 1d876494ca4..c941e8dd7f8 100644 --- a/service/resourcegroups/options.go +++ b/service/resourcegroups/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/resourcegroupstaggingapi/api_client.go b/service/resourcegroupstaggingapi/api_client.go index 7226eec9644..6f8349a91c0 100644 --- a/service/resourcegroupstaggingapi/api_client.go +++ b/service/resourcegroupstaggingapi/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/resourcegroupstaggingapi/api_client_test.go b/service/resourcegroupstaggingapi/api_client_test.go index 2649961752e..bf253404812 100644 --- a/service/resourcegroupstaggingapi/api_client_test.go +++ b/service/resourcegroupstaggingapi/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/resourcegroupstaggingapi/options.go b/service/resourcegroupstaggingapi/options.go index 0ba2eec2145..247ed084c7c 100644 --- a/service/resourcegroupstaggingapi/options.go +++ b/service/resourcegroupstaggingapi/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/robomaker/api_client.go b/service/robomaker/api_client.go index b49aaf3c490..2371a8790e0 100644 --- a/service/robomaker/api_client.go +++ b/service/robomaker/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/robomaker/api_client_test.go b/service/robomaker/api_client_test.go index 7d5a0005a44..8d4ed35865a 100644 --- a/service/robomaker/api_client_test.go +++ b/service/robomaker/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/robomaker/options.go b/service/robomaker/options.go index e29c16b7965..929dc42ba7b 100644 --- a/service/robomaker/options.go +++ b/service/robomaker/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rolesanywhere/api_client.go b/service/rolesanywhere/api_client.go index 856f19cdc51..afc78e0d1cd 100644 --- a/service/rolesanywhere/api_client.go +++ b/service/rolesanywhere/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rolesanywhere/api_client_test.go b/service/rolesanywhere/api_client_test.go index 35637c0f1cf..71cbe1981ec 100644 --- a/service/rolesanywhere/api_client_test.go +++ b/service/rolesanywhere/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rolesanywhere/options.go b/service/rolesanywhere/options.go index 8e9c1fe0a72..d7e99288833 100644 --- a/service/rolesanywhere/options.go +++ b/service/rolesanywhere/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53/api_client.go b/service/route53/api_client.go index e0630a21cf2..c12337dedf6 100644 --- a/service/route53/api_client.go +++ b/service/route53/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -56,7 +58,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -89,7 +91,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -337,7 +339,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53/api_client_test.go b/service/route53/api_client_test.go index 5b7480b42a7..3c20f97aa22 100644 --- a/service/route53/api_client_test.go +++ b/service/route53/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53/options.go b/service/route53/options.go index 40915658e1b..98b428f625c 100644 --- a/service/route53/options.go +++ b/service/route53/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53domains/api_client.go b/service/route53domains/api_client.go index 1a3d832aa67..72a5fa25f78 100644 --- a/service/route53domains/api_client.go +++ b/service/route53domains/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53domains/api_client_test.go b/service/route53domains/api_client_test.go index 45739b2ca6b..f48b0623911 100644 --- a/service/route53domains/api_client_test.go +++ b/service/route53domains/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53domains/options.go b/service/route53domains/options.go index add9bf73e78..a80c0cce1f4 100644 --- a/service/route53domains/options.go +++ b/service/route53domains/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53recoverycluster/api_client.go b/service/route53recoverycluster/api_client.go index 3e37ad7b140..b38e349ab56 100644 --- a/service/route53recoverycluster/api_client.go +++ b/service/route53recoverycluster/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53recoverycluster/api_client_test.go b/service/route53recoverycluster/api_client_test.go index f9af41b7f7d..c54e217bbf5 100644 --- a/service/route53recoverycluster/api_client_test.go +++ b/service/route53recoverycluster/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53recoverycluster/options.go b/service/route53recoverycluster/options.go index 1e26e668a17..dbb94a43fca 100644 --- a/service/route53recoverycluster/options.go +++ b/service/route53recoverycluster/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53recoverycontrolconfig/api_client.go b/service/route53recoverycontrolconfig/api_client.go index 4fdf886c2bc..512d34923c9 100644 --- a/service/route53recoverycontrolconfig/api_client.go +++ b/service/route53recoverycontrolconfig/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53recoverycontrolconfig/api_client_test.go b/service/route53recoverycontrolconfig/api_client_test.go index cc51f195825..7d9aad667ec 100644 --- a/service/route53recoverycontrolconfig/api_client_test.go +++ b/service/route53recoverycontrolconfig/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53recoverycontrolconfig/options.go b/service/route53recoverycontrolconfig/options.go index 61d05316858..91ab9e43013 100644 --- a/service/route53recoverycontrolconfig/options.go +++ b/service/route53recoverycontrolconfig/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53recoveryreadiness/api_client.go b/service/route53recoveryreadiness/api_client.go index 3af7a735ad8..b6b83463212 100644 --- a/service/route53recoveryreadiness/api_client.go +++ b/service/route53recoveryreadiness/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53recoveryreadiness/api_client_test.go b/service/route53recoveryreadiness/api_client_test.go index 887e577408a..4b3326e9df1 100644 --- a/service/route53recoveryreadiness/api_client_test.go +++ b/service/route53recoveryreadiness/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53recoveryreadiness/options.go b/service/route53recoveryreadiness/options.go index 732cdc8fbae..6c7b56f881b 100644 --- a/service/route53recoveryreadiness/options.go +++ b/service/route53recoveryreadiness/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/route53resolver/api_client.go b/service/route53resolver/api_client.go index 0d74b6bbd30..3c2bb21077c 100644 --- a/service/route53resolver/api_client.go +++ b/service/route53resolver/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/route53resolver/api_client_test.go b/service/route53resolver/api_client_test.go index 4844b2eb615..0f7e1533f96 100644 --- a/service/route53resolver/api_client_test.go +++ b/service/route53resolver/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/route53resolver/options.go b/service/route53resolver/options.go index 997265caa99..3b99e8080c6 100644 --- a/service/route53resolver/options.go +++ b/service/route53resolver/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/rum/api_client.go b/service/rum/api_client.go index a37687404e0..03528c761a3 100644 --- a/service/rum/api_client.go +++ b/service/rum/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/rum/api_client_test.go b/service/rum/api_client_test.go index 3f66c7d48b4..1fd6c5babd1 100644 --- a/service/rum/api_client_test.go +++ b/service/rum/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/rum/options.go b/service/rum/options.go index b9c154dac11..707f7f1ad3f 100644 --- a/service/rum/options.go +++ b/service/rum/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/s3/api_client.go b/service/s3/api_client.go index 9daad080d25..a3fe93b7f20 100644 --- a/service/s3/api_client.go +++ b/service/s3/api_client.go @@ -50,6 +50,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -64,7 +66,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) resolveCredentialProvider(&options) @@ -105,7 +107,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -372,7 +374,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/s3/api_client_test.go b/service/s3/api_client_test.go index d1199a51b1f..0ecffc6d7be 100644 --- a/service/s3/api_client_test.go +++ b/service/s3/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/s3/options.go b/service/s3/options.go index 271aaecdc5f..064bcefb4fd 100644 --- a/service/s3/options.go +++ b/service/s3/options.go @@ -88,11 +88,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/s3control/api_client.go b/service/s3control/api_client.go index 9bd021cc7e0..58b298312e3 100644 --- a/service/s3control/api_client.go +++ b/service/s3control/api_client.go @@ -46,6 +46,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -60,7 +62,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -93,7 +95,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -342,7 +344,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/s3control/api_client_test.go b/service/s3control/api_client_test.go index 7f6653dc1a5..edc05a96f65 100644 --- a/service/s3control/api_client_test.go +++ b/service/s3control/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/s3control/options.go b/service/s3control/options.go index 782456d2a4a..a27e36c85e4 100644 --- a/service/s3control/options.go +++ b/service/s3control/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/s3outposts/api_client.go b/service/s3outposts/api_client.go index 24e25d56df4..b0210afa4b7 100644 --- a/service/s3outposts/api_client.go +++ b/service/s3outposts/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/s3outposts/api_client_test.go b/service/s3outposts/api_client_test.go index e83ff270f85..730d57e3ca4 100644 --- a/service/s3outposts/api_client_test.go +++ b/service/s3outposts/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/s3outposts/options.go b/service/s3outposts/options.go index c70413a79a5..329de7d3ebb 100644 --- a/service/s3outposts/options.go +++ b/service/s3outposts/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemaker/api_client.go b/service/sagemaker/api_client.go index fec7061432c..c6c441c2f07 100644 --- a/service/sagemaker/api_client.go +++ b/service/sagemaker/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemaker/api_client_test.go b/service/sagemaker/api_client_test.go index cc42fe2c092..4c965543850 100644 --- a/service/sagemaker/api_client_test.go +++ b/service/sagemaker/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemaker/options.go b/service/sagemaker/options.go index 42976a9ca64..f34cfbc1e73 100644 --- a/service/sagemaker/options.go +++ b/service/sagemaker/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakera2iruntime/api_client.go b/service/sagemakera2iruntime/api_client.go index 656158791a5..dbd9f06bd49 100644 --- a/service/sagemakera2iruntime/api_client.go +++ b/service/sagemakera2iruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakera2iruntime/api_client_test.go b/service/sagemakera2iruntime/api_client_test.go index 0f6114b5f5d..f8cf1e5f8e2 100644 --- a/service/sagemakera2iruntime/api_client_test.go +++ b/service/sagemakera2iruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakera2iruntime/options.go b/service/sagemakera2iruntime/options.go index f59b25a3e29..99b41f4717e 100644 --- a/service/sagemakera2iruntime/options.go +++ b/service/sagemakera2iruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakeredge/api_client.go b/service/sagemakeredge/api_client.go index aa9d4353d05..53d9a9ae983 100644 --- a/service/sagemakeredge/api_client.go +++ b/service/sagemakeredge/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakeredge/api_client_test.go b/service/sagemakeredge/api_client_test.go index 054b7b124a7..515cd371b2c 100644 --- a/service/sagemakeredge/api_client_test.go +++ b/service/sagemakeredge/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakeredge/options.go b/service/sagemakeredge/options.go index 1a33afda5aa..91509de4fe0 100644 --- a/service/sagemakeredge/options.go +++ b/service/sagemakeredge/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakerfeaturestoreruntime/api_client.go b/service/sagemakerfeaturestoreruntime/api_client.go index 6dc0c3b26e9..ad3781ce93b 100644 --- a/service/sagemakerfeaturestoreruntime/api_client.go +++ b/service/sagemakerfeaturestoreruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakerfeaturestoreruntime/api_client_test.go b/service/sagemakerfeaturestoreruntime/api_client_test.go index 8133574aa65..799810ca80a 100644 --- a/service/sagemakerfeaturestoreruntime/api_client_test.go +++ b/service/sagemakerfeaturestoreruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakerfeaturestoreruntime/options.go b/service/sagemakerfeaturestoreruntime/options.go index c94ba8cb45a..504b6807183 100644 --- a/service/sagemakerfeaturestoreruntime/options.go +++ b/service/sagemakerfeaturestoreruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakergeospatial/api_client.go b/service/sagemakergeospatial/api_client.go index d0aecad5e83..b094ba823cb 100644 --- a/service/sagemakergeospatial/api_client.go +++ b/service/sagemakergeospatial/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakergeospatial/api_client_test.go b/service/sagemakergeospatial/api_client_test.go index beef43ad0fd..cc650a52d32 100644 --- a/service/sagemakergeospatial/api_client_test.go +++ b/service/sagemakergeospatial/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakergeospatial/options.go b/service/sagemakergeospatial/options.go index b91d65735af..17a4d3a6fa5 100644 --- a/service/sagemakergeospatial/options.go +++ b/service/sagemakergeospatial/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakermetrics/api_client.go b/service/sagemakermetrics/api_client.go index d43cb05f619..15873ccf64a 100644 --- a/service/sagemakermetrics/api_client.go +++ b/service/sagemakermetrics/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakermetrics/api_client_test.go b/service/sagemakermetrics/api_client_test.go index a8027483b41..c8426a0373b 100644 --- a/service/sagemakermetrics/api_client_test.go +++ b/service/sagemakermetrics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakermetrics/options.go b/service/sagemakermetrics/options.go index c42db56ac8c..409ab3fa21a 100644 --- a/service/sagemakermetrics/options.go +++ b/service/sagemakermetrics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sagemakerruntime/api_client.go b/service/sagemakerruntime/api_client.go index 568d3237ada..63e26ae23e0 100644 --- a/service/sagemakerruntime/api_client.go +++ b/service/sagemakerruntime/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sagemakerruntime/api_client_test.go b/service/sagemakerruntime/api_client_test.go index 53b2ebbeb50..caf86d5e5f8 100644 --- a/service/sagemakerruntime/api_client_test.go +++ b/service/sagemakerruntime/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sagemakerruntime/options.go b/service/sagemakerruntime/options.go index 650242cec76..30fab8f1581 100644 --- a/service/sagemakerruntime/options.go +++ b/service/sagemakerruntime/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/savingsplans/api_client.go b/service/savingsplans/api_client.go index aa99134473e..378706954f0 100644 --- a/service/savingsplans/api_client.go +++ b/service/savingsplans/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/savingsplans/api_client_test.go b/service/savingsplans/api_client_test.go index f0e8eac5234..07c1b5d10ab 100644 --- a/service/savingsplans/api_client_test.go +++ b/service/savingsplans/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/savingsplans/options.go b/service/savingsplans/options.go index 661413e6c29..0b0576a38f6 100644 --- a/service/savingsplans/options.go +++ b/service/savingsplans/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/scheduler/api_client.go b/service/scheduler/api_client.go index 5158657dcdb..8749fcb0916 100644 --- a/service/scheduler/api_client.go +++ b/service/scheduler/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/scheduler/api_client_test.go b/service/scheduler/api_client_test.go index 126562d35a0..be481655364 100644 --- a/service/scheduler/api_client_test.go +++ b/service/scheduler/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/scheduler/options.go b/service/scheduler/options.go index 568c8b676b4..5258e24cd94 100644 --- a/service/scheduler/options.go +++ b/service/scheduler/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/schemas/api_client.go b/service/schemas/api_client.go index f0588a57491..8a0869fc601 100644 --- a/service/schemas/api_client.go +++ b/service/schemas/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/schemas/api_client_test.go b/service/schemas/api_client_test.go index 892602d4d25..a585c9a5ee4 100644 --- a/service/schemas/api_client_test.go +++ b/service/schemas/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/schemas/options.go b/service/schemas/options.go index b8a81cdfac6..82be4a2bb17 100644 --- a/service/schemas/options.go +++ b/service/schemas/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/secretsmanager/api_client.go b/service/secretsmanager/api_client.go index 237dc521c61..99c25849ba3 100644 --- a/service/secretsmanager/api_client.go +++ b/service/secretsmanager/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/secretsmanager/api_client_test.go b/service/secretsmanager/api_client_test.go index 1d6b3c933ab..66f7853b5e1 100644 --- a/service/secretsmanager/api_client_test.go +++ b/service/secretsmanager/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/secretsmanager/options.go b/service/secretsmanager/options.go index 2bfb24e63bb..a8817523e98 100644 --- a/service/secretsmanager/options.go +++ b/service/secretsmanager/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/securityhub/api_client.go b/service/securityhub/api_client.go index 6b637c381d4..4f6aefa66c9 100644 --- a/service/securityhub/api_client.go +++ b/service/securityhub/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/securityhub/api_client_test.go b/service/securityhub/api_client_test.go index 95a40d1b06c..74b82b9e39a 100644 --- a/service/securityhub/api_client_test.go +++ b/service/securityhub/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/securityhub/options.go b/service/securityhub/options.go index bd3aff68b0a..ac4e7ec6d08 100644 --- a/service/securityhub/options.go +++ b/service/securityhub/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/securitylake/api_client.go b/service/securitylake/api_client.go index d87fad6641a..cbf658d2388 100644 --- a/service/securitylake/api_client.go +++ b/service/securitylake/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/securitylake/api_client_test.go b/service/securitylake/api_client_test.go index f89a11508e2..a797a7c6fac 100644 --- a/service/securitylake/api_client_test.go +++ b/service/securitylake/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/securitylake/options.go b/service/securitylake/options.go index 86840e6525b..0e1d88c8a88 100644 --- a/service/securitylake/options.go +++ b/service/securitylake/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/serverlessapplicationrepository/api_client.go b/service/serverlessapplicationrepository/api_client.go index 46e12d5b51e..ade485b2d12 100644 --- a/service/serverlessapplicationrepository/api_client.go +++ b/service/serverlessapplicationrepository/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/serverlessapplicationrepository/api_client_test.go b/service/serverlessapplicationrepository/api_client_test.go index c8ff171771b..4110549fc23 100644 --- a/service/serverlessapplicationrepository/api_client_test.go +++ b/service/serverlessapplicationrepository/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/serverlessapplicationrepository/options.go b/service/serverlessapplicationrepository/options.go index f43651ffceb..be06d23b895 100644 --- a/service/serverlessapplicationrepository/options.go +++ b/service/serverlessapplicationrepository/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/servicecatalog/api_client.go b/service/servicecatalog/api_client.go index 033a52bdd07..014a8d75ff7 100644 --- a/service/servicecatalog/api_client.go +++ b/service/servicecatalog/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/servicecatalog/api_client_test.go b/service/servicecatalog/api_client_test.go index 9f055c1f989..376704f4da8 100644 --- a/service/servicecatalog/api_client_test.go +++ b/service/servicecatalog/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/servicecatalog/options.go b/service/servicecatalog/options.go index e2f8eb272aa..a7ded309f4c 100644 --- a/service/servicecatalog/options.go +++ b/service/servicecatalog/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/servicecatalogappregistry/api_client.go b/service/servicecatalogappregistry/api_client.go index 0d9bad8fa02..601a061cf53 100644 --- a/service/servicecatalogappregistry/api_client.go +++ b/service/servicecatalogappregistry/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/servicecatalogappregistry/api_client_test.go b/service/servicecatalogappregistry/api_client_test.go index 94a22de1e83..d04708069b6 100644 --- a/service/servicecatalogappregistry/api_client_test.go +++ b/service/servicecatalogappregistry/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/servicecatalogappregistry/options.go b/service/servicecatalogappregistry/options.go index 5c07a398c37..73733a6f550 100644 --- a/service/servicecatalogappregistry/options.go +++ b/service/servicecatalogappregistry/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/servicediscovery/api_client.go b/service/servicediscovery/api_client.go index 044ee331f4d..14b734ac9bd 100644 --- a/service/servicediscovery/api_client.go +++ b/service/servicediscovery/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/servicediscovery/api_client_test.go b/service/servicediscovery/api_client_test.go index 9a649c45ebe..4f9a0a69511 100644 --- a/service/servicediscovery/api_client_test.go +++ b/service/servicediscovery/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/servicediscovery/options.go b/service/servicediscovery/options.go index 50e5583d874..340a4980aa2 100644 --- a/service/servicediscovery/options.go +++ b/service/servicediscovery/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/servicequotas/api_client.go b/service/servicequotas/api_client.go index b8345c59dc5..88ffac5cb6c 100644 --- a/service/servicequotas/api_client.go +++ b/service/servicequotas/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/servicequotas/api_client_test.go b/service/servicequotas/api_client_test.go index ea73c814808..ce8bb43ae37 100644 --- a/service/servicequotas/api_client_test.go +++ b/service/servicequotas/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/servicequotas/options.go b/service/servicequotas/options.go index 2a9cce0c15e..fb84fcd2073 100644 --- a/service/servicequotas/options.go +++ b/service/servicequotas/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ses/api_client.go b/service/ses/api_client.go index ab2af2d58a6..d8f0eef5b57 100644 --- a/service/ses/api_client.go +++ b/service/ses/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ses/api_client_test.go b/service/ses/api_client_test.go index 8f40ba7a89c..ad994b4104d 100644 --- a/service/ses/api_client_test.go +++ b/service/ses/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ses/options.go b/service/ses/options.go index f378e84ad8b..4228f8c9284 100644 --- a/service/ses/options.go +++ b/service/ses/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sesv2/api_client.go b/service/sesv2/api_client.go index 0ba646615b9..07eee0aa560 100644 --- a/service/sesv2/api_client.go +++ b/service/sesv2/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sesv2/api_client_test.go b/service/sesv2/api_client_test.go index 6a3642bfa06..2c1db5674d1 100644 --- a/service/sesv2/api_client_test.go +++ b/service/sesv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sesv2/options.go b/service/sesv2/options.go index df69133da94..8c495a0a7bc 100644 --- a/service/sesv2/options.go +++ b/service/sesv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sfn/api_client.go b/service/sfn/api_client.go index 721f0e77c69..2d0e82da400 100644 --- a/service/sfn/api_client.go +++ b/service/sfn/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sfn/api_client_test.go b/service/sfn/api_client_test.go index c1306d143a9..3a15867ed88 100644 --- a/service/sfn/api_client_test.go +++ b/service/sfn/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sfn/options.go b/service/sfn/options.go index 544cc7f2038..dd620811879 100644 --- a/service/sfn/options.go +++ b/service/sfn/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/shield/api_client.go b/service/shield/api_client.go index 2cf37f7e258..521f9b352fa 100644 --- a/service/shield/api_client.go +++ b/service/shield/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/shield/api_client_test.go b/service/shield/api_client_test.go index 085c9a6d712..2f19b11b5d7 100644 --- a/service/shield/api_client_test.go +++ b/service/shield/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/shield/options.go b/service/shield/options.go index dd72f86e676..7bcfe299f36 100644 --- a/service/shield/options.go +++ b/service/shield/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/signer/api_client.go b/service/signer/api_client.go index e53b3da25e7..d4eaba85662 100644 --- a/service/signer/api_client.go +++ b/service/signer/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/signer/api_client_test.go b/service/signer/api_client_test.go index 29e3f303764..5d9ca93c5e6 100644 --- a/service/signer/api_client_test.go +++ b/service/signer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/signer/options.go b/service/signer/options.go index c31a4ded2fd..5b89a761c1f 100644 --- a/service/signer/options.go +++ b/service/signer/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/simspaceweaver/api_client.go b/service/simspaceweaver/api_client.go index 184094ab9c2..bd91384e232 100644 --- a/service/simspaceweaver/api_client.go +++ b/service/simspaceweaver/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/simspaceweaver/api_client_test.go b/service/simspaceweaver/api_client_test.go index e1102268ac7..661975cb50b 100644 --- a/service/simspaceweaver/api_client_test.go +++ b/service/simspaceweaver/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/simspaceweaver/options.go b/service/simspaceweaver/options.go index b6fd2295b29..658f08ee598 100644 --- a/service/simspaceweaver/options.go +++ b/service/simspaceweaver/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sms/api_client.go b/service/sms/api_client.go index b1d7172b2c8..6dc843ea16b 100644 --- a/service/sms/api_client.go +++ b/service/sms/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sms/api_client_test.go b/service/sms/api_client_test.go index 36e704575cb..34bcfaee169 100644 --- a/service/sms/api_client_test.go +++ b/service/sms/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sms/options.go b/service/sms/options.go index 39d602566b1..e664fe1ab67 100644 --- a/service/sms/options.go +++ b/service/sms/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/snowball/api_client.go b/service/snowball/api_client.go index a12d2205a78..cc3db20eeae 100644 --- a/service/snowball/api_client.go +++ b/service/snowball/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/snowball/api_client_test.go b/service/snowball/api_client_test.go index 5295d77103a..345fff0943d 100644 --- a/service/snowball/api_client_test.go +++ b/service/snowball/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/snowball/options.go b/service/snowball/options.go index 1dd6b373300..6a2215c6ee6 100644 --- a/service/snowball/options.go +++ b/service/snowball/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/snowdevicemanagement/api_client.go b/service/snowdevicemanagement/api_client.go index 72fffd76ca5..82c9c24d13f 100644 --- a/service/snowdevicemanagement/api_client.go +++ b/service/snowdevicemanagement/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/snowdevicemanagement/api_client_test.go b/service/snowdevicemanagement/api_client_test.go index 22f39ad32f2..beafa17bc7c 100644 --- a/service/snowdevicemanagement/api_client_test.go +++ b/service/snowdevicemanagement/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/snowdevicemanagement/options.go b/service/snowdevicemanagement/options.go index e52f4d89efb..a23aaa58de7 100644 --- a/service/snowdevicemanagement/options.go +++ b/service/snowdevicemanagement/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sns/api_client.go b/service/sns/api_client.go index 7db11858d3b..f9f49a4a169 100644 --- a/service/sns/api_client.go +++ b/service/sns/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sns/api_client_test.go b/service/sns/api_client_test.go index 9530715f7f1..8cdcaa76417 100644 --- a/service/sns/api_client_test.go +++ b/service/sns/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sns/options.go b/service/sns/options.go index 460da0ac00b..164bc9fd80b 100644 --- a/service/sns/options.go +++ b/service/sns/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sqs/api_client.go b/service/sqs/api_client.go index 76a77371bb8..078e5a039b1 100644 --- a/service/sqs/api_client.go +++ b/service/sqs/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sqs/api_client_test.go b/service/sqs/api_client_test.go index 64f5ca9584a..efd5991d8cf 100644 --- a/service/sqs/api_client_test.go +++ b/service/sqs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sqs/options.go b/service/sqs/options.go index a540b03551a..ce3b7c08a4f 100644 --- a/service/sqs/options.go +++ b/service/sqs/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssm/api_client.go b/service/ssm/api_client.go index 5f7a8403cb0..973f468d6cc 100644 --- a/service/ssm/api_client.go +++ b/service/ssm/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssm/api_client_test.go b/service/ssm/api_client_test.go index 2c5fba15bb3..9f238cdeb15 100644 --- a/service/ssm/api_client_test.go +++ b/service/ssm/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssm/options.go b/service/ssm/options.go index ed72e5ebf34..197dfd32601 100644 --- a/service/ssm/options.go +++ b/service/ssm/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssmcontacts/api_client.go b/service/ssmcontacts/api_client.go index 30195f91900..2d5df6a118c 100644 --- a/service/ssmcontacts/api_client.go +++ b/service/ssmcontacts/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssmcontacts/api_client_test.go b/service/ssmcontacts/api_client_test.go index 06176bda95d..54c4293ff5a 100644 --- a/service/ssmcontacts/api_client_test.go +++ b/service/ssmcontacts/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssmcontacts/options.go b/service/ssmcontacts/options.go index d70ea4b6771..33962843fa0 100644 --- a/service/ssmcontacts/options.go +++ b/service/ssmcontacts/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssmincidents/api_client.go b/service/ssmincidents/api_client.go index a580312598c..051d9b9ec25 100644 --- a/service/ssmincidents/api_client.go +++ b/service/ssmincidents/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssmincidents/api_client_test.go b/service/ssmincidents/api_client_test.go index dba32cab8fc..86979b2bf9d 100644 --- a/service/ssmincidents/api_client_test.go +++ b/service/ssmincidents/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssmincidents/options.go b/service/ssmincidents/options.go index ae219cc0b5f..4e460d6bae7 100644 --- a/service/ssmincidents/options.go +++ b/service/ssmincidents/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssmsap/api_client.go b/service/ssmsap/api_client.go index d20c4ab8e40..9fa396085f0 100644 --- a/service/ssmsap/api_client.go +++ b/service/ssmsap/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssmsap/api_client_test.go b/service/ssmsap/api_client_test.go index 651cc979d2a..cf70fcf5765 100644 --- a/service/ssmsap/api_client_test.go +++ b/service/ssmsap/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssmsap/options.go b/service/ssmsap/options.go index 5ddb9a0ec11..5d87320d021 100644 --- a/service/ssmsap/options.go +++ b/service/ssmsap/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sso/api_client.go b/service/sso/api_client.go index 93669a966db..e439699253b 100644 --- a/service/sso/api_client.go +++ b/service/sso/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sso/api_client_test.go b/service/sso/api_client_test.go index a0315687639..8964825f6a4 100644 --- a/service/sso/api_client_test.go +++ b/service/sso/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sso/options.go b/service/sso/options.go index ddc5c0df369..5dee7e53f47 100644 --- a/service/sso/options.go +++ b/service/sso/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssoadmin/api_client.go b/service/ssoadmin/api_client.go index 3908c722eef..55a0d66be7d 100644 --- a/service/ssoadmin/api_client.go +++ b/service/ssoadmin/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssoadmin/api_client_test.go b/service/ssoadmin/api_client_test.go index 34f51ada553..3473d3a2aeb 100644 --- a/service/ssoadmin/api_client_test.go +++ b/service/ssoadmin/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssoadmin/options.go b/service/ssoadmin/options.go index 762cc1d9413..19a73da494a 100644 --- a/service/ssoadmin/options.go +++ b/service/ssoadmin/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/ssooidc/api_client.go b/service/ssooidc/api_client.go index 90addc4fc24..fed0897390b 100644 --- a/service/ssooidc/api_client.go +++ b/service/ssooidc/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/ssooidc/api_client_test.go b/service/ssooidc/api_client_test.go index 79a47698103..13d0d870099 100644 --- a/service/ssooidc/api_client_test.go +++ b/service/ssooidc/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/ssooidc/options.go b/service/ssooidc/options.go index f338f7d6857..b964e7e1090 100644 --- a/service/ssooidc/options.go +++ b/service/ssooidc/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/storagegateway/api_client.go b/service/storagegateway/api_client.go index 0718f8586d7..63cd7792ecb 100644 --- a/service/storagegateway/api_client.go +++ b/service/storagegateway/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/storagegateway/api_client_test.go b/service/storagegateway/api_client_test.go index 2f0689874f8..57f596ce81d 100644 --- a/service/storagegateway/api_client_test.go +++ b/service/storagegateway/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/storagegateway/options.go b/service/storagegateway/options.go index d2fe242348e..56242643334 100644 --- a/service/storagegateway/options.go +++ b/service/storagegateway/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/sts/api_client.go b/service/sts/api_client.go index 2fb478f6f0a..59cc4c70a38 100644 --- a/service/sts/api_client.go +++ b/service/sts/api_client.go @@ -46,6 +46,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/sts/api_client_test.go b/service/sts/api_client_test.go index 43fde524897..9d8053c6b0b 100644 --- a/service/sts/api_client_test.go +++ b/service/sts/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/sts/options.go b/service/sts/options.go index 2c7a03701c8..5c1be79f8c0 100644 --- a/service/sts/options.go +++ b/service/sts/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/support/api_client.go b/service/support/api_client.go index 84d4e38616d..26c69a172e5 100644 --- a/service/support/api_client.go +++ b/service/support/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/support/api_client_test.go b/service/support/api_client_test.go index d4b3b640b95..d14993cffef 100644 --- a/service/support/api_client_test.go +++ b/service/support/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/support/options.go b/service/support/options.go index 53280949844..69b1659dd46 100644 --- a/service/support/options.go +++ b/service/support/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/supportapp/api_client.go b/service/supportapp/api_client.go index fe0463d45ff..6c07bd2471d 100644 --- a/service/supportapp/api_client.go +++ b/service/supportapp/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/supportapp/api_client_test.go b/service/supportapp/api_client_test.go index b8c7e292df1..16cad18dec0 100644 --- a/service/supportapp/api_client_test.go +++ b/service/supportapp/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/supportapp/options.go b/service/supportapp/options.go index 8f19d86e0e9..673b81f421e 100644 --- a/service/supportapp/options.go +++ b/service/supportapp/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/swf/api_client.go b/service/swf/api_client.go index 42ca4d3f3b2..5c96e1b3b7b 100644 --- a/service/swf/api_client.go +++ b/service/swf/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/swf/api_client_test.go b/service/swf/api_client_test.go index 3b36955d757..6e40a62652c 100644 --- a/service/swf/api_client_test.go +++ b/service/swf/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/swf/options.go b/service/swf/options.go index 9140fc3eebe..bdd7ae4f100 100644 --- a/service/swf/options.go +++ b/service/swf/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/synthetics/api_client.go b/service/synthetics/api_client.go index e0850ffba9e..d4e227181a1 100644 --- a/service/synthetics/api_client.go +++ b/service/synthetics/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/synthetics/api_client_test.go b/service/synthetics/api_client_test.go index 53cf860ef7b..6c897fa44f2 100644 --- a/service/synthetics/api_client_test.go +++ b/service/synthetics/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/synthetics/options.go b/service/synthetics/options.go index 4acc32e16c2..58706c4623f 100644 --- a/service/synthetics/options.go +++ b/service/synthetics/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/textract/api_client.go b/service/textract/api_client.go index fa62ca2e721..396aa5e859a 100644 --- a/service/textract/api_client.go +++ b/service/textract/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/textract/api_client_test.go b/service/textract/api_client_test.go index 45b265fa73c..8d1459aa655 100644 --- a/service/textract/api_client_test.go +++ b/service/textract/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/textract/options.go b/service/textract/options.go index 42ef82af690..3196d15dc46 100644 --- a/service/textract/options.go +++ b/service/textract/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/timestreamquery/api_client.go b/service/timestreamquery/api_client.go index b4f06539ae9..38d59291619 100644 --- a/service/timestreamquery/api_client.go +++ b/service/timestreamquery/api_client.go @@ -51,6 +51,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -67,7 +69,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -102,7 +104,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -351,7 +353,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/timestreamquery/api_client_test.go b/service/timestreamquery/api_client_test.go index 5c00374b112..61de38ead51 100644 --- a/service/timestreamquery/api_client_test.go +++ b/service/timestreamquery/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/timestreamquery/options.go b/service/timestreamquery/options.go index 95c40b0dbb4..63731806d26 100644 --- a/service/timestreamquery/options.go +++ b/service/timestreamquery/options.go @@ -77,11 +77,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/timestreamwrite/api_client.go b/service/timestreamwrite/api_client.go index 639663423c1..9faa3c21310 100644 --- a/service/timestreamwrite/api_client.go +++ b/service/timestreamwrite/api_client.go @@ -51,6 +51,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -67,7 +69,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -102,7 +104,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -351,7 +353,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/timestreamwrite/api_client_test.go b/service/timestreamwrite/api_client_test.go index dd8d560185f..adb751ee8f7 100644 --- a/service/timestreamwrite/api_client_test.go +++ b/service/timestreamwrite/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/timestreamwrite/options.go b/service/timestreamwrite/options.go index 33a2025ea3b..d5fe7e8d723 100644 --- a/service/timestreamwrite/options.go +++ b/service/timestreamwrite/options.go @@ -77,11 +77,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/tnb/api_client.go b/service/tnb/api_client.go index 81b56eb0f86..19c5b75c2c4 100644 --- a/service/tnb/api_client.go +++ b/service/tnb/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/tnb/api_client_test.go b/service/tnb/api_client_test.go index 7f03ac66783..36ff1fc6de3 100644 --- a/service/tnb/api_client_test.go +++ b/service/tnb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/tnb/options.go b/service/tnb/options.go index aca79f4d3a1..8c585deba7a 100644 --- a/service/tnb/options.go +++ b/service/tnb/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/transcribe/api_client.go b/service/transcribe/api_client.go index 94798300be0..b4bba7691f9 100644 --- a/service/transcribe/api_client.go +++ b/service/transcribe/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/transcribe/api_client_test.go b/service/transcribe/api_client_test.go index 4dc824f2300..9e735150a85 100644 --- a/service/transcribe/api_client_test.go +++ b/service/transcribe/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/transcribe/options.go b/service/transcribe/options.go index d7953fcc4a0..6960421abe6 100644 --- a/service/transcribe/options.go +++ b/service/transcribe/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/transcribestreaming/api_client.go b/service/transcribestreaming/api_client.go index d8a53870f1c..f051ff0f631 100644 --- a/service/transcribestreaming/api_client.go +++ b/service/transcribestreaming/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -90,7 +92,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf setSafeEventStreamClientLogMode(&options, opID) - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -338,7 +340,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/transcribestreaming/api_client_test.go b/service/transcribestreaming/api_client_test.go index da1f53d133c..a0357eea4cb 100644 --- a/service/transcribestreaming/api_client_test.go +++ b/service/transcribestreaming/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/transcribestreaming/options.go b/service/transcribestreaming/options.go index 62e70551a7d..29197d36f90 100644 --- a/service/transcribestreaming/options.go +++ b/service/transcribestreaming/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/transfer/api_client.go b/service/transfer/api_client.go index 108f4195ece..1c62f466764 100644 --- a/service/transfer/api_client.go +++ b/service/transfer/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/transfer/api_client_test.go b/service/transfer/api_client_test.go index ae5aafc3bef..4c432ac42f9 100644 --- a/service/transfer/api_client_test.go +++ b/service/transfer/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/transfer/options.go b/service/transfer/options.go index 05aeb6405fa..d78c3b1b72c 100644 --- a/service/transfer/options.go +++ b/service/transfer/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/translate/api_client.go b/service/translate/api_client.go index f8d44661c3c..146d04c4aaf 100644 --- a/service/translate/api_client.go +++ b/service/translate/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/translate/api_client_test.go b/service/translate/api_client_test.go index 5b09f8b5468..63d5859d577 100644 --- a/service/translate/api_client_test.go +++ b/service/translate/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/translate/options.go b/service/translate/options.go index b31fa375122..2ce6b77d68d 100644 --- a/service/translate/options.go +++ b/service/translate/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/trustedadvisor/api_client.go b/service/trustedadvisor/api_client.go index bc539085194..599b9cc5576 100644 --- a/service/trustedadvisor/api_client.go +++ b/service/trustedadvisor/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/trustedadvisor/api_client_test.go b/service/trustedadvisor/api_client_test.go index b23fb3e3177..09201c2bb60 100644 --- a/service/trustedadvisor/api_client_test.go +++ b/service/trustedadvisor/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/trustedadvisor/options.go b/service/trustedadvisor/options.go index e4e944e10a2..4114ac3e216 100644 --- a/service/trustedadvisor/options.go +++ b/service/trustedadvisor/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/verifiedpermissions/api_client.go b/service/verifiedpermissions/api_client.go index fbc4c73adf3..ff4a9917886 100644 --- a/service/verifiedpermissions/api_client.go +++ b/service/verifiedpermissions/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/verifiedpermissions/api_client_test.go b/service/verifiedpermissions/api_client_test.go index 13f125ca103..52de06e94b1 100644 --- a/service/verifiedpermissions/api_client_test.go +++ b/service/verifiedpermissions/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/verifiedpermissions/options.go b/service/verifiedpermissions/options.go index 4d5576ce0aa..d31ad4c9c98 100644 --- a/service/verifiedpermissions/options.go +++ b/service/verifiedpermissions/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/voiceid/api_client.go b/service/voiceid/api_client.go index 8cf99027b7a..5c0c7c63fa6 100644 --- a/service/voiceid/api_client.go +++ b/service/voiceid/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/voiceid/api_client_test.go b/service/voiceid/api_client_test.go index 6768cb424b6..c7d3a393c45 100644 --- a/service/voiceid/api_client_test.go +++ b/service/voiceid/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/voiceid/options.go b/service/voiceid/options.go index 5c5a179a169..cb30aaf68fc 100644 --- a/service/voiceid/options.go +++ b/service/voiceid/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/vpclattice/api_client.go b/service/vpclattice/api_client.go index 4a8a7042010..c860cb1cc15 100644 --- a/service/vpclattice/api_client.go +++ b/service/vpclattice/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/vpclattice/api_client_test.go b/service/vpclattice/api_client_test.go index 298c9aea644..f1551ff0fef 100644 --- a/service/vpclattice/api_client_test.go +++ b/service/vpclattice/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/vpclattice/options.go b/service/vpclattice/options.go index 1fcdc3b9bb3..791d3a84876 100644 --- a/service/vpclattice/options.go +++ b/service/vpclattice/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/waf/api_client.go b/service/waf/api_client.go index b182f33e812..0107b47b9d7 100644 --- a/service/waf/api_client.go +++ b/service/waf/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/waf/api_client_test.go b/service/waf/api_client_test.go index 432489fa9c3..ea4831bd36b 100644 --- a/service/waf/api_client_test.go +++ b/service/waf/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/waf/options.go b/service/waf/options.go index 05ddf0f615d..759f9257429 100644 --- a/service/waf/options.go +++ b/service/waf/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/wafregional/api_client.go b/service/wafregional/api_client.go index 27a96b6fdf3..2da6ab3bc40 100644 --- a/service/wafregional/api_client.go +++ b/service/wafregional/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/wafregional/api_client_test.go b/service/wafregional/api_client_test.go index 44115fa24df..450b0aefc40 100644 --- a/service/wafregional/api_client_test.go +++ b/service/wafregional/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/wafregional/options.go b/service/wafregional/options.go index b1d1938c0ca..8139ebd1ed6 100644 --- a/service/wafregional/options.go +++ b/service/wafregional/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/wafv2/api_client.go b/service/wafv2/api_client.go index 55a0ea418e5..abd5886dd2a 100644 --- a/service/wafv2/api_client.go +++ b/service/wafv2/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/wafv2/api_client_test.go b/service/wafv2/api_client_test.go index 14f310419bc..96598da5f8b 100644 --- a/service/wafv2/api_client_test.go +++ b/service/wafv2/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/wafv2/options.go b/service/wafv2/options.go index 90cff51ac47..90a71b90531 100644 --- a/service/wafv2/options.go +++ b/service/wafv2/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/wellarchitected/api_client.go b/service/wellarchitected/api_client.go index 91076a0186c..02c2a23882d 100644 --- a/service/wellarchitected/api_client.go +++ b/service/wellarchitected/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/wellarchitected/api_client_test.go b/service/wellarchitected/api_client_test.go index b9d5832c10b..c8e2104cc23 100644 --- a/service/wellarchitected/api_client_test.go +++ b/service/wellarchitected/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/wellarchitected/options.go b/service/wellarchitected/options.go index 54a42690c9d..5b2102017ec 100644 --- a/service/wellarchitected/options.go +++ b/service/wellarchitected/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/wisdom/api_client.go b/service/wisdom/api_client.go index 239a37af0b3..2cc5c36571e 100644 --- a/service/wisdom/api_client.go +++ b/service/wisdom/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/wisdom/api_client_test.go b/service/wisdom/api_client_test.go index f249a4220dc..7f4ee58a37e 100644 --- a/service/wisdom/api_client_test.go +++ b/service/wisdom/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/wisdom/options.go b/service/wisdom/options.go index b74b5b74bd5..5dcadba3b04 100644 --- a/service/wisdom/options.go +++ b/service/wisdom/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workdocs/api_client.go b/service/workdocs/api_client.go index b4aa820e927..836b32180b7 100644 --- a/service/workdocs/api_client.go +++ b/service/workdocs/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workdocs/api_client_test.go b/service/workdocs/api_client_test.go index a0975c2b0aa..023e518885f 100644 --- a/service/workdocs/api_client_test.go +++ b/service/workdocs/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workdocs/options.go b/service/workdocs/options.go index a0f0d5ecba8..df4739d4291 100644 --- a/service/workdocs/options.go +++ b/service/workdocs/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/worklink/api_client.go b/service/worklink/api_client.go index 737c5a1b3d4..4a8645683cd 100644 --- a/service/worklink/api_client.go +++ b/service/worklink/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/worklink/api_client_test.go b/service/worklink/api_client_test.go index 79d9fdabc71..2d55213a421 100644 --- a/service/worklink/api_client_test.go +++ b/service/worklink/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/worklink/options.go b/service/worklink/options.go index 8e95bde1adb..56b4993937b 100644 --- a/service/worklink/options.go +++ b/service/worklink/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workmail/api_client.go b/service/workmail/api_client.go index 708977a38aa..746f8625375 100644 --- a/service/workmail/api_client.go +++ b/service/workmail/api_client.go @@ -44,6 +44,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -58,7 +60,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -91,7 +93,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -339,7 +341,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workmail/api_client_test.go b/service/workmail/api_client_test.go index 021bcba1399..24d930e6667 100644 --- a/service/workmail/api_client_test.go +++ b/service/workmail/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workmail/options.go b/service/workmail/options.go index e76b4940b82..cb93eca48f2 100644 --- a/service/workmail/options.go +++ b/service/workmail/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workmailmessageflow/api_client.go b/service/workmailmessageflow/api_client.go index ef4f3708aa7..2a399897e47 100644 --- a/service/workmailmessageflow/api_client.go +++ b/service/workmailmessageflow/api_client.go @@ -43,6 +43,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -55,7 +57,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -88,7 +90,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -336,7 +338,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workmailmessageflow/api_client_test.go b/service/workmailmessageflow/api_client_test.go index 5008d32907e..36843eddf3e 100644 --- a/service/workmailmessageflow/api_client_test.go +++ b/service/workmailmessageflow/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workmailmessageflow/options.go b/service/workmailmessageflow/options.go index 2cb23f9defb..c8cbc66d0ba 100644 --- a/service/workmailmessageflow/options.go +++ b/service/workmailmessageflow/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workspaces/api_client.go b/service/workspaces/api_client.go index 75ea25bc138..75bdb930596 100644 --- a/service/workspaces/api_client.go +++ b/service/workspaces/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workspaces/api_client_test.go b/service/workspaces/api_client_test.go index f1e2fdac13c..c742c30a7fe 100644 --- a/service/workspaces/api_client_test.go +++ b/service/workspaces/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workspaces/options.go b/service/workspaces/options.go index a4054298bfe..ba469893f0b 100644 --- a/service/workspaces/options.go +++ b/service/workspaces/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workspacesthinclient/api_client.go b/service/workspacesthinclient/api_client.go index 1a0021c3fc8..431023ed515 100644 --- a/service/workspacesthinclient/api_client.go +++ b/service/workspacesthinclient/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workspacesthinclient/api_client_test.go b/service/workspacesthinclient/api_client_test.go index 3160938df0c..ca46f421901 100644 --- a/service/workspacesthinclient/api_client_test.go +++ b/service/workspacesthinclient/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workspacesthinclient/options.go b/service/workspacesthinclient/options.go index f573ccf9e30..48b7ff835ab 100644 --- a/service/workspacesthinclient/options.go +++ b/service/workspacesthinclient/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/workspacesweb/api_client.go b/service/workspacesweb/api_client.go index 661caa20314..52c076674e2 100644 --- a/service/workspacesweb/api_client.go +++ b/service/workspacesweb/api_client.go @@ -45,6 +45,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -59,7 +61,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -92,7 +94,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -340,7 +342,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/workspacesweb/api_client_test.go b/service/workspacesweb/api_client_test.go index ecac183b43e..c46ff91dfc4 100644 --- a/service/workspacesweb/api_client_test.go +++ b/service/workspacesweb/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/workspacesweb/options.go b/service/workspacesweb/options.go index 91e7d3202ed..453592286e9 100644 --- a/service/workspacesweb/options.go +++ b/service/workspacesweb/options.go @@ -74,11 +74,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int diff --git a/service/xray/api_client.go b/service/xray/api_client.go index 423b2780288..971c8b7e100 100644 --- a/service/xray/api_client.go +++ b/service/xray/api_client.go @@ -42,6 +42,8 @@ func New(options Options, optFns ...func(*Options)) *Client { setResolvedDefaultsMode(&options) + resolveRetryer(&options) + resolveHTTPClient(&options) resolveHTTPSignerV4(&options) @@ -54,7 +56,7 @@ func New(options Options, optFns ...func(*Options)) *Client { fn(&options) } - resolveRetryer(&options) + finalizeRetryMaxAttempts(&options) ignoreAnonymousAuth(&options) @@ -87,7 +89,7 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf fn(&options) } - finalizeRetryMaxAttemptOptions(&options, *c) + finalizeOperationRetryMaxAttempts(&options, *c) finalizeClientEndpointResolverOptions(&options) @@ -335,7 +337,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { o.RetryMaxAttempts = cfg.RetryMaxAttempts } -func finalizeRetryMaxAttemptOptions(o *Options, client Client) { +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } diff --git a/service/xray/api_client_test.go b/service/xray/api_client_test.go index c3734477453..36fc1cad51a 100644 --- a/service/xray/api_client_test.go +++ b/service/xray/api_client_test.go @@ -85,6 +85,10 @@ func TestClient_resolveRetryOptions(t *testing.T) { HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { diff --git a/service/xray/options.go b/service/xray/options.go index c5669aafef8..bcc3ba46c14 100644 --- a/service/xray/options.go +++ b/service/xray/options.go @@ -70,11 +70,9 @@ type Options struct { // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. When creating a new API Clients this - // member will only be used if the Retryer Options member is nil. This value will - // be ignored if Retryer is not nil. If specified in an operation call's functional - // options with a value that is different than the constructed client's Options, - // the Client's Retryer will be wrapped to use the operation's specific + // per operation call's retry max attempts. If specified in an operation call's + // functional options with a value that is different than the constructed client's + // Options, the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int