From 1a6b40bb973a2c5d0db7d2986c4336ecd4d49991 Mon Sep 17 00:00:00 2001 From: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Date: Wed, 10 Nov 2021 10:02:21 -0800 Subject: [PATCH] Regnerate API clients to include WaitForOutput waiter method (#1485) Updates the SDK's API clients to include the new WaitForOutput added in smithy-go https://github.com/aws/smithy-go/pull/319/ change. --- .../9a51012d895e4d9986a4294d67b469a1.json | 57 ++++++++ service/acm/api_op_DescribeCertificate.go | 23 ++- ...DescribeCertificateAuthorityAuditReport.go | 23 ++- service/acmpca/api_op_GetCertificate.go | 23 ++- .../api_op_GetCertificateAuthorityCsr.go | 23 ++- service/amp/api_op_DescribeWorkspace.go | 46 ++++-- service/appstream/api_op_DescribeFleets.go | 44 ++++-- .../api_op_DescribeAutoScalingGroups.go | 68 ++++++--- .../api_op_GetResourceRequestStatus.go | 23 ++- .../api_op_DescribeChangeSet.go | 23 ++- .../cloudformation/api_op_DescribeStacks.go | 137 ++++++++++++------ .../api_op_DescribeTypeRegistration.go | 23 ++- service/cloudfront/api_op_GetDistribution.go | 23 ++- service/cloudfront/api_op_GetInvalidation.go | 23 ++- .../api_op_GetStreamingDistribution.go | 23 ++- service/cloudwatch/api_op_DescribeAlarms.go | 45 ++++-- service/codedeploy/api_op_GetDeployment.go | 23 ++- .../api_op_DescribeCodeReview.go | 23 ++- .../api_op_DescribeRepositoryAssociation.go | 23 ++- .../api_op_DescribeConnections.go | 23 ++- .../api_op_DescribeEndpoints.go | 23 ++- .../api_op_DescribeReplicationInstances.go | 46 ++++-- .../api_op_DescribeReplicationTasks.go | 92 ++++++++---- service/docdb/api_op_DescribeDBInstances.go | 23 ++- service/dynamodb/api_op_DescribeTable.go | 45 ++++-- service/ec2/api_op_DescribeBundleTasks.go | 23 ++- service/ec2/api_op_DescribeConversionTasks.go | 69 ++++++--- .../ec2/api_op_DescribeCustomerGateways.go | 23 ++- service/ec2/api_op_DescribeExportTasks.go | 46 ++++-- service/ec2/api_op_DescribeImages.go | 45 ++++-- service/ec2/api_op_DescribeInstanceStatus.go | 46 ++++-- service/ec2/api_op_DescribeInstances.go | 92 ++++++++---- service/ec2/api_op_DescribeKeyPairs.go | 22 ++- service/ec2/api_op_DescribeNatGateways.go | 23 ++- .../ec2/api_op_DescribeNetworkInterfaces.go | 23 ++- service/ec2/api_op_DescribeSecurityGroups.go | 23 ++- service/ec2/api_op_DescribeSnapshots.go | 23 ++- .../api_op_DescribeSpotInstanceRequests.go | 23 ++- service/ec2/api_op_DescribeSubnets.go | 23 ++- service/ec2/api_op_DescribeVolumes.go | 67 ++++++--- .../api_op_DescribeVpcPeeringConnections.go | 46 ++++-- service/ec2/api_op_DescribeVpcs.go | 44 ++++-- service/ec2/api_op_DescribeVpnConnections.go | 46 ++++-- service/ec2/api_op_GetPasswordData.go | 23 ++- .../ecr/api_op_DescribeImageScanFindings.go | 23 ++- .../ecr/api_op_GetLifecyclePolicyPreview.go | 23 ++- service/ecs/api_op_DescribeServices.go | 23 ++- service/ecs/api_op_DescribeTasks.go | 44 ++++-- service/eks/api_op_DescribeAddon.go | 44 ++++-- service/eks/api_op_DescribeCluster.go | 45 ++++-- service/eks/api_op_DescribeFargateProfile.go | 46 ++++-- service/eks/api_op_DescribeNodegroup.go | 46 ++++-- .../api_op_DescribeCacheClusters.go | 46 ++++-- .../api_op_DescribeReplicationGroups.go | 46 ++++-- .../api_op_DescribeEnvironments.go | 69 ++++++--- .../api_op_DescribeInstanceHealth.go | 23 ++- .../api_op_DescribeLoadBalancers.go | 69 ++++++--- .../api_op_DescribeTargetHealth.go | 46 ++++-- service/elastictranscoder/api_op_ReadJob.go | 22 ++- service/emr/api_op_DescribeCluster.go | 46 ++++-- service/emr/api_op_DescribeStep.go | 22 ++- service/glacier/api_op_DescribeVault.go | 45 ++++-- service/iam/api_op_GetInstanceProfile.go | 23 ++- service/iam/api_op_GetPolicy.go | 22 ++- service/iam/api_op_GetRole.go | 22 ++- service/iam/api_op_GetUser.go | 22 ++- service/iotsitewise/api_op_DescribeAsset.go | 45 ++++-- .../iotsitewise/api_op_DescribeAssetModel.go | 46 ++++-- service/iotsitewise/api_op_DescribePortal.go | 45 ++++-- service/kinesis/api_op_DescribeStream.go | 45 ++++-- service/lambda/api_op_GetFunction.go | 23 ++- .../lambda/api_op_GetFunctionConfiguration.go | 46 ++++-- service/lexmodelsv2/api_op_DescribeBot.go | 22 ++- .../lexmodelsv2/api_op_DescribeBotAlias.go | 23 ++- .../lexmodelsv2/api_op_DescribeBotLocale.go | 69 ++++++--- .../lexmodelsv2/api_op_DescribeBotVersion.go | 23 ++- service/lexmodelsv2/api_op_DescribeExport.go | 23 ++- service/lexmodelsv2/api_op_DescribeImport.go | 23 ++- .../api_op_DescribeBatchPredictions.go | 23 ++- .../api_op_DescribeDataSources.go | 23 ++- .../api_op_DescribeEvaluations.go | 23 ++- .../api_op_DescribeMLModels.go | 23 ++- service/mediaconnect/api_op_DescribeFlow.go | 66 ++++++--- service/medialive/api_op_DescribeChannel.go | 92 ++++++++---- service/medialive/api_op_DescribeInput.go | 66 ++++++--- service/medialive/api_op_DescribeMultiplex.go | 92 ++++++++---- service/neptune/api_op_DescribeDBInstances.go | 46 ++++-- service/nimble/api_op_GetLaunchProfile.go | 46 ++++-- service/nimble/api_op_GetStreamingImage.go | 46 ++++-- service/nimble/api_op_GetStreamingSession.go | 69 ++++++--- .../api_op_GetStreamingSessionStream.go | 23 ++- service/nimble/api_op_GetStudio.go | 44 ++++-- service/nimble/api_op_GetStudioComponent.go | 46 ++++-- service/opsworks/api_op_DescribeApps.go | 22 ++- .../opsworks/api_op_DescribeDeployments.go | 23 ++- service/opsworks/api_op_DescribeInstances.go | 92 ++++++++---- .../api_op_DescribeNodeAssociationStatus.go | 23 ++- service/proton/api_op_GetEnvironment.go | 23 ++- .../api_op_GetEnvironmentTemplateVersion.go | 23 ++- service/proton/api_op_GetService.go | 92 ++++++++---- service/proton/api_op_GetServiceInstance.go | 23 ++- .../api_op_GetServiceTemplateVersion.go | 23 ++- .../rds/api_op_DescribeDBClusterSnapshots.go | 46 ++++-- service/rds/api_op_DescribeDBInstances.go | 46 ++++-- service/rds/api_op_DescribeDBSnapshots.go | 46 ++++-- .../api_op_DescribeClusterSnapshots.go | 23 ++- service/redshift/api_op_DescribeClusters.go | 69 ++++++--- .../api_op_DescribeProjectVersions.go | 46 ++++-- service/route53/api_op_GetChange.go | 23 ++- .../api_op_DescribeCluster.go | 46 ++++-- .../api_op_DescribeControlPanel.go | 46 ++++-- .../api_op_DescribeRoutingControl.go | 46 ++++-- service/s3/api_op_HeadBucket.go | 45 ++++-- service/s3/api_op_HeadObject.go | 45 ++++-- service/sagemaker/api_op_DescribeEndpoint.go | 46 ++++-- service/sagemaker/api_op_DescribeImage.go | 66 ++++++--- .../sagemaker/api_op_DescribeImageVersion.go | 46 ++++-- .../api_op_DescribeNotebookInstance.go | 69 ++++++--- .../sagemaker/api_op_DescribeProcessingJob.go | 23 ++- .../sagemaker/api_op_DescribeTrainingJob.go | 23 ++- .../sagemaker/api_op_DescribeTransformJob.go | 23 ++- service/schemas/api_op_DescribeCodeBinding.go | 23 ++- ...pi_op_GetIdentityVerificationAttributes.go | 23 ++- service/signer/api_op_DescribeSigningJob.go | 23 ++- service/ssm/api_op_GetCommandInvocation.go | 23 ++- .../ssmincidents/api_op_GetReplicationSet.go | 46 ++++-- 126 files changed, 3456 insertions(+), 1505 deletions(-) create mode 100644 .changelog/9a51012d895e4d9986a4294d67b469a1.json diff --git a/.changelog/9a51012d895e4d9986a4294d67b469a1.json b/.changelog/9a51012d895e4d9986a4294d67b469a1.json new file mode 100644 index 00000000000..c33f8fbedda --- /dev/null +++ b/.changelog/9a51012d895e4d9986a4294d67b469a1.json @@ -0,0 +1,57 @@ +{ + "id": "9a51012d-895e-4d99-86a4-294d67b469a1", + "type": "feature", + "description": "Add WaitForOutput waiter helper method to include output of API operation used to check resource state", + "modules": [ + "service/acm", + "service/acmpca", + "service/amp", + "service/appstream", + "service/autoscaling", + "service/cloudcontrol", + "service/cloudformation", + "service/cloudfront", + "service/cloudwatch", + "service/codedeploy", + "service/codegurureviewer", + "service/databasemigrationservice", + "service/docdb", + "service/dynamodb", + "service/ec2", + "service/ecr", + "service/ecs", + "service/eks", + "service/elasticache", + "service/elasticbeanstalk", + "service/elasticloadbalancing", + "service/elasticloadbalancingv2", + "service/elastictranscoder", + "service/emr", + "service/glacier", + "service/iam", + "service/iotsitewise", + "service/kinesis", + "service/lambda", + "service/lexmodelsv2", + "service/machinelearning", + "service/mediaconnect", + "service/medialive", + "service/neptune", + "service/nimble", + "service/opsworks", + "service/opsworkscm", + "service/proton", + "service/rds", + "service/redshift", + "service/rekognition", + "service/route53", + "service/route53recoverycontrolconfig", + "service/s3", + "service/sagemaker", + "service/schemas", + "service/ses", + "service/signer", + "service/ssm", + "service/ssmincidents" + ] +} \ No newline at end of file diff --git a/service/acm/api_op_DescribeCertificate.go b/service/acm/api_op_DescribeCertificate.go index ce515de56e8..f7b90577cb8 100644 --- a/service/acm/api_op_DescribeCertificate.go +++ b/service/acm/api_op_DescribeCertificate.go @@ -189,8 +189,17 @@ func NewCertificateValidatedWaiter(client DescribeCertificateAPIClient, optFns . // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *CertificateValidatedWaiter) Wait(ctx context.Context, params *DescribeCertificateInput, maxWaitDur time.Duration, optFns ...func(*CertificateValidatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CertificateValidated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CertificateValidatedWaiter) WaitForOutput(ctx context.Context, params *DescribeCertificateInput, maxWaitDur time.Duration, optFns ...func(*CertificateValidatedWaiterOptions)) (*DescribeCertificateOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -203,7 +212,7 @@ func (w *CertificateValidatedWaiter) Wait(ctx context.Context, params *DescribeC } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -231,10 +240,10 @@ func (w *CertificateValidatedWaiter) Wait(ctx context.Context, params *DescribeC retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -247,16 +256,16 @@ func (w *CertificateValidatedWaiter) Wait(ctx context.Context, params *DescribeC attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CertificateValidated waiter") + return nil, fmt.Errorf("exceeded max wait time for CertificateValidated waiter") } func certificateValidatedStateRetryable(ctx context.Context, input *DescribeCertificateInput, output *DescribeCertificateOutput, err error) (bool, error) { diff --git a/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go b/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go index cf7afb5ebce..938c48e2f73 100644 --- a/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go +++ b/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go @@ -209,8 +209,17 @@ func NewAuditReportCreatedWaiter(client DescribeCertificateAuthorityAuditReportA // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *AuditReportCreatedWaiter) Wait(ctx context.Context, params *DescribeCertificateAuthorityAuditReportInput, maxWaitDur time.Duration, optFns ...func(*AuditReportCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AuditReportCreated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *AuditReportCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeCertificateAuthorityAuditReportInput, maxWaitDur time.Duration, optFns ...func(*AuditReportCreatedWaiterOptions)) (*DescribeCertificateAuthorityAuditReportOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -223,7 +232,7 @@ func (w *AuditReportCreatedWaiter) Wait(ctx context.Context, params *DescribeCer } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -251,10 +260,10 @@ func (w *AuditReportCreatedWaiter) Wait(ctx context.Context, params *DescribeCer retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -267,16 +276,16 @@ func (w *AuditReportCreatedWaiter) Wait(ctx context.Context, params *DescribeCer attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AuditReportCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for AuditReportCreated waiter") } func auditReportCreatedStateRetryable(ctx context.Context, input *DescribeCertificateAuthorityAuditReportInput, output *DescribeCertificateAuthorityAuditReportOutput, err error) (bool, error) { diff --git a/service/acmpca/api_op_GetCertificate.go b/service/acmpca/api_op_GetCertificate.go index 3d7ca9ece29..70762f3fa02 100644 --- a/service/acmpca/api_op_GetCertificate.go +++ b/service/acmpca/api_op_GetCertificate.go @@ -208,8 +208,17 @@ func NewCertificateIssuedWaiter(client GetCertificateAPIClient, optFns ...func(* // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *CertificateIssuedWaiter) Wait(ctx context.Context, params *GetCertificateInput, maxWaitDur time.Duration, optFns ...func(*CertificateIssuedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CertificateIssued waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *CertificateIssuedWaiter) WaitForOutput(ctx context.Context, params *GetCertificateInput, maxWaitDur time.Duration, optFns ...func(*CertificateIssuedWaiterOptions)) (*GetCertificateOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -222,7 +231,7 @@ func (w *CertificateIssuedWaiter) Wait(ctx context.Context, params *GetCertifica } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -250,10 +259,10 @@ func (w *CertificateIssuedWaiter) Wait(ctx context.Context, params *GetCertifica retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -266,16 +275,16 @@ func (w *CertificateIssuedWaiter) Wait(ctx context.Context, params *GetCertifica attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CertificateIssued waiter") + return nil, fmt.Errorf("exceeded max wait time for CertificateIssued waiter") } func certificateIssuedStateRetryable(ctx context.Context, input *GetCertificateInput, output *GetCertificateOutput, err error) (bool, error) { diff --git a/service/acmpca/api_op_GetCertificateAuthorityCsr.go b/service/acmpca/api_op_GetCertificateAuthorityCsr.go index 5a78b1ca703..5cfef7f229c 100644 --- a/service/acmpca/api_op_GetCertificateAuthorityCsr.go +++ b/service/acmpca/api_op_GetCertificateAuthorityCsr.go @@ -200,8 +200,17 @@ func NewCertificateAuthorityCSRCreatedWaiter(client GetCertificateAuthorityCsrAP // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *CertificateAuthorityCSRCreatedWaiter) Wait(ctx context.Context, params *GetCertificateAuthorityCsrInput, maxWaitDur time.Duration, optFns ...func(*CertificateAuthorityCSRCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CertificateAuthorityCSRCreated +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *CertificateAuthorityCSRCreatedWaiter) WaitForOutput(ctx context.Context, params *GetCertificateAuthorityCsrInput, maxWaitDur time.Duration, optFns ...func(*CertificateAuthorityCSRCreatedWaiterOptions)) (*GetCertificateAuthorityCsrOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -214,7 +223,7 @@ func (w *CertificateAuthorityCSRCreatedWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -242,10 +251,10 @@ func (w *CertificateAuthorityCSRCreatedWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -258,16 +267,16 @@ func (w *CertificateAuthorityCSRCreatedWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CertificateAuthorityCSRCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for CertificateAuthorityCSRCreated waiter") } func certificateAuthorityCSRCreatedStateRetryable(ctx context.Context, input *GetCertificateAuthorityCsrInput, output *GetCertificateAuthorityCsrOutput, err error) (bool, error) { diff --git a/service/amp/api_op_DescribeWorkspace.go b/service/amp/api_op_DescribeWorkspace.go index 3fd10e32b7a..3d248b6942e 100644 --- a/service/amp/api_op_DescribeWorkspace.go +++ b/service/amp/api_op_DescribeWorkspace.go @@ -188,8 +188,17 @@ func NewWorkspaceActiveWaiter(client DescribeWorkspaceAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *WorkspaceActiveWaiter) Wait(ctx context.Context, params *DescribeWorkspaceInput, maxWaitDur time.Duration, optFns ...func(*WorkspaceActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for WorkspaceActive waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *WorkspaceActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeWorkspaceInput, maxWaitDur time.Duration, optFns ...func(*WorkspaceActiveWaiterOptions)) (*DescribeWorkspaceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -202,7 +211,7 @@ func (w *WorkspaceActiveWaiter) Wait(ctx context.Context, params *DescribeWorksp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -230,10 +239,10 @@ func (w *WorkspaceActiveWaiter) Wait(ctx context.Context, params *DescribeWorksp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -246,16 +255,16 @@ func (w *WorkspaceActiveWaiter) Wait(ctx context.Context, params *DescribeWorksp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for WorkspaceActive waiter") + return nil, fmt.Errorf("exceeded max wait time for WorkspaceActive waiter") } func workspaceActiveStateRetryable(ctx context.Context, input *DescribeWorkspaceInput, output *DescribeWorkspaceOutput, err error) (bool, error) { @@ -373,8 +382,17 @@ func NewWorkspaceDeletedWaiter(client DescribeWorkspaceAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *WorkspaceDeletedWaiter) Wait(ctx context.Context, params *DescribeWorkspaceInput, maxWaitDur time.Duration, optFns ...func(*WorkspaceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for WorkspaceDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *WorkspaceDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeWorkspaceInput, maxWaitDur time.Duration, optFns ...func(*WorkspaceDeletedWaiterOptions)) (*DescribeWorkspaceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -387,7 +405,7 @@ func (w *WorkspaceDeletedWaiter) Wait(ctx context.Context, params *DescribeWorks } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -415,10 +433,10 @@ func (w *WorkspaceDeletedWaiter) Wait(ctx context.Context, params *DescribeWorks retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -431,16 +449,16 @@ func (w *WorkspaceDeletedWaiter) Wait(ctx context.Context, params *DescribeWorks attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for WorkspaceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for WorkspaceDeleted waiter") } func workspaceDeletedStateRetryable(ctx context.Context, input *DescribeWorkspaceInput, output *DescribeWorkspaceOutput, err error) (bool, error) { diff --git a/service/appstream/api_op_DescribeFleets.go b/service/appstream/api_op_DescribeFleets.go index 995915b6919..037f893b494 100644 --- a/service/appstream/api_op_DescribeFleets.go +++ b/service/appstream/api_op_DescribeFleets.go @@ -187,8 +187,16 @@ func NewFleetStartedWaiter(client DescribeFleetsAPIClient, optFns ...func(*Fleet // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FleetStartedWaiter) Wait(ctx context.Context, params *DescribeFleetsInput, maxWaitDur time.Duration, optFns ...func(*FleetStartedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FleetStarted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *FleetStartedWaiter) WaitForOutput(ctx context.Context, params *DescribeFleetsInput, maxWaitDur time.Duration, optFns ...func(*FleetStartedWaiterOptions)) (*DescribeFleetsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -201,7 +209,7 @@ func (w *FleetStartedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -229,10 +237,10 @@ func (w *FleetStartedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -245,16 +253,16 @@ func (w *FleetStartedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FleetStarted waiter") + return nil, fmt.Errorf("exceeded max wait time for FleetStarted waiter") } func fleetStartedStateRetryable(ctx context.Context, input *DescribeFleetsInput, output *DescribeFleetsOutput, err error) (bool, error) { @@ -401,8 +409,16 @@ func NewFleetStoppedWaiter(client DescribeFleetsAPIClient, optFns ...func(*Fleet // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FleetStoppedWaiter) Wait(ctx context.Context, params *DescribeFleetsInput, maxWaitDur time.Duration, optFns ...func(*FleetStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FleetStopped waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *FleetStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeFleetsInput, maxWaitDur time.Duration, optFns ...func(*FleetStoppedWaiterOptions)) (*DescribeFleetsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -415,7 +431,7 @@ func (w *FleetStoppedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -443,10 +459,10 @@ func (w *FleetStoppedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -459,16 +475,16 @@ func (w *FleetStoppedWaiter) Wait(ctx context.Context, params *DescribeFleetsInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FleetStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for FleetStopped waiter") } func fleetStoppedStateRetryable(ctx context.Context, input *DescribeFleetsInput, output *DescribeFleetsOutput, err error) (bool, error) { diff --git a/service/autoscaling/api_op_DescribeAutoScalingGroups.go b/service/autoscaling/api_op_DescribeAutoScalingGroups.go index d411ed9d612..b1ac6526a84 100644 --- a/service/autoscaling/api_op_DescribeAutoScalingGroups.go +++ b/service/autoscaling/api_op_DescribeAutoScalingGroups.go @@ -288,8 +288,16 @@ func NewGroupExistsWaiter(client DescribeAutoScalingGroupsAPIClient, optFns ...f // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *GroupExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for GroupExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *GroupExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupExistsWaiterOptions)) (*DescribeAutoScalingGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -302,7 +310,7 @@ func (w *GroupExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalin } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -330,10 +338,10 @@ func (w *GroupExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalin retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -346,16 +354,16 @@ func (w *GroupExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalin attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for GroupExists waiter") + return nil, fmt.Errorf("exceeded max wait time for GroupExists waiter") } func groupExistsStateRetryable(ctx context.Context, input *DescribeAutoScalingGroupsInput, output *DescribeAutoScalingGroupsOutput, err error) (bool, error) { @@ -464,8 +472,17 @@ func NewGroupInServiceWaiter(client DescribeAutoScalingGroupsAPIClient, optFns . // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *GroupInServiceWaiter) Wait(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupInServiceWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for GroupInService waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *GroupInServiceWaiter) WaitForOutput(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupInServiceWaiterOptions)) (*DescribeAutoScalingGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -478,7 +495,7 @@ func (w *GroupInServiceWaiter) Wait(ctx context.Context, params *DescribeAutoSca } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -506,10 +523,10 @@ func (w *GroupInServiceWaiter) Wait(ctx context.Context, params *DescribeAutoSca retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -522,16 +539,16 @@ func (w *GroupInServiceWaiter) Wait(ctx context.Context, params *DescribeAutoSca attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for GroupInService waiter") + return nil, fmt.Errorf("exceeded max wait time for GroupInService waiter") } func groupInServiceStateRetryable(ctx context.Context, input *DescribeAutoScalingGroupsInput, output *DescribeAutoScalingGroupsOutput, err error) (bool, error) { @@ -640,8 +657,17 @@ func NewGroupNotExistsWaiter(client DescribeAutoScalingGroupsAPIClient, optFns . // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *GroupNotExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for GroupNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *GroupNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupNotExistsWaiterOptions)) (*DescribeAutoScalingGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -654,7 +680,7 @@ func (w *GroupNotExistsWaiter) Wait(ctx context.Context, params *DescribeAutoSca } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -682,10 +708,10 @@ func (w *GroupNotExistsWaiter) Wait(ctx context.Context, params *DescribeAutoSca retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -698,16 +724,16 @@ func (w *GroupNotExistsWaiter) Wait(ctx context.Context, params *DescribeAutoSca attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for GroupNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for GroupNotExists waiter") } func groupNotExistsStateRetryable(ctx context.Context, input *DescribeAutoScalingGroupsInput, output *DescribeAutoScalingGroupsOutput, err error) (bool, error) { diff --git a/service/cloudcontrol/api_op_GetResourceRequestStatus.go b/service/cloudcontrol/api_op_GetResourceRequestStatus.go index 7de11ecc5bf..2d8760884a5 100644 --- a/service/cloudcontrol/api_op_GetResourceRequestStatus.go +++ b/service/cloudcontrol/api_op_GetResourceRequestStatus.go @@ -189,8 +189,17 @@ func NewResourceRequestSuccessWaiter(client GetResourceRequestStatusAPIClient, o // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ResourceRequestSuccessWaiter) Wait(ctx context.Context, params *GetResourceRequestStatusInput, maxWaitDur time.Duration, optFns ...func(*ResourceRequestSuccessWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ResourceRequestSuccess waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ResourceRequestSuccessWaiter) WaitForOutput(ctx context.Context, params *GetResourceRequestStatusInput, maxWaitDur time.Duration, optFns ...func(*ResourceRequestSuccessWaiterOptions)) (*GetResourceRequestStatusOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -203,7 +212,7 @@ func (w *ResourceRequestSuccessWaiter) Wait(ctx context.Context, params *GetReso } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -231,10 +240,10 @@ func (w *ResourceRequestSuccessWaiter) Wait(ctx context.Context, params *GetReso retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -247,16 +256,16 @@ func (w *ResourceRequestSuccessWaiter) Wait(ctx context.Context, params *GetReso attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ResourceRequestSuccess waiter") + return nil, fmt.Errorf("exceeded max wait time for ResourceRequestSuccess waiter") } func resourceRequestSuccessStateRetryable(ctx context.Context, input *GetResourceRequestStatusInput, output *GetResourceRequestStatusOutput, err error) (bool, error) { diff --git a/service/cloudformation/api_op_DescribeChangeSet.go b/service/cloudformation/api_op_DescribeChangeSet.go index 694374e9fa9..4fb202b007c 100644 --- a/service/cloudformation/api_op_DescribeChangeSet.go +++ b/service/cloudformation/api_op_DescribeChangeSet.go @@ -271,8 +271,17 @@ func NewChangeSetCreateCompleteWaiter(client DescribeChangeSetAPIClient, optFns // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ChangeSetCreateCompleteWaiter) Wait(ctx context.Context, params *DescribeChangeSetInput, maxWaitDur time.Duration, optFns ...func(*ChangeSetCreateCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ChangeSetCreateComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ChangeSetCreateCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeChangeSetInput, maxWaitDur time.Duration, optFns ...func(*ChangeSetCreateCompleteWaiterOptions)) (*DescribeChangeSetOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -285,7 +294,7 @@ func (w *ChangeSetCreateCompleteWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -313,10 +322,10 @@ func (w *ChangeSetCreateCompleteWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -329,16 +338,16 @@ func (w *ChangeSetCreateCompleteWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ChangeSetCreateComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for ChangeSetCreateComplete waiter") } func changeSetCreateCompleteStateRetryable(ctx context.Context, input *DescribeChangeSetInput, output *DescribeChangeSetOutput, err error) (bool, error) { diff --git a/service/cloudformation/api_op_DescribeStacks.go b/service/cloudformation/api_op_DescribeStacks.go index 9f950e2cf41..fbb7c3997f0 100644 --- a/service/cloudformation/api_op_DescribeStacks.go +++ b/service/cloudformation/api_op_DescribeStacks.go @@ -267,8 +267,17 @@ func NewStackCreateCompleteWaiter(client DescribeStacksAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *StackCreateCompleteWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackCreateCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackCreateComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StackCreateCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackCreateCompleteWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -281,7 +290,7 @@ func (w *StackCreateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -309,10 +318,10 @@ func (w *StackCreateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -325,16 +334,16 @@ func (w *StackCreateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackCreateComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StackCreateComplete waiter") } func stackCreateCompleteStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { @@ -566,8 +575,17 @@ func NewStackDeleteCompleteWaiter(client DescribeStacksAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *StackDeleteCompleteWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackDeleteCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackDeleteComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StackDeleteCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackDeleteCompleteWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -580,7 +598,7 @@ func (w *StackDeleteCompleteWaiter) Wait(ctx context.Context, params *DescribeSt } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -608,10 +626,10 @@ func (w *StackDeleteCompleteWaiter) Wait(ctx context.Context, params *DescribeSt retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -624,16 +642,16 @@ func (w *StackDeleteCompleteWaiter) Wait(ctx context.Context, params *DescribeSt attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackDeleteComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StackDeleteComplete waiter") } func stackDeleteCompleteStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { @@ -888,8 +906,16 @@ func NewStackExistsWaiter(client DescribeStacksAPIClient, optFns ...func(*StackE // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StackExistsWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *StackExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackExistsWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -902,7 +928,7 @@ func (w *StackExistsWaiter) Wait(ctx context.Context, params *DescribeStacksInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -930,10 +956,10 @@ func (w *StackExistsWaiter) Wait(ctx context.Context, params *DescribeStacksInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -946,16 +972,16 @@ func (w *StackExistsWaiter) Wait(ctx context.Context, params *DescribeStacksInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackExists waiter") + return nil, fmt.Errorf("exceeded max wait time for StackExists waiter") } func stackExistsStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { @@ -1039,8 +1065,17 @@ func NewStackImportCompleteWaiter(client DescribeStacksAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *StackImportCompleteWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackImportCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackImportComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StackImportCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackImportCompleteWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1053,7 +1088,7 @@ func (w *StackImportCompleteWaiter) Wait(ctx context.Context, params *DescribeSt } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1081,10 +1116,10 @@ func (w *StackImportCompleteWaiter) Wait(ctx context.Context, params *DescribeSt retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1097,16 +1132,16 @@ func (w *StackImportCompleteWaiter) Wait(ctx context.Context, params *DescribeSt attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackImportComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StackImportComplete waiter") } func stackImportCompleteStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { @@ -1338,8 +1373,17 @@ func NewStackRollbackCompleteWaiter(client DescribeStacksAPIClient, optFns ...fu // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *StackRollbackCompleteWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackRollbackCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackRollbackComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StackRollbackCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackRollbackCompleteWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1352,7 +1396,7 @@ func (w *StackRollbackCompleteWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1380,10 +1424,10 @@ func (w *StackRollbackCompleteWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1396,16 +1440,16 @@ func (w *StackRollbackCompleteWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackRollbackComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StackRollbackComplete waiter") } func stackRollbackCompleteStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { @@ -1589,8 +1633,17 @@ func NewStackUpdateCompleteWaiter(client DescribeStacksAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *StackUpdateCompleteWaiter) Wait(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackUpdateCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StackUpdateComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StackUpdateCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStacksInput, maxWaitDur time.Duration, optFns ...func(*StackUpdateCompleteWaiterOptions)) (*DescribeStacksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1603,7 +1656,7 @@ func (w *StackUpdateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1631,10 +1684,10 @@ func (w *StackUpdateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1647,16 +1700,16 @@ func (w *StackUpdateCompleteWaiter) Wait(ctx context.Context, params *DescribeSt attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StackUpdateComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StackUpdateComplete waiter") } func stackUpdateCompleteStateRetryable(ctx context.Context, input *DescribeStacksInput, output *DescribeStacksOutput, err error) (bool, error) { diff --git a/service/cloudformation/api_op_DescribeTypeRegistration.go b/service/cloudformation/api_op_DescribeTypeRegistration.go index dbf761b4f78..63d3b6a3f31 100644 --- a/service/cloudformation/api_op_DescribeTypeRegistration.go +++ b/service/cloudformation/api_op_DescribeTypeRegistration.go @@ -204,8 +204,17 @@ func NewTypeRegistrationCompleteWaiter(client DescribeTypeRegistrationAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *TypeRegistrationCompleteWaiter) Wait(ctx context.Context, params *DescribeTypeRegistrationInput, maxWaitDur time.Duration, optFns ...func(*TypeRegistrationCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TypeRegistrationComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *TypeRegistrationCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeTypeRegistrationInput, maxWaitDur time.Duration, optFns ...func(*TypeRegistrationCompleteWaiterOptions)) (*DescribeTypeRegistrationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -218,7 +227,7 @@ func (w *TypeRegistrationCompleteWaiter) Wait(ctx context.Context, params *Descr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -246,10 +255,10 @@ func (w *TypeRegistrationCompleteWaiter) Wait(ctx context.Context, params *Descr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -262,16 +271,16 @@ func (w *TypeRegistrationCompleteWaiter) Wait(ctx context.Context, params *Descr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TypeRegistrationComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for TypeRegistrationComplete waiter") } func typeRegistrationCompleteStateRetryable(ctx context.Context, input *DescribeTypeRegistrationInput, output *DescribeTypeRegistrationOutput, err error) (bool, error) { diff --git a/service/cloudfront/api_op_GetDistribution.go b/service/cloudfront/api_op_GetDistribution.go index e0b019fbbef..711e9535e17 100644 --- a/service/cloudfront/api_op_GetDistribution.go +++ b/service/cloudfront/api_op_GetDistribution.go @@ -191,8 +191,17 @@ func NewDistributionDeployedWaiter(client GetDistributionAPIClient, optFns ...fu // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *DistributionDeployedWaiter) Wait(ctx context.Context, params *GetDistributionInput, maxWaitDur time.Duration, optFns ...func(*DistributionDeployedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DistributionDeployed waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DistributionDeployedWaiter) WaitForOutput(ctx context.Context, params *GetDistributionInput, maxWaitDur time.Duration, optFns ...func(*DistributionDeployedWaiterOptions)) (*GetDistributionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -205,7 +214,7 @@ func (w *DistributionDeployedWaiter) Wait(ctx context.Context, params *GetDistri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -233,10 +242,10 @@ func (w *DistributionDeployedWaiter) Wait(ctx context.Context, params *GetDistri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -249,16 +258,16 @@ func (w *DistributionDeployedWaiter) Wait(ctx context.Context, params *GetDistri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DistributionDeployed waiter") + return nil, fmt.Errorf("exceeded max wait time for DistributionDeployed waiter") } func distributionDeployedStateRetryable(ctx context.Context, input *GetDistributionInput, output *GetDistributionOutput, err error) (bool, error) { diff --git a/service/cloudfront/api_op_GetInvalidation.go b/service/cloudfront/api_op_GetInvalidation.go index 2906e50336b..7dbf147eb13 100644 --- a/service/cloudfront/api_op_GetInvalidation.go +++ b/service/cloudfront/api_op_GetInvalidation.go @@ -193,8 +193,17 @@ func NewInvalidationCompletedWaiter(client GetInvalidationAPIClient, optFns ...f // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *InvalidationCompletedWaiter) Wait(ctx context.Context, params *GetInvalidationInput, maxWaitDur time.Duration, optFns ...func(*InvalidationCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InvalidationCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *InvalidationCompletedWaiter) WaitForOutput(ctx context.Context, params *GetInvalidationInput, maxWaitDur time.Duration, optFns ...func(*InvalidationCompletedWaiterOptions)) (*GetInvalidationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -207,7 +216,7 @@ func (w *InvalidationCompletedWaiter) Wait(ctx context.Context, params *GetInval } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -235,10 +244,10 @@ func (w *InvalidationCompletedWaiter) Wait(ctx context.Context, params *GetInval retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -251,16 +260,16 @@ func (w *InvalidationCompletedWaiter) Wait(ctx context.Context, params *GetInval attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InvalidationCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for InvalidationCompleted waiter") } func invalidationCompletedStateRetryable(ctx context.Context, input *GetInvalidationInput, output *GetInvalidationOutput, err error) (bool, error) { diff --git a/service/cloudfront/api_op_GetStreamingDistribution.go b/service/cloudfront/api_op_GetStreamingDistribution.go index d5822b5aea1..50653a7302a 100644 --- a/service/cloudfront/api_op_GetStreamingDistribution.go +++ b/service/cloudfront/api_op_GetStreamingDistribution.go @@ -195,8 +195,17 @@ func NewStreamingDistributionDeployedWaiter(client GetStreamingDistributionAPICl // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *StreamingDistributionDeployedWaiter) Wait(ctx context.Context, params *GetStreamingDistributionInput, maxWaitDur time.Duration, optFns ...func(*StreamingDistributionDeployedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingDistributionDeployed waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *StreamingDistributionDeployedWaiter) WaitForOutput(ctx context.Context, params *GetStreamingDistributionInput, maxWaitDur time.Duration, optFns ...func(*StreamingDistributionDeployedWaiterOptions)) (*GetStreamingDistributionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -209,7 +218,7 @@ func (w *StreamingDistributionDeployedWaiter) Wait(ctx context.Context, params * } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -237,10 +246,10 @@ func (w *StreamingDistributionDeployedWaiter) Wait(ctx context.Context, params * retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -253,16 +262,16 @@ func (w *StreamingDistributionDeployedWaiter) Wait(ctx context.Context, params * attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingDistributionDeployed waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingDistributionDeployed waiter") } func streamingDistributionDeployedStateRetryable(ctx context.Context, input *GetStreamingDistributionInput, output *GetStreamingDistributionOutput, err error) (bool, error) { diff --git a/service/cloudwatch/api_op_DescribeAlarms.go b/service/cloudwatch/api_op_DescribeAlarms.go index 027d18f2fda..169e79d7ae5 100644 --- a/service/cloudwatch/api_op_DescribeAlarms.go +++ b/service/cloudwatch/api_op_DescribeAlarms.go @@ -317,8 +317,16 @@ func NewAlarmExistsWaiter(client DescribeAlarmsAPIClient, optFns ...func(*AlarmE // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AlarmExistsWaiter) Wait(ctx context.Context, params *DescribeAlarmsInput, maxWaitDur time.Duration, optFns ...func(*AlarmExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AlarmExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *AlarmExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAlarmsInput, maxWaitDur time.Duration, optFns ...func(*AlarmExistsWaiterOptions)) (*DescribeAlarmsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -331,7 +339,7 @@ func (w *AlarmExistsWaiter) Wait(ctx context.Context, params *DescribeAlarmsInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -359,10 +367,10 @@ func (w *AlarmExistsWaiter) Wait(ctx context.Context, params *DescribeAlarmsInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -375,16 +383,16 @@ func (w *AlarmExistsWaiter) Wait(ctx context.Context, params *DescribeAlarmsInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AlarmExists waiter") + return nil, fmt.Errorf("exceeded max wait time for AlarmExists waiter") } func alarmExistsStateRetryable(ctx context.Context, input *DescribeAlarmsInput, output *DescribeAlarmsOutput, err error) (bool, error) { @@ -473,8 +481,17 @@ func NewCompositeAlarmExistsWaiter(client DescribeAlarmsAPIClient, optFns ...fun // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *CompositeAlarmExistsWaiter) Wait(ctx context.Context, params *DescribeAlarmsInput, maxWaitDur time.Duration, optFns ...func(*CompositeAlarmExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CompositeAlarmExists waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CompositeAlarmExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAlarmsInput, maxWaitDur time.Duration, optFns ...func(*CompositeAlarmExistsWaiterOptions)) (*DescribeAlarmsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -487,7 +504,7 @@ func (w *CompositeAlarmExistsWaiter) Wait(ctx context.Context, params *DescribeA } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -515,10 +532,10 @@ func (w *CompositeAlarmExistsWaiter) Wait(ctx context.Context, params *DescribeA retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -531,16 +548,16 @@ func (w *CompositeAlarmExistsWaiter) Wait(ctx context.Context, params *DescribeA attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CompositeAlarmExists waiter") + return nil, fmt.Errorf("exceeded max wait time for CompositeAlarmExists waiter") } func compositeAlarmExistsStateRetryable(ctx context.Context, input *DescribeAlarmsInput, output *DescribeAlarmsOutput, err error) (bool, error) { diff --git a/service/codedeploy/api_op_GetDeployment.go b/service/codedeploy/api_op_GetDeployment.go index 85fc5396f52..c8f59074ea2 100644 --- a/service/codedeploy/api_op_GetDeployment.go +++ b/service/codedeploy/api_op_GetDeployment.go @@ -188,8 +188,17 @@ func NewDeploymentSuccessfulWaiter(client GetDeploymentAPIClient, optFns ...func // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *GetDeploymentInput, maxWaitDur time.Duration, optFns ...func(*DeploymentSuccessfulWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DeploymentSuccessful waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DeploymentSuccessfulWaiter) WaitForOutput(ctx context.Context, params *GetDeploymentInput, maxWaitDur time.Duration, optFns ...func(*DeploymentSuccessfulWaiterOptions)) (*GetDeploymentOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -202,7 +211,7 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *GetDeploy } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -230,10 +239,10 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *GetDeploy retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -246,16 +255,16 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *GetDeploy attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DeploymentSuccessful waiter") + return nil, fmt.Errorf("exceeded max wait time for DeploymentSuccessful waiter") } func deploymentSuccessfulStateRetryable(ctx context.Context, input *GetDeploymentInput, output *GetDeploymentOutput, err error) (bool, error) { diff --git a/service/codegurureviewer/api_op_DescribeCodeReview.go b/service/codegurureviewer/api_op_DescribeCodeReview.go index a668260ca95..63c24e21780 100644 --- a/service/codegurureviewer/api_op_DescribeCodeReview.go +++ b/service/codegurureviewer/api_op_DescribeCodeReview.go @@ -186,8 +186,17 @@ func NewCodeReviewCompletedWaiter(client DescribeCodeReviewAPIClient, optFns ... // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *CodeReviewCompletedWaiter) Wait(ctx context.Context, params *DescribeCodeReviewInput, maxWaitDur time.Duration, optFns ...func(*CodeReviewCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CodeReviewCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CodeReviewCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeCodeReviewInput, maxWaitDur time.Duration, optFns ...func(*CodeReviewCompletedWaiterOptions)) (*DescribeCodeReviewOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -200,7 +209,7 @@ func (w *CodeReviewCompletedWaiter) Wait(ctx context.Context, params *DescribeCo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -228,10 +237,10 @@ func (w *CodeReviewCompletedWaiter) Wait(ctx context.Context, params *DescribeCo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -244,16 +253,16 @@ func (w *CodeReviewCompletedWaiter) Wait(ctx context.Context, params *DescribeCo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CodeReviewCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for CodeReviewCompleted waiter") } func codeReviewCompletedStateRetryable(ctx context.Context, input *DescribeCodeReviewInput, output *DescribeCodeReviewOutput, err error) (bool, error) { diff --git a/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go b/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go index 32850bd2366..9ee29523c2f 100644 --- a/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go +++ b/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go @@ -205,8 +205,17 @@ func NewRepositoryAssociationSucceededWaiter(client DescribeRepositoryAssociatio // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *RepositoryAssociationSucceededWaiter) Wait(ctx context.Context, params *DescribeRepositoryAssociationInput, maxWaitDur time.Duration, optFns ...func(*RepositoryAssociationSucceededWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for RepositoryAssociationSucceeded +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *RepositoryAssociationSucceededWaiter) WaitForOutput(ctx context.Context, params *DescribeRepositoryAssociationInput, maxWaitDur time.Duration, optFns ...func(*RepositoryAssociationSucceededWaiterOptions)) (*DescribeRepositoryAssociationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -219,7 +228,7 @@ func (w *RepositoryAssociationSucceededWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -247,10 +256,10 @@ func (w *RepositoryAssociationSucceededWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -263,16 +272,16 @@ func (w *RepositoryAssociationSucceededWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for RepositoryAssociationSucceeded waiter") + return nil, fmt.Errorf("exceeded max wait time for RepositoryAssociationSucceeded waiter") } func repositoryAssociationSucceededStateRetryable(ctx context.Context, input *DescribeRepositoryAssociationInput, output *DescribeRepositoryAssociationOutput, err error) (bool, error) { diff --git a/service/databasemigrationservice/api_op_DescribeConnections.go b/service/databasemigrationservice/api_op_DescribeConnections.go index 46fef66ac06..ecdbe576f4c 100644 --- a/service/databasemigrationservice/api_op_DescribeConnections.go +++ b/service/databasemigrationservice/api_op_DescribeConnections.go @@ -285,8 +285,17 @@ func NewTestConnectionSucceedsWaiter(client DescribeConnectionsAPIClient, optFns // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *TestConnectionSucceedsWaiter) Wait(ctx context.Context, params *DescribeConnectionsInput, maxWaitDur time.Duration, optFns ...func(*TestConnectionSucceedsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TestConnectionSucceeds waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *TestConnectionSucceedsWaiter) WaitForOutput(ctx context.Context, params *DescribeConnectionsInput, maxWaitDur time.Duration, optFns ...func(*TestConnectionSucceedsWaiterOptions)) (*DescribeConnectionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -299,7 +308,7 @@ func (w *TestConnectionSucceedsWaiter) Wait(ctx context.Context, params *Describ } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -327,10 +336,10 @@ func (w *TestConnectionSucceedsWaiter) Wait(ctx context.Context, params *Describ retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -343,16 +352,16 @@ func (w *TestConnectionSucceedsWaiter) Wait(ctx context.Context, params *Describ attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TestConnectionSucceeds waiter") + return nil, fmt.Errorf("exceeded max wait time for TestConnectionSucceeds waiter") } func testConnectionSucceedsStateRetryable(ctx context.Context, input *DescribeConnectionsInput, output *DescribeConnectionsOutput, err error) (bool, error) { diff --git a/service/databasemigrationservice/api_op_DescribeEndpoints.go b/service/databasemigrationservice/api_op_DescribeEndpoints.go index 5de03a0e0ca..1d122658c94 100644 --- a/service/databasemigrationservice/api_op_DescribeEndpoints.go +++ b/service/databasemigrationservice/api_op_DescribeEndpoints.go @@ -282,8 +282,17 @@ func NewEndpointDeletedWaiter(client DescribeEndpointsAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpointsInput, maxWaitDur time.Duration, optFns ...func(*EndpointDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EndpointDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *EndpointDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeEndpointsInput, maxWaitDur time.Duration, optFns ...func(*EndpointDeletedWaiterOptions)) (*DescribeEndpointsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -296,7 +305,7 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -324,10 +333,10 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -340,16 +349,16 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EndpointDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for EndpointDeleted waiter") } func endpointDeletedStateRetryable(ctx context.Context, input *DescribeEndpointsInput, output *DescribeEndpointsOutput, err error) (bool, error) { diff --git a/service/databasemigrationservice/api_op_DescribeReplicationInstances.go b/service/databasemigrationservice/api_op_DescribeReplicationInstances.go index 4f7f921bee2..78df557d08c 100644 --- a/service/databasemigrationservice/api_op_DescribeReplicationInstances.go +++ b/service/databasemigrationservice/api_op_DescribeReplicationInstances.go @@ -291,8 +291,17 @@ func NewReplicationInstanceAvailableWaiter(client DescribeReplicationInstancesAP // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ReplicationInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeReplicationInstancesInput, maxWaitDur time.Duration, optFns ...func(*ReplicationInstanceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationInstanceAvailable waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *ReplicationInstanceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationInstancesInput, maxWaitDur time.Duration, optFns ...func(*ReplicationInstanceAvailableWaiterOptions)) (*DescribeReplicationInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -305,7 +314,7 @@ func (w *ReplicationInstanceAvailableWaiter) Wait(ctx context.Context, params *D } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -333,10 +342,10 @@ func (w *ReplicationInstanceAvailableWaiter) Wait(ctx context.Context, params *D retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -349,16 +358,16 @@ func (w *ReplicationInstanceAvailableWaiter) Wait(ctx context.Context, params *D attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationInstanceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationInstanceAvailable waiter") } func replicationInstanceAvailableStateRetryable(ctx context.Context, input *DescribeReplicationInstancesInput, output *DescribeReplicationInstancesOutput, err error) (bool, error) { @@ -557,8 +566,17 @@ func NewReplicationInstanceDeletedWaiter(client DescribeReplicationInstancesAPIC // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ReplicationInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeReplicationInstancesInput, maxWaitDur time.Duration, optFns ...func(*ReplicationInstanceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationInstanceDeleted waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *ReplicationInstanceDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationInstancesInput, maxWaitDur time.Duration, optFns ...func(*ReplicationInstanceDeletedWaiterOptions)) (*DescribeReplicationInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -571,7 +589,7 @@ func (w *ReplicationInstanceDeletedWaiter) Wait(ctx context.Context, params *Des } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -599,10 +617,10 @@ func (w *ReplicationInstanceDeletedWaiter) Wait(ctx context.Context, params *Des retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -615,16 +633,16 @@ func (w *ReplicationInstanceDeletedWaiter) Wait(ctx context.Context, params *Des attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationInstanceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationInstanceDeleted waiter") } func replicationInstanceDeletedStateRetryable(ctx context.Context, input *DescribeReplicationInstancesInput, output *DescribeReplicationInstancesOutput, err error) (bool, error) { diff --git a/service/databasemigrationservice/api_op_DescribeReplicationTasks.go b/service/databasemigrationservice/api_op_DescribeReplicationTasks.go index 22cbc356082..6d454a4389b 100644 --- a/service/databasemigrationservice/api_op_DescribeReplicationTasks.go +++ b/service/databasemigrationservice/api_op_DescribeReplicationTasks.go @@ -291,8 +291,17 @@ func NewReplicationTaskDeletedWaiter(client DescribeReplicationTasksAPIClient, o // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ReplicationTaskDeletedWaiter) Wait(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationTaskDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationTaskDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskDeletedWaiterOptions)) (*DescribeReplicationTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -305,7 +314,7 @@ func (w *ReplicationTaskDeletedWaiter) Wait(ctx context.Context, params *Describ } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -333,10 +342,10 @@ func (w *ReplicationTaskDeletedWaiter) Wait(ctx context.Context, params *Describ retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -349,16 +358,16 @@ func (w *ReplicationTaskDeletedWaiter) Wait(ctx context.Context, params *Describ attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationTaskDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationTaskDeleted waiter") } func replicationTaskDeletedStateRetryable(ctx context.Context, input *DescribeReplicationTasksInput, output *DescribeReplicationTasksOutput, err error) (bool, error) { @@ -553,8 +562,17 @@ func NewReplicationTaskReadyWaiter(client DescribeReplicationTasksAPIClient, opt // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ReplicationTaskReadyWaiter) Wait(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationTaskReady waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationTaskReadyWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskReadyWaiterOptions)) (*DescribeReplicationTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -567,7 +585,7 @@ func (w *ReplicationTaskReadyWaiter) Wait(ctx context.Context, params *DescribeR } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -595,10 +613,10 @@ func (w *ReplicationTaskReadyWaiter) Wait(ctx context.Context, params *DescribeR retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -611,16 +629,16 @@ func (w *ReplicationTaskReadyWaiter) Wait(ctx context.Context, params *DescribeR attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationTaskReady waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationTaskReady waiter") } func replicationTaskReadyStateRetryable(ctx context.Context, input *DescribeReplicationTasksInput, output *DescribeReplicationTasksOutput, err error) (bool, error) { @@ -912,8 +930,17 @@ func NewReplicationTaskRunningWaiter(client DescribeReplicationTasksAPIClient, o // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ReplicationTaskRunningWaiter) Wait(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationTaskRunning waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationTaskRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskRunningWaiterOptions)) (*DescribeReplicationTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -926,7 +953,7 @@ func (w *ReplicationTaskRunningWaiter) Wait(ctx context.Context, params *Describ } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -954,10 +981,10 @@ func (w *ReplicationTaskRunningWaiter) Wait(ctx context.Context, params *Describ retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -970,16 +997,16 @@ func (w *ReplicationTaskRunningWaiter) Wait(ctx context.Context, params *Describ attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationTaskRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationTaskRunning waiter") } func replicationTaskRunningStateRetryable(ctx context.Context, input *DescribeReplicationTasksInput, output *DescribeReplicationTasksOutput, err error) (bool, error) { @@ -1271,8 +1298,17 @@ func NewReplicationTaskStoppedWaiter(client DescribeReplicationTasksAPIClient, o // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ReplicationTaskStoppedWaiter) Wait(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationTaskStopped waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationTaskStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationTasksInput, maxWaitDur time.Duration, optFns ...func(*ReplicationTaskStoppedWaiterOptions)) (*DescribeReplicationTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1285,7 +1321,7 @@ func (w *ReplicationTaskStoppedWaiter) Wait(ctx context.Context, params *Describ } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1313,10 +1349,10 @@ func (w *ReplicationTaskStoppedWaiter) Wait(ctx context.Context, params *Describ retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1329,16 +1365,16 @@ func (w *ReplicationTaskStoppedWaiter) Wait(ctx context.Context, params *Describ attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationTaskStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationTaskStopped waiter") } func replicationTaskStoppedStateRetryable(ctx context.Context, input *DescribeReplicationTasksInput, output *DescribeReplicationTasksOutput, err error) (bool, error) { diff --git a/service/docdb/api_op_DescribeDBInstances.go b/service/docdb/api_op_DescribeDBInstances.go index b881670a8ce..286d5ad4c71 100644 --- a/service/docdb/api_op_DescribeDBInstances.go +++ b/service/docdb/api_op_DescribeDBInstances.go @@ -301,8 +301,17 @@ func NewDBInstanceAvailableWaiter(client DescribeDBInstancesAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBInstanceAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBInstanceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) (*DescribeDBInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -315,7 +324,7 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -343,10 +352,10 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -359,16 +368,16 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") } func dBInstanceAvailableStateRetryable(ctx context.Context, input *DescribeDBInstancesInput, output *DescribeDBInstancesOutput, err error) (bool, error) { diff --git a/service/dynamodb/api_op_DescribeTable.go b/service/dynamodb/api_op_DescribeTable.go index e87330d28d7..f4176480e53 100644 --- a/service/dynamodb/api_op_DescribeTable.go +++ b/service/dynamodb/api_op_DescribeTable.go @@ -241,8 +241,16 @@ func NewTableExistsWaiter(client DescribeTableAPIClient, optFns ...func(*TableEx // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *TableExistsWaiter) Wait(ctx context.Context, params *DescribeTableInput, maxWaitDur time.Duration, optFns ...func(*TableExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TableExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *TableExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeTableInput, maxWaitDur time.Duration, optFns ...func(*TableExistsWaiterOptions)) (*DescribeTableOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -255,7 +263,7 @@ func (w *TableExistsWaiter) Wait(ctx context.Context, params *DescribeTableInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -283,10 +291,10 @@ func (w *TableExistsWaiter) Wait(ctx context.Context, params *DescribeTableInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -299,16 +307,16 @@ func (w *TableExistsWaiter) Wait(ctx context.Context, params *DescribeTableInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TableExists waiter") + return nil, fmt.Errorf("exceeded max wait time for TableExists waiter") } func tableExistsStateRetryable(ctx context.Context, input *DescribeTableInput, output *DescribeTableOutput, err error) (bool, error) { @@ -399,8 +407,17 @@ func NewTableNotExistsWaiter(client DescribeTableAPIClient, optFns ...func(*Tabl // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *TableNotExistsWaiter) Wait(ctx context.Context, params *DescribeTableInput, maxWaitDur time.Duration, optFns ...func(*TableNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TableNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *TableNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeTableInput, maxWaitDur time.Duration, optFns ...func(*TableNotExistsWaiterOptions)) (*DescribeTableOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -413,7 +430,7 @@ func (w *TableNotExistsWaiter) Wait(ctx context.Context, params *DescribeTableIn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -441,10 +458,10 @@ func (w *TableNotExistsWaiter) Wait(ctx context.Context, params *DescribeTableIn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -457,16 +474,16 @@ func (w *TableNotExistsWaiter) Wait(ctx context.Context, params *DescribeTableIn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TableNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for TableNotExists waiter") } func tableNotExistsStateRetryable(ctx context.Context, input *DescribeTableInput, output *DescribeTableOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeBundleTasks.go b/service/ec2/api_op_DescribeBundleTasks.go index c5a4927af9f..7c6f9d7eb6c 100644 --- a/service/ec2/api_op_DescribeBundleTasks.go +++ b/service/ec2/api_op_DescribeBundleTasks.go @@ -219,8 +219,17 @@ func NewBundleTaskCompleteWaiter(client DescribeBundleTasksAPIClient, optFns ... // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BundleTaskCompleteWaiter) Wait(ctx context.Context, params *DescribeBundleTasksInput, maxWaitDur time.Duration, optFns ...func(*BundleTaskCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BundleTaskComplete waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *BundleTaskCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeBundleTasksInput, maxWaitDur time.Duration, optFns ...func(*BundleTaskCompleteWaiterOptions)) (*DescribeBundleTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -233,7 +242,7 @@ func (w *BundleTaskCompleteWaiter) Wait(ctx context.Context, params *DescribeBun } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -261,10 +270,10 @@ func (w *BundleTaskCompleteWaiter) Wait(ctx context.Context, params *DescribeBun retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -277,16 +286,16 @@ func (w *BundleTaskCompleteWaiter) Wait(ctx context.Context, params *DescribeBun attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BundleTaskComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for BundleTaskComplete waiter") } func bundleTaskCompleteStateRetryable(ctx context.Context, input *DescribeBundleTasksInput, output *DescribeBundleTasksOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeConversionTasks.go b/service/ec2/api_op_DescribeConversionTasks.go index 851710fbe40..562f7df5e7f 100644 --- a/service/ec2/api_op_DescribeConversionTasks.go +++ b/service/ec2/api_op_DescribeConversionTasks.go @@ -190,8 +190,17 @@ func NewConversionTaskCancelledWaiter(client DescribeConversionTasksAPIClient, o // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ConversionTaskCancelledWaiter) Wait(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskCancelledWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ConversionTaskCancelled waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ConversionTaskCancelledWaiter) WaitForOutput(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskCancelledWaiterOptions)) (*DescribeConversionTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *ConversionTaskCancelledWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *ConversionTaskCancelledWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *ConversionTaskCancelledWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ConversionTaskCancelled waiter") + return nil, fmt.Errorf("exceeded max wait time for ConversionTaskCancelled waiter") } func conversionTaskCancelledStateRetryable(ctx context.Context, input *DescribeConversionTasksInput, output *DescribeConversionTasksOutput, err error) (bool, error) { @@ -358,8 +367,17 @@ func NewConversionTaskCompletedWaiter(client DescribeConversionTasksAPIClient, o // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ConversionTaskCompletedWaiter) Wait(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ConversionTaskCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ConversionTaskCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskCompletedWaiterOptions)) (*DescribeConversionTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -372,7 +390,7 @@ func (w *ConversionTaskCompletedWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -400,10 +418,10 @@ func (w *ConversionTaskCompletedWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -416,16 +434,16 @@ func (w *ConversionTaskCompletedWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ConversionTaskCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ConversionTaskCompleted waiter") } func conversionTaskCompletedStateRetryable(ctx context.Context, input *DescribeConversionTasksInput, output *DescribeConversionTasksOutput, err error) (bool, error) { @@ -573,8 +591,17 @@ func NewConversionTaskDeletedWaiter(client DescribeConversionTasksAPIClient, opt // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ConversionTaskDeletedWaiter) Wait(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ConversionTaskDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ConversionTaskDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeConversionTasksInput, maxWaitDur time.Duration, optFns ...func(*ConversionTaskDeletedWaiterOptions)) (*DescribeConversionTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -587,7 +614,7 @@ func (w *ConversionTaskDeletedWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -615,10 +642,10 @@ func (w *ConversionTaskDeletedWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -631,16 +658,16 @@ func (w *ConversionTaskDeletedWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ConversionTaskDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ConversionTaskDeleted waiter") } func conversionTaskDeletedStateRetryable(ctx context.Context, input *DescribeConversionTasksInput, output *DescribeConversionTasksOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeCustomerGateways.go b/service/ec2/api_op_DescribeCustomerGateways.go index a33c51b0fb7..720a62782a2 100644 --- a/service/ec2/api_op_DescribeCustomerGateways.go +++ b/service/ec2/api_op_DescribeCustomerGateways.go @@ -219,8 +219,17 @@ func NewCustomerGatewayAvailableWaiter(client DescribeCustomerGatewaysAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *CustomerGatewayAvailableWaiter) Wait(ctx context.Context, params *DescribeCustomerGatewaysInput, maxWaitDur time.Duration, optFns ...func(*CustomerGatewayAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CustomerGatewayAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CustomerGatewayAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeCustomerGatewaysInput, maxWaitDur time.Duration, optFns ...func(*CustomerGatewayAvailableWaiterOptions)) (*DescribeCustomerGatewaysOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -233,7 +242,7 @@ func (w *CustomerGatewayAvailableWaiter) Wait(ctx context.Context, params *Descr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -261,10 +270,10 @@ func (w *CustomerGatewayAvailableWaiter) Wait(ctx context.Context, params *Descr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -277,16 +286,16 @@ func (w *CustomerGatewayAvailableWaiter) Wait(ctx context.Context, params *Descr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CustomerGatewayAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for CustomerGatewayAvailable waiter") } func customerGatewayAvailableStateRetryable(ctx context.Context, input *DescribeCustomerGatewaysInput, output *DescribeCustomerGatewaysOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeExportTasks.go b/service/ec2/api_op_DescribeExportTasks.go index 6bac0035dcd..84af290e6d1 100644 --- a/service/ec2/api_op_DescribeExportTasks.go +++ b/service/ec2/api_op_DescribeExportTasks.go @@ -183,8 +183,17 @@ func NewExportTaskCancelledWaiter(client DescribeExportTasksAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ExportTaskCancelledWaiter) Wait(ctx context.Context, params *DescribeExportTasksInput, maxWaitDur time.Duration, optFns ...func(*ExportTaskCancelledWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ExportTaskCancelled waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ExportTaskCancelledWaiter) WaitForOutput(ctx context.Context, params *DescribeExportTasksInput, maxWaitDur time.Duration, optFns ...func(*ExportTaskCancelledWaiterOptions)) (*DescribeExportTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -197,7 +206,7 @@ func (w *ExportTaskCancelledWaiter) Wait(ctx context.Context, params *DescribeEx } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -225,10 +234,10 @@ func (w *ExportTaskCancelledWaiter) Wait(ctx context.Context, params *DescribeEx retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -241,16 +250,16 @@ func (w *ExportTaskCancelledWaiter) Wait(ctx context.Context, params *DescribeEx attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ExportTaskCancelled waiter") + return nil, fmt.Errorf("exceeded max wait time for ExportTaskCancelled waiter") } func exportTaskCancelledStateRetryable(ctx context.Context, input *DescribeExportTasksInput, output *DescribeExportTasksOutput, err error) (bool, error) { @@ -350,8 +359,17 @@ func NewExportTaskCompletedWaiter(client DescribeExportTasksAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ExportTaskCompletedWaiter) Wait(ctx context.Context, params *DescribeExportTasksInput, maxWaitDur time.Duration, optFns ...func(*ExportTaskCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ExportTaskCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ExportTaskCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeExportTasksInput, maxWaitDur time.Duration, optFns ...func(*ExportTaskCompletedWaiterOptions)) (*DescribeExportTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -364,7 +382,7 @@ func (w *ExportTaskCompletedWaiter) Wait(ctx context.Context, params *DescribeEx } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -392,10 +410,10 @@ func (w *ExportTaskCompletedWaiter) Wait(ctx context.Context, params *DescribeEx retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -408,16 +426,16 @@ func (w *ExportTaskCompletedWaiter) Wait(ctx context.Context, params *DescribeEx attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ExportTaskCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ExportTaskCompleted waiter") } func exportTaskCompletedStateRetryable(ctx context.Context, input *DescribeExportTasksInput, output *DescribeExportTasksOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeImages.go b/service/ec2/api_op_DescribeImages.go index c7849b085a1..7609fbe0df1 100644 --- a/service/ec2/api_op_DescribeImages.go +++ b/service/ec2/api_op_DescribeImages.go @@ -327,8 +327,17 @@ func NewImageAvailableWaiter(client DescribeImagesAPIClient, optFns ...func(*Ima // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ImageAvailableWaiter) Wait(ctx context.Context, params *DescribeImagesInput, maxWaitDur time.Duration, optFns ...func(*ImageAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ImageAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeImagesInput, maxWaitDur time.Duration, optFns ...func(*ImageAvailableWaiterOptions)) (*DescribeImagesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -341,7 +350,7 @@ func (w *ImageAvailableWaiter) Wait(ctx context.Context, params *DescribeImagesI } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -369,10 +378,10 @@ func (w *ImageAvailableWaiter) Wait(ctx context.Context, params *DescribeImagesI retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -385,16 +394,16 @@ func (w *ImageAvailableWaiter) Wait(ctx context.Context, params *DescribeImagesI attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageAvailable waiter") } func imageAvailableStateRetryable(ctx context.Context, input *DescribeImagesInput, output *DescribeImagesOutput, err error) (bool, error) { @@ -517,8 +526,16 @@ func NewImageExistsWaiter(client DescribeImagesAPIClient, optFns ...func(*ImageE // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ImageExistsWaiter) Wait(ctx context.Context, params *DescribeImagesInput, maxWaitDur time.Duration, optFns ...func(*ImageExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ImageExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeImagesInput, maxWaitDur time.Duration, optFns ...func(*ImageExistsWaiterOptions)) (*DescribeImagesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -531,7 +548,7 @@ func (w *ImageExistsWaiter) Wait(ctx context.Context, params *DescribeImagesInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -559,10 +576,10 @@ func (w *ImageExistsWaiter) Wait(ctx context.Context, params *DescribeImagesInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -575,16 +592,16 @@ func (w *ImageExistsWaiter) Wait(ctx context.Context, params *DescribeImagesInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageExists waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageExists waiter") } func imageExistsStateRetryable(ctx context.Context, input *DescribeImagesInput, output *DescribeImagesOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeInstanceStatus.go b/service/ec2/api_op_DescribeInstanceStatus.go index e2651c7e499..63f29269bd0 100644 --- a/service/ec2/api_op_DescribeInstanceStatus.go +++ b/service/ec2/api_op_DescribeInstanceStatus.go @@ -361,8 +361,17 @@ func NewInstanceStatusOkWaiter(client DescribeInstanceStatusAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *InstanceStatusOkWaiter) Wait(ctx context.Context, params *DescribeInstanceStatusInput, maxWaitDur time.Duration, optFns ...func(*InstanceStatusOkWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceStatusOk waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceStatusOkWaiter) WaitForOutput(ctx context.Context, params *DescribeInstanceStatusInput, maxWaitDur time.Duration, optFns ...func(*InstanceStatusOkWaiterOptions)) (*DescribeInstanceStatusOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -375,7 +384,7 @@ func (w *InstanceStatusOkWaiter) Wait(ctx context.Context, params *DescribeInsta } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -403,10 +412,10 @@ func (w *InstanceStatusOkWaiter) Wait(ctx context.Context, params *DescribeInsta retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -419,16 +428,16 @@ func (w *InstanceStatusOkWaiter) Wait(ctx context.Context, params *DescribeInsta attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceStatusOk waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceStatusOk waiter") } func instanceStatusOkStateRetryable(ctx context.Context, input *DescribeInstanceStatusInput, output *DescribeInstanceStatusOutput, err error) (bool, error) { @@ -539,8 +548,17 @@ func NewSystemStatusOkWaiter(client DescribeInstanceStatusAPIClient, optFns ...f // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *SystemStatusOkWaiter) Wait(ctx context.Context, params *DescribeInstanceStatusInput, maxWaitDur time.Duration, optFns ...func(*SystemStatusOkWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SystemStatusOk waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *SystemStatusOkWaiter) WaitForOutput(ctx context.Context, params *DescribeInstanceStatusInput, maxWaitDur time.Duration, optFns ...func(*SystemStatusOkWaiterOptions)) (*DescribeInstanceStatusOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -553,7 +571,7 @@ func (w *SystemStatusOkWaiter) Wait(ctx context.Context, params *DescribeInstanc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -581,10 +599,10 @@ func (w *SystemStatusOkWaiter) Wait(ctx context.Context, params *DescribeInstanc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -597,16 +615,16 @@ func (w *SystemStatusOkWaiter) Wait(ctx context.Context, params *DescribeInstanc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SystemStatusOk waiter") + return nil, fmt.Errorf("exceeded max wait time for SystemStatusOk waiter") } func systemStatusOkStateRetryable(ctx context.Context, input *DescribeInstanceStatusInput, output *DescribeInstanceStatusOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeInstances.go b/service/ec2/api_op_DescribeInstances.go index 85d679faa9d..c66173aed15 100644 --- a/service/ec2/api_op_DescribeInstances.go +++ b/service/ec2/api_op_DescribeInstances.go @@ -605,8 +605,17 @@ func NewInstanceExistsWaiter(client DescribeInstancesAPIClient, optFns ...func(* // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InstanceExistsWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceExistsWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -619,7 +628,7 @@ func (w *InstanceExistsWaiter) Wait(ctx context.Context, params *DescribeInstanc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -647,10 +656,10 @@ func (w *InstanceExistsWaiter) Wait(ctx context.Context, params *DescribeInstanc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -663,16 +672,16 @@ func (w *InstanceExistsWaiter) Wait(ctx context.Context, params *DescribeInstanc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceExists waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceExists waiter") } func instanceExistsStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -772,8 +781,17 @@ func NewInstanceRunningWaiter(client DescribeInstancesAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InstanceRunningWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceRunning waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceRunningWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -786,7 +804,7 @@ func (w *InstanceRunningWaiter) Wait(ctx context.Context, params *DescribeInstan } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -814,10 +832,10 @@ func (w *InstanceRunningWaiter) Wait(ctx context.Context, params *DescribeInstan retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -830,16 +848,16 @@ func (w *InstanceRunningWaiter) Wait(ctx context.Context, params *DescribeInstan attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceRunning waiter") } func instanceRunningStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -1022,8 +1040,17 @@ func NewInstanceStoppedWaiter(client DescribeInstancesAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceStopped waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceStoppedWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1036,7 +1063,7 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1064,10 +1091,10 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1080,16 +1107,16 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceStopped waiter") } func instanceStoppedStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -1236,8 +1263,17 @@ func NewInstanceTerminatedWaiter(client DescribeInstancesAPIClient, optFns ...fu // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceTerminatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceTerminated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *InstanceTerminatedWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceTerminatedWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1250,7 +1286,7 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1278,10 +1314,10 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1294,16 +1330,16 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceTerminated waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceTerminated waiter") } func instanceTerminatedStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeKeyPairs.go b/service/ec2/api_op_DescribeKeyPairs.go index 73c2f3813f0..b365118aa91 100644 --- a/service/ec2/api_op_DescribeKeyPairs.go +++ b/service/ec2/api_op_DescribeKeyPairs.go @@ -213,8 +213,16 @@ func NewKeyPairExistsWaiter(client DescribeKeyPairsAPIClient, optFns ...func(*Ke // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *KeyPairExistsWaiter) Wait(ctx context.Context, params *DescribeKeyPairsInput, maxWaitDur time.Duration, optFns ...func(*KeyPairExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for KeyPairExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *KeyPairExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeKeyPairsInput, maxWaitDur time.Duration, optFns ...func(*KeyPairExistsWaiterOptions)) (*DescribeKeyPairsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -227,7 +235,7 @@ func (w *KeyPairExistsWaiter) Wait(ctx context.Context, params *DescribeKeyPairs } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -255,10 +263,10 @@ func (w *KeyPairExistsWaiter) Wait(ctx context.Context, params *DescribeKeyPairs retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -271,16 +279,16 @@ func (w *KeyPairExistsWaiter) Wait(ctx context.Context, params *DescribeKeyPairs attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for KeyPairExists waiter") + return nil, fmt.Errorf("exceeded max wait time for KeyPairExists waiter") } func keyPairExistsStateRetryable(ctx context.Context, input *DescribeKeyPairsInput, output *DescribeKeyPairsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeNatGateways.go b/service/ec2/api_op_DescribeNatGateways.go index b2561a2a454..8d225d95992 100644 --- a/service/ec2/api_op_DescribeNatGateways.go +++ b/service/ec2/api_op_DescribeNatGateways.go @@ -302,8 +302,17 @@ func NewNatGatewayAvailableWaiter(client DescribeNatGatewaysAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *NatGatewayAvailableWaiter) Wait(ctx context.Context, params *DescribeNatGatewaysInput, maxWaitDur time.Duration, optFns ...func(*NatGatewayAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NatGatewayAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *NatGatewayAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeNatGatewaysInput, maxWaitDur time.Duration, optFns ...func(*NatGatewayAvailableWaiterOptions)) (*DescribeNatGatewaysOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -316,7 +325,7 @@ func (w *NatGatewayAvailableWaiter) Wait(ctx context.Context, params *DescribeNa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -344,10 +353,10 @@ func (w *NatGatewayAvailableWaiter) Wait(ctx context.Context, params *DescribeNa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -360,16 +369,16 @@ func (w *NatGatewayAvailableWaiter) Wait(ctx context.Context, params *DescribeNa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NatGatewayAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for NatGatewayAvailable waiter") } func natGatewayAvailableStateRetryable(ctx context.Context, input *DescribeNatGatewaysInput, output *DescribeNatGatewaysOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeNetworkInterfaces.go b/service/ec2/api_op_DescribeNetworkInterfaces.go index 59fc1ac9399..554d50b278d 100644 --- a/service/ec2/api_op_DescribeNetworkInterfaces.go +++ b/service/ec2/api_op_DescribeNetworkInterfaces.go @@ -408,8 +408,17 @@ func NewNetworkInterfaceAvailableWaiter(client DescribeNetworkInterfacesAPIClien // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *NetworkInterfaceAvailableWaiter) Wait(ctx context.Context, params *DescribeNetworkInterfacesInput, maxWaitDur time.Duration, optFns ...func(*NetworkInterfaceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NetworkInterfaceAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *NetworkInterfaceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeNetworkInterfacesInput, maxWaitDur time.Duration, optFns ...func(*NetworkInterfaceAvailableWaiterOptions)) (*DescribeNetworkInterfacesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -422,7 +431,7 @@ func (w *NetworkInterfaceAvailableWaiter) Wait(ctx context.Context, params *Desc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -450,10 +459,10 @@ func (w *NetworkInterfaceAvailableWaiter) Wait(ctx context.Context, params *Desc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -466,16 +475,16 @@ func (w *NetworkInterfaceAvailableWaiter) Wait(ctx context.Context, params *Desc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NetworkInterfaceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for NetworkInterfaceAvailable waiter") } func networkInterfaceAvailableStateRetryable(ctx context.Context, input *DescribeNetworkInterfacesInput, output *DescribeNetworkInterfacesOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeSecurityGroups.go b/service/ec2/api_op_DescribeSecurityGroups.go index 1071b8f0aea..0a79c1e127e 100644 --- a/service/ec2/api_op_DescribeSecurityGroups.go +++ b/service/ec2/api_op_DescribeSecurityGroups.go @@ -389,8 +389,17 @@ func NewSecurityGroupExistsWaiter(client DescribeSecurityGroupsAPIClient, optFns // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *SecurityGroupExistsWaiter) Wait(ctx context.Context, params *DescribeSecurityGroupsInput, maxWaitDur time.Duration, optFns ...func(*SecurityGroupExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SecurityGroupExists waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *SecurityGroupExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeSecurityGroupsInput, maxWaitDur time.Duration, optFns ...func(*SecurityGroupExistsWaiterOptions)) (*DescribeSecurityGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -403,7 +412,7 @@ func (w *SecurityGroupExistsWaiter) Wait(ctx context.Context, params *DescribeSe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -431,10 +440,10 @@ func (w *SecurityGroupExistsWaiter) Wait(ctx context.Context, params *DescribeSe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -447,16 +456,16 @@ func (w *SecurityGroupExistsWaiter) Wait(ctx context.Context, params *DescribeSe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SecurityGroupExists waiter") + return nil, fmt.Errorf("exceeded max wait time for SecurityGroupExists waiter") } func securityGroupExistsStateRetryable(ctx context.Context, input *DescribeSecurityGroupsInput, output *DescribeSecurityGroupsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeSnapshots.go b/service/ec2/api_op_DescribeSnapshots.go index 081f437953e..20b590726f3 100644 --- a/service/ec2/api_op_DescribeSnapshots.go +++ b/service/ec2/api_op_DescribeSnapshots.go @@ -388,8 +388,17 @@ func NewSnapshotCompletedWaiter(client DescribeSnapshotsAPIClient, optFns ...fun // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *SnapshotCompletedWaiter) Wait(ctx context.Context, params *DescribeSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SnapshotCompleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *SnapshotCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotCompletedWaiterOptions)) (*DescribeSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -402,7 +411,7 @@ func (w *SnapshotCompletedWaiter) Wait(ctx context.Context, params *DescribeSnap } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -430,10 +439,10 @@ func (w *SnapshotCompletedWaiter) Wait(ctx context.Context, params *DescribeSnap retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -446,16 +455,16 @@ func (w *SnapshotCompletedWaiter) Wait(ctx context.Context, params *DescribeSnap attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SnapshotCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for SnapshotCompleted waiter") } func snapshotCompletedStateRetryable(ctx context.Context, input *DescribeSnapshotsInput, output *DescribeSnapshotsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeSpotInstanceRequests.go b/service/ec2/api_op_DescribeSpotInstanceRequests.go index 9720cd59392..f6e304fb8b7 100644 --- a/service/ec2/api_op_DescribeSpotInstanceRequests.go +++ b/service/ec2/api_op_DescribeSpotInstanceRequests.go @@ -432,8 +432,17 @@ func NewSpotInstanceRequestFulfilledWaiter(client DescribeSpotInstanceRequestsAP // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *SpotInstanceRequestFulfilledWaiter) Wait(ctx context.Context, params *DescribeSpotInstanceRequestsInput, maxWaitDur time.Duration, optFns ...func(*SpotInstanceRequestFulfilledWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SpotInstanceRequestFulfilled waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *SpotInstanceRequestFulfilledWaiter) WaitForOutput(ctx context.Context, params *DescribeSpotInstanceRequestsInput, maxWaitDur time.Duration, optFns ...func(*SpotInstanceRequestFulfilledWaiterOptions)) (*DescribeSpotInstanceRequestsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -446,7 +455,7 @@ func (w *SpotInstanceRequestFulfilledWaiter) Wait(ctx context.Context, params *D } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -474,10 +483,10 @@ func (w *SpotInstanceRequestFulfilledWaiter) Wait(ctx context.Context, params *D retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -490,16 +499,16 @@ func (w *SpotInstanceRequestFulfilledWaiter) Wait(ctx context.Context, params *D attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SpotInstanceRequestFulfilled waiter") + return nil, fmt.Errorf("exceeded max wait time for SpotInstanceRequestFulfilled waiter") } func spotInstanceRequestFulfilledStateRetryable(ctx context.Context, input *DescribeSpotInstanceRequestsInput, output *DescribeSpotInstanceRequestsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeSubnets.go b/service/ec2/api_op_DescribeSubnets.go index 70ad461001b..ae5fc21571c 100644 --- a/service/ec2/api_op_DescribeSubnets.go +++ b/service/ec2/api_op_DescribeSubnets.go @@ -335,8 +335,17 @@ func NewSubnetAvailableWaiter(client DescribeSubnetsAPIClient, optFns ...func(*S // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *SubnetAvailableWaiter) Wait(ctx context.Context, params *DescribeSubnetsInput, maxWaitDur time.Duration, optFns ...func(*SubnetAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SubnetAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *SubnetAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeSubnetsInput, maxWaitDur time.Duration, optFns ...func(*SubnetAvailableWaiterOptions)) (*DescribeSubnetsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -349,7 +358,7 @@ func (w *SubnetAvailableWaiter) Wait(ctx context.Context, params *DescribeSubnet } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -377,10 +386,10 @@ func (w *SubnetAvailableWaiter) Wait(ctx context.Context, params *DescribeSubnet retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -393,16 +402,16 @@ func (w *SubnetAvailableWaiter) Wait(ctx context.Context, params *DescribeSubnet attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SubnetAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for SubnetAvailable waiter") } func subnetAvailableStateRetryable(ctx context.Context, input *DescribeSubnetsInput, output *DescribeSubnetsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeVolumes.go b/service/ec2/api_op_DescribeVolumes.go index 3631339f850..96ffe8260bd 100644 --- a/service/ec2/api_op_DescribeVolumes.go +++ b/service/ec2/api_op_DescribeVolumes.go @@ -359,8 +359,17 @@ func NewVolumeAvailableWaiter(client DescribeVolumesAPIClient, optFns ...func(*V // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VolumeAvailableWaiter) Wait(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VolumeAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *VolumeAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeAvailableWaiterOptions)) (*DescribeVolumesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -373,7 +382,7 @@ func (w *VolumeAvailableWaiter) Wait(ctx context.Context, params *DescribeVolume } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -401,10 +410,10 @@ func (w *VolumeAvailableWaiter) Wait(ctx context.Context, params *DescribeVolume retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -417,16 +426,16 @@ func (w *VolumeAvailableWaiter) Wait(ctx context.Context, params *DescribeVolume attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VolumeAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for VolumeAvailable waiter") } func volumeAvailableStateRetryable(ctx context.Context, input *DescribeVolumesInput, output *DescribeVolumesOutput, err error) (bool, error) { @@ -549,8 +558,16 @@ func NewVolumeDeletedWaiter(client DescribeVolumesAPIClient, optFns ...func(*Vol // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VolumeDeletedWaiter) Wait(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VolumeDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *VolumeDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeDeletedWaiterOptions)) (*DescribeVolumesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -563,7 +580,7 @@ func (w *VolumeDeletedWaiter) Wait(ctx context.Context, params *DescribeVolumesI } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -591,10 +608,10 @@ func (w *VolumeDeletedWaiter) Wait(ctx context.Context, params *DescribeVolumesI retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -607,16 +624,16 @@ func (w *VolumeDeletedWaiter) Wait(ctx context.Context, params *DescribeVolumesI attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VolumeDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for VolumeDeleted waiter") } func volumeDeletedStateRetryable(ctx context.Context, input *DescribeVolumesInput, output *DescribeVolumesOutput, err error) (bool, error) { @@ -727,8 +744,16 @@ func NewVolumeInUseWaiter(client DescribeVolumesAPIClient, optFns ...func(*Volum // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VolumeInUseWaiter) Wait(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeInUseWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VolumeInUse waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *VolumeInUseWaiter) WaitForOutput(ctx context.Context, params *DescribeVolumesInput, maxWaitDur time.Duration, optFns ...func(*VolumeInUseWaiterOptions)) (*DescribeVolumesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -741,7 +766,7 @@ func (w *VolumeInUseWaiter) Wait(ctx context.Context, params *DescribeVolumesInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -769,10 +794,10 @@ func (w *VolumeInUseWaiter) Wait(ctx context.Context, params *DescribeVolumesInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -785,16 +810,16 @@ func (w *VolumeInUseWaiter) Wait(ctx context.Context, params *DescribeVolumesInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VolumeInUse waiter") + return nil, fmt.Errorf("exceeded max wait time for VolumeInUse waiter") } func volumeInUseStateRetryable(ctx context.Context, input *DescribeVolumesInput, output *DescribeVolumesOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeVpcPeeringConnections.go b/service/ec2/api_op_DescribeVpcPeeringConnections.go index 1b436e83092..7ff851b330c 100644 --- a/service/ec2/api_op_DescribeVpcPeeringConnections.go +++ b/service/ec2/api_op_DescribeVpcPeeringConnections.go @@ -329,8 +329,17 @@ func NewVpcPeeringConnectionDeletedWaiter(client DescribeVpcPeeringConnectionsAP // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *VpcPeeringConnectionDeletedWaiter) Wait(ctx context.Context, params *DescribeVpcPeeringConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpcPeeringConnectionDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpcPeeringConnectionDeleted waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *VpcPeeringConnectionDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeVpcPeeringConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpcPeeringConnectionDeletedWaiterOptions)) (*DescribeVpcPeeringConnectionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -343,7 +352,7 @@ func (w *VpcPeeringConnectionDeletedWaiter) Wait(ctx context.Context, params *De } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -371,10 +380,10 @@ func (w *VpcPeeringConnectionDeletedWaiter) Wait(ctx context.Context, params *De retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -387,16 +396,16 @@ func (w *VpcPeeringConnectionDeletedWaiter) Wait(ctx context.Context, params *De attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpcPeeringConnectionDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for VpcPeeringConnectionDeleted waiter") } func vpcPeeringConnectionDeletedStateRetryable(ctx context.Context, input *DescribeVpcPeeringConnectionsInput, output *DescribeVpcPeeringConnectionsOutput, err error) (bool, error) { @@ -511,8 +520,17 @@ func NewVpcPeeringConnectionExistsWaiter(client DescribeVpcPeeringConnectionsAPI // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *VpcPeeringConnectionExistsWaiter) Wait(ctx context.Context, params *DescribeVpcPeeringConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpcPeeringConnectionExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpcPeeringConnectionExists waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *VpcPeeringConnectionExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVpcPeeringConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpcPeeringConnectionExistsWaiterOptions)) (*DescribeVpcPeeringConnectionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -525,7 +543,7 @@ func (w *VpcPeeringConnectionExistsWaiter) Wait(ctx context.Context, params *Des } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -553,10 +571,10 @@ func (w *VpcPeeringConnectionExistsWaiter) Wait(ctx context.Context, params *Des retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -569,16 +587,16 @@ func (w *VpcPeeringConnectionExistsWaiter) Wait(ctx context.Context, params *Des attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpcPeeringConnectionExists waiter") + return nil, fmt.Errorf("exceeded max wait time for VpcPeeringConnectionExists waiter") } func vpcPeeringConnectionExistsStateRetryable(ctx context.Context, input *DescribeVpcPeeringConnectionsInput, output *DescribeVpcPeeringConnectionsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeVpcs.go b/service/ec2/api_op_DescribeVpcs.go index 9f177fd106e..d7e563cc782 100644 --- a/service/ec2/api_op_DescribeVpcs.go +++ b/service/ec2/api_op_DescribeVpcs.go @@ -330,8 +330,16 @@ func NewVpcAvailableWaiter(client DescribeVpcsAPIClient, optFns ...func(*VpcAvai // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VpcAvailableWaiter) Wait(ctx context.Context, params *DescribeVpcsInput, maxWaitDur time.Duration, optFns ...func(*VpcAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpcAvailable waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *VpcAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeVpcsInput, maxWaitDur time.Duration, optFns ...func(*VpcAvailableWaiterOptions)) (*DescribeVpcsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -344,7 +352,7 @@ func (w *VpcAvailableWaiter) Wait(ctx context.Context, params *DescribeVpcsInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -372,10 +380,10 @@ func (w *VpcAvailableWaiter) Wait(ctx context.Context, params *DescribeVpcsInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -388,16 +396,16 @@ func (w *VpcAvailableWaiter) Wait(ctx context.Context, params *DescribeVpcsInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpcAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for VpcAvailable waiter") } func vpcAvailableStateRetryable(ctx context.Context, input *DescribeVpcsInput, output *DescribeVpcsOutput, err error) (bool, error) { @@ -496,8 +504,16 @@ func NewVpcExistsWaiter(client DescribeVpcsAPIClient, optFns ...func(*VpcExistsW // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VpcExistsWaiter) Wait(ctx context.Context, params *DescribeVpcsInput, maxWaitDur time.Duration, optFns ...func(*VpcExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpcExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *VpcExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVpcsInput, maxWaitDur time.Duration, optFns ...func(*VpcExistsWaiterOptions)) (*DescribeVpcsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -510,7 +526,7 @@ func (w *VpcExistsWaiter) Wait(ctx context.Context, params *DescribeVpcsInput, m } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -538,10 +554,10 @@ func (w *VpcExistsWaiter) Wait(ctx context.Context, params *DescribeVpcsInput, m retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -554,16 +570,16 @@ func (w *VpcExistsWaiter) Wait(ctx context.Context, params *DescribeVpcsInput, m attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpcExists waiter") + return nil, fmt.Errorf("exceeded max wait time for VpcExists waiter") } func vpcExistsStateRetryable(ctx context.Context, input *DescribeVpcsInput, output *DescribeVpcsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_DescribeVpnConnections.go b/service/ec2/api_op_DescribeVpnConnections.go index 0411e7ab8fb..b183f071136 100644 --- a/service/ec2/api_op_DescribeVpnConnections.go +++ b/service/ec2/api_op_DescribeVpnConnections.go @@ -235,8 +235,17 @@ func NewVpnConnectionAvailableWaiter(client DescribeVpnConnectionsAPIClient, opt // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *VpnConnectionAvailableWaiter) Wait(ctx context.Context, params *DescribeVpnConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpnConnectionAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpnConnectionAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *VpnConnectionAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeVpnConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpnConnectionAvailableWaiterOptions)) (*DescribeVpnConnectionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -249,7 +258,7 @@ func (w *VpnConnectionAvailableWaiter) Wait(ctx context.Context, params *Describ } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -277,10 +286,10 @@ func (w *VpnConnectionAvailableWaiter) Wait(ctx context.Context, params *Describ retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -293,16 +302,16 @@ func (w *VpnConnectionAvailableWaiter) Wait(ctx context.Context, params *Describ attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpnConnectionAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for VpnConnectionAvailable waiter") } func vpnConnectionAvailableStateRetryable(ctx context.Context, input *DescribeVpnConnectionsInput, output *DescribeVpnConnectionsOutput, err error) (bool, error) { @@ -450,8 +459,17 @@ func NewVpnConnectionDeletedWaiter(client DescribeVpnConnectionsAPIClient, optFn // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *VpnConnectionDeletedWaiter) Wait(ctx context.Context, params *DescribeVpnConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpnConnectionDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VpnConnectionDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *VpnConnectionDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeVpnConnectionsInput, maxWaitDur time.Duration, optFns ...func(*VpnConnectionDeletedWaiterOptions)) (*DescribeVpnConnectionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -464,7 +482,7 @@ func (w *VpnConnectionDeletedWaiter) Wait(ctx context.Context, params *DescribeV } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -492,10 +510,10 @@ func (w *VpnConnectionDeletedWaiter) Wait(ctx context.Context, params *DescribeV retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -508,16 +526,16 @@ func (w *VpnConnectionDeletedWaiter) Wait(ctx context.Context, params *DescribeV attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VpnConnectionDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for VpnConnectionDeleted waiter") } func vpnConnectionDeletedStateRetryable(ctx context.Context, input *DescribeVpnConnectionsInput, output *DescribeVpnConnectionsOutput, err error) (bool, error) { diff --git a/service/ec2/api_op_GetPasswordData.go b/service/ec2/api_op_GetPasswordData.go index 44dc8074f65..4fb46eb2013 100644 --- a/service/ec2/api_op_GetPasswordData.go +++ b/service/ec2/api_op_GetPasswordData.go @@ -211,8 +211,17 @@ func NewPasswordDataAvailableWaiter(client GetPasswordDataAPIClient, optFns ...f // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *PasswordDataAvailableWaiter) Wait(ctx context.Context, params *GetPasswordDataInput, maxWaitDur time.Duration, optFns ...func(*PasswordDataAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for PasswordDataAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *PasswordDataAvailableWaiter) WaitForOutput(ctx context.Context, params *GetPasswordDataInput, maxWaitDur time.Duration, optFns ...func(*PasswordDataAvailableWaiterOptions)) (*GetPasswordDataOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -225,7 +234,7 @@ func (w *PasswordDataAvailableWaiter) Wait(ctx context.Context, params *GetPassw } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -253,10 +262,10 @@ func (w *PasswordDataAvailableWaiter) Wait(ctx context.Context, params *GetPassw retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -269,16 +278,16 @@ func (w *PasswordDataAvailableWaiter) Wait(ctx context.Context, params *GetPassw attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for PasswordDataAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for PasswordDataAvailable waiter") } func passwordDataAvailableStateRetryable(ctx context.Context, input *GetPasswordDataInput, output *GetPasswordDataOutput, err error) (bool, error) { diff --git a/service/ecr/api_op_DescribeImageScanFindings.go b/service/ecr/api_op_DescribeImageScanFindings.go index ea73d82f639..25617b3f995 100644 --- a/service/ecr/api_op_DescribeImageScanFindings.go +++ b/service/ecr/api_op_DescribeImageScanFindings.go @@ -315,8 +315,17 @@ func NewImageScanCompleteWaiter(client DescribeImageScanFindingsAPIClient, optFn // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ImageScanCompleteWaiter) Wait(ctx context.Context, params *DescribeImageScanFindingsInput, maxWaitDur time.Duration, optFns ...func(*ImageScanCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageScanComplete waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ImageScanCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeImageScanFindingsInput, maxWaitDur time.Duration, optFns ...func(*ImageScanCompleteWaiterOptions)) (*DescribeImageScanFindingsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -329,7 +338,7 @@ func (w *ImageScanCompleteWaiter) Wait(ctx context.Context, params *DescribeImag } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -357,10 +366,10 @@ func (w *ImageScanCompleteWaiter) Wait(ctx context.Context, params *DescribeImag retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -373,16 +382,16 @@ func (w *ImageScanCompleteWaiter) Wait(ctx context.Context, params *DescribeImag attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageScanComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageScanComplete waiter") } func imageScanCompleteStateRetryable(ctx context.Context, input *DescribeImageScanFindingsInput, output *DescribeImageScanFindingsOutput, err error) (bool, error) { diff --git a/service/ecr/api_op_GetLifecyclePolicyPreview.go b/service/ecr/api_op_GetLifecyclePolicyPreview.go index ccf8d59a549..165392e1a66 100644 --- a/service/ecr/api_op_GetLifecyclePolicyPreview.go +++ b/service/ecr/api_op_GetLifecyclePolicyPreview.go @@ -331,8 +331,17 @@ func NewLifecyclePolicyPreviewCompleteWaiter(client GetLifecyclePolicyPreviewAPI // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *LifecyclePolicyPreviewCompleteWaiter) Wait(ctx context.Context, params *GetLifecyclePolicyPreviewInput, maxWaitDur time.Duration, optFns ...func(*LifecyclePolicyPreviewCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LifecyclePolicyPreviewComplete +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *LifecyclePolicyPreviewCompleteWaiter) WaitForOutput(ctx context.Context, params *GetLifecyclePolicyPreviewInput, maxWaitDur time.Duration, optFns ...func(*LifecyclePolicyPreviewCompleteWaiterOptions)) (*GetLifecyclePolicyPreviewOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -345,7 +354,7 @@ func (w *LifecyclePolicyPreviewCompleteWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -373,10 +382,10 @@ func (w *LifecyclePolicyPreviewCompleteWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -389,16 +398,16 @@ func (w *LifecyclePolicyPreviewCompleteWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LifecyclePolicyPreviewComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for LifecyclePolicyPreviewComplete waiter") } func lifecyclePolicyPreviewCompleteStateRetryable(ctx context.Context, input *GetLifecyclePolicyPreviewInput, output *GetLifecyclePolicyPreviewOutput, err error) (bool, error) { diff --git a/service/ecs/api_op_DescribeServices.go b/service/ecs/api_op_DescribeServices.go index 2954ca435a9..a02027b5987 100644 --- a/service/ecs/api_op_DescribeServices.go +++ b/service/ecs/api_op_DescribeServices.go @@ -198,8 +198,17 @@ func NewServicesInactiveWaiter(client DescribeServicesAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ServicesInactiveWaiter) Wait(ctx context.Context, params *DescribeServicesInput, maxWaitDur time.Duration, optFns ...func(*ServicesInactiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServicesInactive waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ServicesInactiveWaiter) WaitForOutput(ctx context.Context, params *DescribeServicesInput, maxWaitDur time.Duration, optFns ...func(*ServicesInactiveWaiterOptions)) (*DescribeServicesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -212,7 +221,7 @@ func (w *ServicesInactiveWaiter) Wait(ctx context.Context, params *DescribeServi } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -240,10 +249,10 @@ func (w *ServicesInactiveWaiter) Wait(ctx context.Context, params *DescribeServi retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -256,16 +265,16 @@ func (w *ServicesInactiveWaiter) Wait(ctx context.Context, params *DescribeServi attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServicesInactive waiter") + return nil, fmt.Errorf("exceeded max wait time for ServicesInactive waiter") } func servicesInactiveStateRetryable(ctx context.Context, input *DescribeServicesInput, output *DescribeServicesOutput, err error) (bool, error) { diff --git a/service/ecs/api_op_DescribeTasks.go b/service/ecs/api_op_DescribeTasks.go index 847b8a3de9f..3cb6ce98570 100644 --- a/service/ecs/api_op_DescribeTasks.go +++ b/service/ecs/api_op_DescribeTasks.go @@ -196,8 +196,16 @@ func NewTasksRunningWaiter(client DescribeTasksAPIClient, optFns ...func(*TasksR // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *TasksRunningWaiter) Wait(ctx context.Context, params *DescribeTasksInput, maxWaitDur time.Duration, optFns ...func(*TasksRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TasksRunning waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *TasksRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeTasksInput, maxWaitDur time.Duration, optFns ...func(*TasksRunningWaiterOptions)) (*DescribeTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -210,7 +218,7 @@ func (w *TasksRunningWaiter) Wait(ctx context.Context, params *DescribeTasksInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -238,10 +246,10 @@ func (w *TasksRunningWaiter) Wait(ctx context.Context, params *DescribeTasksInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -254,16 +262,16 @@ func (w *TasksRunningWaiter) Wait(ctx context.Context, params *DescribeTasksInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TasksRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for TasksRunning waiter") } func tasksRunningStateRetryable(ctx context.Context, input *DescribeTasksInput, output *DescribeTasksOutput, err error) (bool, error) { @@ -410,8 +418,16 @@ func NewTasksStoppedWaiter(client DescribeTasksAPIClient, optFns ...func(*TasksS // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *TasksStoppedWaiter) Wait(ctx context.Context, params *DescribeTasksInput, maxWaitDur time.Duration, optFns ...func(*TasksStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TasksStopped waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *TasksStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeTasksInput, maxWaitDur time.Duration, optFns ...func(*TasksStoppedWaiterOptions)) (*DescribeTasksOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -424,7 +440,7 @@ func (w *TasksStoppedWaiter) Wait(ctx context.Context, params *DescribeTasksInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -452,10 +468,10 @@ func (w *TasksStoppedWaiter) Wait(ctx context.Context, params *DescribeTasksInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -468,16 +484,16 @@ func (w *TasksStoppedWaiter) Wait(ctx context.Context, params *DescribeTasksInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TasksStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for TasksStopped waiter") } func tasksStoppedStateRetryable(ctx context.Context, input *DescribeTasksInput, output *DescribeTasksOutput, err error) (bool, error) { diff --git a/service/eks/api_op_DescribeAddon.go b/service/eks/api_op_DescribeAddon.go index c5ac5f8f90f..b7ec2a456ce 100644 --- a/service/eks/api_op_DescribeAddon.go +++ b/service/eks/api_op_DescribeAddon.go @@ -190,8 +190,16 @@ func NewAddonActiveWaiter(client DescribeAddonAPIClient, optFns ...func(*AddonAc // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AddonActiveWaiter) Wait(ctx context.Context, params *DescribeAddonInput, maxWaitDur time.Duration, optFns ...func(*AddonActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AddonActive waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *AddonActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeAddonInput, maxWaitDur time.Duration, optFns ...func(*AddonActiveWaiterOptions)) (*DescribeAddonOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +212,7 @@ func (w *AddonActiveWaiter) Wait(ctx context.Context, params *DescribeAddonInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +240,10 @@ func (w *AddonActiveWaiter) Wait(ctx context.Context, params *DescribeAddonInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +256,16 @@ func (w *AddonActiveWaiter) Wait(ctx context.Context, params *DescribeAddonInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AddonActive waiter") + return nil, fmt.Errorf("exceeded max wait time for AddonActive waiter") } func addonActiveStateRetryable(ctx context.Context, input *DescribeAddonInput, output *DescribeAddonOutput, err error) (bool, error) { @@ -375,8 +383,16 @@ func NewAddonDeletedWaiter(client DescribeAddonAPIClient, optFns ...func(*AddonD // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AddonDeletedWaiter) Wait(ctx context.Context, params *DescribeAddonInput, maxWaitDur time.Duration, optFns ...func(*AddonDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AddonDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *AddonDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeAddonInput, maxWaitDur time.Duration, optFns ...func(*AddonDeletedWaiterOptions)) (*DescribeAddonOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -389,7 +405,7 @@ func (w *AddonDeletedWaiter) Wait(ctx context.Context, params *DescribeAddonInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -417,10 +433,10 @@ func (w *AddonDeletedWaiter) Wait(ctx context.Context, params *DescribeAddonInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -433,16 +449,16 @@ func (w *AddonDeletedWaiter) Wait(ctx context.Context, params *DescribeAddonInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AddonDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for AddonDeleted waiter") } func addonDeletedStateRetryable(ctx context.Context, input *DescribeAddonInput, output *DescribeAddonOutput, err error) (bool, error) { diff --git a/service/eks/api_op_DescribeCluster.go b/service/eks/api_op_DescribeCluster.go index 7afd9c575de..8f38f540e8e 100644 --- a/service/eks/api_op_DescribeCluster.go +++ b/service/eks/api_op_DescribeCluster.go @@ -190,8 +190,16 @@ func NewClusterActiveWaiter(client DescribeClusterAPIClient, optFns ...func(*Clu // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterActiveWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterActive waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ClusterActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterActiveWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +212,7 @@ func (w *ClusterActiveWaiter) Wait(ctx context.Context, params *DescribeClusterI } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +240,10 @@ func (w *ClusterActiveWaiter) Wait(ctx context.Context, params *DescribeClusterI retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +256,16 @@ func (w *ClusterActiveWaiter) Wait(ctx context.Context, params *DescribeClusterI attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterActive waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterActive waiter") } func clusterActiveStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { @@ -375,8 +383,17 @@ func NewClusterDeletedWaiter(client DescribeClusterAPIClient, optFns ...func(*Cl // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -389,7 +406,7 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -417,10 +434,10 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -433,16 +450,16 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") } func clusterDeletedStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { diff --git a/service/eks/api_op_DescribeFargateProfile.go b/service/eks/api_op_DescribeFargateProfile.go index e7654c95a05..6fb578a3ed2 100644 --- a/service/eks/api_op_DescribeFargateProfile.go +++ b/service/eks/api_op_DescribeFargateProfile.go @@ -190,8 +190,17 @@ func NewFargateProfileActiveWaiter(client DescribeFargateProfileAPIClient, optFn // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *FargateProfileActiveWaiter) Wait(ctx context.Context, params *DescribeFargateProfileInput, maxWaitDur time.Duration, optFns ...func(*FargateProfileActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FargateProfileActive waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *FargateProfileActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeFargateProfileInput, maxWaitDur time.Duration, optFns ...func(*FargateProfileActiveWaiterOptions)) (*DescribeFargateProfileOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *FargateProfileActiveWaiter) Wait(ctx context.Context, params *DescribeF } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *FargateProfileActiveWaiter) Wait(ctx context.Context, params *DescribeF retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *FargateProfileActiveWaiter) Wait(ctx context.Context, params *DescribeF attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FargateProfileActive waiter") + return nil, fmt.Errorf("exceeded max wait time for FargateProfileActive waiter") } func fargateProfileActiveStateRetryable(ctx context.Context, input *DescribeFargateProfileInput, output *DescribeFargateProfileOutput, err error) (bool, error) { @@ -359,8 +368,17 @@ func NewFargateProfileDeletedWaiter(client DescribeFargateProfileAPIClient, optF // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *FargateProfileDeletedWaiter) Wait(ctx context.Context, params *DescribeFargateProfileInput, maxWaitDur time.Duration, optFns ...func(*FargateProfileDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FargateProfileDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *FargateProfileDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeFargateProfileInput, maxWaitDur time.Duration, optFns ...func(*FargateProfileDeletedWaiterOptions)) (*DescribeFargateProfileOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -373,7 +391,7 @@ func (w *FargateProfileDeletedWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -401,10 +419,10 @@ func (w *FargateProfileDeletedWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -417,16 +435,16 @@ func (w *FargateProfileDeletedWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FargateProfileDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for FargateProfileDeleted waiter") } func fargateProfileDeletedStateRetryable(ctx context.Context, input *DescribeFargateProfileInput, output *DescribeFargateProfileOutput, err error) (bool, error) { diff --git a/service/eks/api_op_DescribeNodegroup.go b/service/eks/api_op_DescribeNodegroup.go index 2c40fe0dda4..d176d40ab0c 100644 --- a/service/eks/api_op_DescribeNodegroup.go +++ b/service/eks/api_op_DescribeNodegroup.go @@ -189,8 +189,17 @@ func NewNodegroupActiveWaiter(client DescribeNodegroupAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *NodegroupActiveWaiter) Wait(ctx context.Context, params *DescribeNodegroupInput, maxWaitDur time.Duration, optFns ...func(*NodegroupActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NodegroupActive waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *NodegroupActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeNodegroupInput, maxWaitDur time.Duration, optFns ...func(*NodegroupActiveWaiterOptions)) (*DescribeNodegroupOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -203,7 +212,7 @@ func (w *NodegroupActiveWaiter) Wait(ctx context.Context, params *DescribeNodegr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -231,10 +240,10 @@ func (w *NodegroupActiveWaiter) Wait(ctx context.Context, params *DescribeNodegr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -247,16 +256,16 @@ func (w *NodegroupActiveWaiter) Wait(ctx context.Context, params *DescribeNodegr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NodegroupActive waiter") + return nil, fmt.Errorf("exceeded max wait time for NodegroupActive waiter") } func nodegroupActiveStateRetryable(ctx context.Context, input *DescribeNodegroupInput, output *DescribeNodegroupOutput, err error) (bool, error) { @@ -357,8 +366,17 @@ func NewNodegroupDeletedWaiter(client DescribeNodegroupAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *NodegroupDeletedWaiter) Wait(ctx context.Context, params *DescribeNodegroupInput, maxWaitDur time.Duration, optFns ...func(*NodegroupDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NodegroupDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *NodegroupDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeNodegroupInput, maxWaitDur time.Duration, optFns ...func(*NodegroupDeletedWaiterOptions)) (*DescribeNodegroupOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -371,7 +389,7 @@ func (w *NodegroupDeletedWaiter) Wait(ctx context.Context, params *DescribeNodeg } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -399,10 +417,10 @@ func (w *NodegroupDeletedWaiter) Wait(ctx context.Context, params *DescribeNodeg retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -415,16 +433,16 @@ func (w *NodegroupDeletedWaiter) Wait(ctx context.Context, params *DescribeNodeg attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NodegroupDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for NodegroupDeleted waiter") } func nodegroupDeletedStateRetryable(ctx context.Context, input *DescribeNodegroupInput, output *DescribeNodegroupOutput, err error) (bool, error) { diff --git a/service/elasticache/api_op_DescribeCacheClusters.go b/service/elasticache/api_op_DescribeCacheClusters.go index 7709c995a18..5bda712ede6 100644 --- a/service/elasticache/api_op_DescribeCacheClusters.go +++ b/service/elasticache/api_op_DescribeCacheClusters.go @@ -305,8 +305,17 @@ func NewCacheClusterAvailableWaiter(client DescribeCacheClustersAPIClient, optFn // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *CacheClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeCacheClustersInput, maxWaitDur time.Duration, optFns ...func(*CacheClusterAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CacheClusterAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CacheClusterAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeCacheClustersInput, maxWaitDur time.Duration, optFns ...func(*CacheClusterAvailableWaiterOptions)) (*DescribeCacheClustersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -319,7 +328,7 @@ func (w *CacheClusterAvailableWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -347,10 +356,10 @@ func (w *CacheClusterAvailableWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -363,16 +372,16 @@ func (w *CacheClusterAvailableWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CacheClusterAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for CacheClusterAvailable waiter") } func cacheClusterAvailableStateRetryable(ctx context.Context, input *DescribeCacheClustersInput, output *DescribeCacheClustersOutput, err error) (bool, error) { @@ -568,8 +577,17 @@ func NewCacheClusterDeletedWaiter(client DescribeCacheClustersAPIClient, optFns // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *CacheClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCacheClustersInput, maxWaitDur time.Duration, optFns ...func(*CacheClusterDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CacheClusterDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *CacheClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeCacheClustersInput, maxWaitDur time.Duration, optFns ...func(*CacheClusterDeletedWaiterOptions)) (*DescribeCacheClustersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -582,7 +600,7 @@ func (w *CacheClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -610,10 +628,10 @@ func (w *CacheClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -626,16 +644,16 @@ func (w *CacheClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CacheClusterDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for CacheClusterDeleted waiter") } func cacheClusterDeletedStateRetryable(ctx context.Context, input *DescribeCacheClustersInput, output *DescribeCacheClustersOutput, err error) (bool, error) { diff --git a/service/elasticache/api_op_DescribeReplicationGroups.go b/service/elasticache/api_op_DescribeReplicationGroups.go index 8edbfb482e8..79ab71d0d17 100644 --- a/service/elasticache/api_op_DescribeReplicationGroups.go +++ b/service/elasticache/api_op_DescribeReplicationGroups.go @@ -287,8 +287,17 @@ func NewReplicationGroupAvailableWaiter(client DescribeReplicationGroupsAPIClien // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ReplicationGroupAvailableWaiter) Wait(ctx context.Context, params *DescribeReplicationGroupsInput, maxWaitDur time.Duration, optFns ...func(*ReplicationGroupAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationGroupAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationGroupAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationGroupsInput, maxWaitDur time.Duration, optFns ...func(*ReplicationGroupAvailableWaiterOptions)) (*DescribeReplicationGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -301,7 +310,7 @@ func (w *ReplicationGroupAvailableWaiter) Wait(ctx context.Context, params *Desc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -329,10 +338,10 @@ func (w *ReplicationGroupAvailableWaiter) Wait(ctx context.Context, params *Desc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -345,16 +354,16 @@ func (w *ReplicationGroupAvailableWaiter) Wait(ctx context.Context, params *Desc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationGroupAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationGroupAvailable waiter") } func replicationGroupAvailableStateRetryable(ctx context.Context, input *DescribeReplicationGroupsInput, output *DescribeReplicationGroupsOutput, err error) (bool, error) { @@ -479,8 +488,17 @@ func NewReplicationGroupDeletedWaiter(client DescribeReplicationGroupsAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ReplicationGroupDeletedWaiter) Wait(ctx context.Context, params *DescribeReplicationGroupsInput, maxWaitDur time.Duration, optFns ...func(*ReplicationGroupDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ReplicationGroupDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ReplicationGroupDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeReplicationGroupsInput, maxWaitDur time.Duration, optFns ...func(*ReplicationGroupDeletedWaiterOptions)) (*DescribeReplicationGroupsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -493,7 +511,7 @@ func (w *ReplicationGroupDeletedWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -521,10 +539,10 @@ func (w *ReplicationGroupDeletedWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -537,16 +555,16 @@ func (w *ReplicationGroupDeletedWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ReplicationGroupDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ReplicationGroupDeleted waiter") } func replicationGroupDeletedStateRetryable(ctx context.Context, input *DescribeReplicationGroupsInput, output *DescribeReplicationGroupsOutput, err error) (bool, error) { diff --git a/service/elasticbeanstalk/api_op_DescribeEnvironments.go b/service/elasticbeanstalk/api_op_DescribeEnvironments.go index 0f8728b5801..16c7f542ed1 100644 --- a/service/elasticbeanstalk/api_op_DescribeEnvironments.go +++ b/service/elasticbeanstalk/api_op_DescribeEnvironments.go @@ -217,8 +217,17 @@ func NewEnvironmentExistsWaiter(client DescribeEnvironmentsAPIClient, optFns ... // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *EnvironmentExistsWaiter) Wait(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EnvironmentExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *EnvironmentExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentExistsWaiterOptions)) (*DescribeEnvironmentsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -231,7 +240,7 @@ func (w *EnvironmentExistsWaiter) Wait(ctx context.Context, params *DescribeEnvi } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -259,10 +268,10 @@ func (w *EnvironmentExistsWaiter) Wait(ctx context.Context, params *DescribeEnvi retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -275,16 +284,16 @@ func (w *EnvironmentExistsWaiter) Wait(ctx context.Context, params *DescribeEnvi attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EnvironmentExists waiter") + return nil, fmt.Errorf("exceeded max wait time for EnvironmentExists waiter") } func environmentExistsStateRetryable(ctx context.Context, input *DescribeEnvironmentsInput, output *DescribeEnvironmentsOutput, err error) (bool, error) { @@ -416,8 +425,17 @@ func NewEnvironmentTerminatedWaiter(client DescribeEnvironmentsAPIClient, optFns // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *EnvironmentTerminatedWaiter) Wait(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentTerminatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EnvironmentTerminated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *EnvironmentTerminatedWaiter) WaitForOutput(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentTerminatedWaiterOptions)) (*DescribeEnvironmentsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -430,7 +448,7 @@ func (w *EnvironmentTerminatedWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -458,10 +476,10 @@ func (w *EnvironmentTerminatedWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -474,16 +492,16 @@ func (w *EnvironmentTerminatedWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EnvironmentTerminated waiter") + return nil, fmt.Errorf("exceeded max wait time for EnvironmentTerminated waiter") } func environmentTerminatedStateRetryable(ctx context.Context, input *DescribeEnvironmentsInput, output *DescribeEnvironmentsOutput, err error) (bool, error) { @@ -614,8 +632,17 @@ func NewEnvironmentUpdatedWaiter(client DescribeEnvironmentsAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *EnvironmentUpdatedWaiter) Wait(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentUpdatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EnvironmentUpdated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *EnvironmentUpdatedWaiter) WaitForOutput(ctx context.Context, params *DescribeEnvironmentsInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentUpdatedWaiterOptions)) (*DescribeEnvironmentsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -628,7 +655,7 @@ func (w *EnvironmentUpdatedWaiter) Wait(ctx context.Context, params *DescribeEnv } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -656,10 +683,10 @@ func (w *EnvironmentUpdatedWaiter) Wait(ctx context.Context, params *DescribeEnv retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -672,16 +699,16 @@ func (w *EnvironmentUpdatedWaiter) Wait(ctx context.Context, params *DescribeEnv attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EnvironmentUpdated waiter") + return nil, fmt.Errorf("exceeded max wait time for EnvironmentUpdated waiter") } func environmentUpdatedStateRetryable(ctx context.Context, input *DescribeEnvironmentsInput, output *DescribeEnvironmentsOutput, err error) (bool, error) { diff --git a/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go b/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go index f703345b7a7..b1f29ba7b76 100644 --- a/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go +++ b/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go @@ -193,8 +193,17 @@ func NewAnyInstanceInServiceWaiter(client DescribeInstanceHealthAPIClient, optFn // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *AnyInstanceInServiceWaiter) Wait(ctx context.Context, params *DescribeInstanceHealthInput, maxWaitDur time.Duration, optFns ...func(*AnyInstanceInServiceWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AnyInstanceInService waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *AnyInstanceInServiceWaiter) WaitForOutput(ctx context.Context, params *DescribeInstanceHealthInput, maxWaitDur time.Duration, optFns ...func(*AnyInstanceInServiceWaiterOptions)) (*DescribeInstanceHealthOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -207,7 +216,7 @@ func (w *AnyInstanceInServiceWaiter) Wait(ctx context.Context, params *DescribeI } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -235,10 +244,10 @@ func (w *AnyInstanceInServiceWaiter) Wait(ctx context.Context, params *DescribeI retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -251,16 +260,16 @@ func (w *AnyInstanceInServiceWaiter) Wait(ctx context.Context, params *DescribeI attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AnyInstanceInService waiter") + return nil, fmt.Errorf("exceeded max wait time for AnyInstanceInService waiter") } func anyInstanceInServiceStateRetryable(ctx context.Context, input *DescribeInstanceHealthInput, output *DescribeInstanceHealthOutput, err error) (bool, error) { diff --git a/service/elasticloadbalancingv2/api_op_DescribeLoadBalancers.go b/service/elasticloadbalancingv2/api_op_DescribeLoadBalancers.go index 02eabb92246..8b4e28dae1b 100644 --- a/service/elasticloadbalancingv2/api_op_DescribeLoadBalancers.go +++ b/service/elasticloadbalancingv2/api_op_DescribeLoadBalancers.go @@ -263,8 +263,17 @@ func NewLoadBalancerAvailableWaiter(client DescribeLoadBalancersAPIClient, optFn // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *LoadBalancerAvailableWaiter) Wait(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancerAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LoadBalancerAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *LoadBalancerAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancerAvailableWaiterOptions)) (*DescribeLoadBalancersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -277,7 +286,7 @@ func (w *LoadBalancerAvailableWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -305,10 +314,10 @@ func (w *LoadBalancerAvailableWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -321,16 +330,16 @@ func (w *LoadBalancerAvailableWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LoadBalancerAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for LoadBalancerAvailable waiter") } func loadBalancerAvailableStateRetryable(ctx context.Context, input *DescribeLoadBalancersInput, output *DescribeLoadBalancersOutput, err error) (bool, error) { @@ -465,8 +474,17 @@ func NewLoadBalancerExistsWaiter(client DescribeLoadBalancersAPIClient, optFns . // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *LoadBalancerExistsWaiter) Wait(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancerExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LoadBalancerExists waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *LoadBalancerExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancerExistsWaiterOptions)) (*DescribeLoadBalancersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -479,7 +497,7 @@ func (w *LoadBalancerExistsWaiter) Wait(ctx context.Context, params *DescribeLoa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -507,10 +525,10 @@ func (w *LoadBalancerExistsWaiter) Wait(ctx context.Context, params *DescribeLoa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -523,16 +541,16 @@ func (w *LoadBalancerExistsWaiter) Wait(ctx context.Context, params *DescribeLoa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LoadBalancerExists waiter") + return nil, fmt.Errorf("exceeded max wait time for LoadBalancerExists waiter") } func loadBalancerExistsStateRetryable(ctx context.Context, input *DescribeLoadBalancersInput, output *DescribeLoadBalancersOutput, err error) (bool, error) { @@ -616,8 +634,17 @@ func NewLoadBalancersDeletedWaiter(client DescribeLoadBalancersAPIClient, optFns // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *LoadBalancersDeletedWaiter) Wait(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancersDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LoadBalancersDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *LoadBalancersDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeLoadBalancersInput, maxWaitDur time.Duration, optFns ...func(*LoadBalancersDeletedWaiterOptions)) (*DescribeLoadBalancersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -630,7 +657,7 @@ func (w *LoadBalancersDeletedWaiter) Wait(ctx context.Context, params *DescribeL } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -658,10 +685,10 @@ func (w *LoadBalancersDeletedWaiter) Wait(ctx context.Context, params *DescribeL retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -674,16 +701,16 @@ func (w *LoadBalancersDeletedWaiter) Wait(ctx context.Context, params *DescribeL attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LoadBalancersDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for LoadBalancersDeleted waiter") } func loadBalancersDeletedStateRetryable(ctx context.Context, input *DescribeLoadBalancersInput, output *DescribeLoadBalancersOutput, err error) (bool, error) { diff --git a/service/elasticloadbalancingv2/api_op_DescribeTargetHealth.go b/service/elasticloadbalancingv2/api_op_DescribeTargetHealth.go index fd73529d0e8..adc169fac11 100644 --- a/service/elasticloadbalancingv2/api_op_DescribeTargetHealth.go +++ b/service/elasticloadbalancingv2/api_op_DescribeTargetHealth.go @@ -188,8 +188,17 @@ func NewTargetDeregisteredWaiter(client DescribeTargetHealthAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *TargetDeregisteredWaiter) Wait(ctx context.Context, params *DescribeTargetHealthInput, maxWaitDur time.Duration, optFns ...func(*TargetDeregisteredWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TargetDeregistered waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *TargetDeregisteredWaiter) WaitForOutput(ctx context.Context, params *DescribeTargetHealthInput, maxWaitDur time.Duration, optFns ...func(*TargetDeregisteredWaiterOptions)) (*DescribeTargetHealthOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -202,7 +211,7 @@ func (w *TargetDeregisteredWaiter) Wait(ctx context.Context, params *DescribeTar } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -230,10 +239,10 @@ func (w *TargetDeregisteredWaiter) Wait(ctx context.Context, params *DescribeTar retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -246,16 +255,16 @@ func (w *TargetDeregisteredWaiter) Wait(ctx context.Context, params *DescribeTar attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TargetDeregistered waiter") + return nil, fmt.Errorf("exceeded max wait time for TargetDeregistered waiter") } func targetDeregisteredStateRetryable(ctx context.Context, input *DescribeTargetHealthInput, output *DescribeTargetHealthOutput, err error) (bool, error) { @@ -366,8 +375,17 @@ func NewTargetInServiceWaiter(client DescribeTargetHealthAPIClient, optFns ...fu // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *TargetInServiceWaiter) Wait(ctx context.Context, params *DescribeTargetHealthInput, maxWaitDur time.Duration, optFns ...func(*TargetInServiceWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TargetInService waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *TargetInServiceWaiter) WaitForOutput(ctx context.Context, params *DescribeTargetHealthInput, maxWaitDur time.Duration, optFns ...func(*TargetInServiceWaiterOptions)) (*DescribeTargetHealthOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -380,7 +398,7 @@ func (w *TargetInServiceWaiter) Wait(ctx context.Context, params *DescribeTarget } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -408,10 +426,10 @@ func (w *TargetInServiceWaiter) Wait(ctx context.Context, params *DescribeTarget retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -424,16 +442,16 @@ func (w *TargetInServiceWaiter) Wait(ctx context.Context, params *DescribeTarget attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TargetInService waiter") + return nil, fmt.Errorf("exceeded max wait time for TargetInService waiter") } func targetInServiceStateRetryable(ctx context.Context, input *DescribeTargetHealthInput, output *DescribeTargetHealthOutput, err error) (bool, error) { diff --git a/service/elastictranscoder/api_op_ReadJob.go b/service/elastictranscoder/api_op_ReadJob.go index a02471014c8..75b8056950e 100644 --- a/service/elastictranscoder/api_op_ReadJob.go +++ b/service/elastictranscoder/api_op_ReadJob.go @@ -184,8 +184,16 @@ func NewJobCompleteWaiter(client ReadJobAPIClient, optFns ...func(*JobCompleteWa // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *JobCompleteWaiter) Wait(ctx context.Context, params *ReadJobInput, maxWaitDur time.Duration, optFns ...func(*JobCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for JobComplete waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *JobCompleteWaiter) WaitForOutput(ctx context.Context, params *ReadJobInput, maxWaitDur time.Duration, optFns ...func(*JobCompleteWaiterOptions)) (*ReadJobOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -198,7 +206,7 @@ func (w *JobCompleteWaiter) Wait(ctx context.Context, params *ReadJobInput, maxW } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -226,10 +234,10 @@ func (w *JobCompleteWaiter) Wait(ctx context.Context, params *ReadJobInput, maxW retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -242,16 +250,16 @@ func (w *JobCompleteWaiter) Wait(ctx context.Context, params *ReadJobInput, maxW attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for JobComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for JobComplete waiter") } func jobCompleteStateRetryable(ctx context.Context, input *ReadJobInput, output *ReadJobOutput, err error) (bool, error) { diff --git a/service/emr/api_op_DescribeCluster.go b/service/emr/api_op_DescribeCluster.go index 650db3e176a..0dfec043367 100644 --- a/service/emr/api_op_DescribeCluster.go +++ b/service/emr/api_op_DescribeCluster.go @@ -186,8 +186,17 @@ func NewClusterRunningWaiter(client DescribeClusterAPIClient, optFns ...func(*Cl // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterRunningWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterRunning waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterRunningWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -200,7 +209,7 @@ func (w *ClusterRunningWaiter) Wait(ctx context.Context, params *DescribeCluster } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -228,10 +237,10 @@ func (w *ClusterRunningWaiter) Wait(ctx context.Context, params *DescribeCluster retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -244,16 +253,16 @@ func (w *ClusterRunningWaiter) Wait(ctx context.Context, params *DescribeCluster attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterRunning waiter") } func clusterRunningStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { @@ -405,8 +414,17 @@ func NewClusterTerminatedWaiter(client DescribeClusterAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ClusterTerminatedWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterTerminatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterTerminated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterTerminatedWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterTerminatedWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -419,7 +437,7 @@ func (w *ClusterTerminatedWaiter) Wait(ctx context.Context, params *DescribeClus } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -447,10 +465,10 @@ func (w *ClusterTerminatedWaiter) Wait(ctx context.Context, params *DescribeClus retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -463,16 +481,16 @@ func (w *ClusterTerminatedWaiter) Wait(ctx context.Context, params *DescribeClus attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterTerminated waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterTerminated waiter") } func clusterTerminatedStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { diff --git a/service/emr/api_op_DescribeStep.go b/service/emr/api_op_DescribeStep.go index 7b3f9e2914d..f625fbf81ad 100644 --- a/service/emr/api_op_DescribeStep.go +++ b/service/emr/api_op_DescribeStep.go @@ -189,8 +189,16 @@ func NewStepCompleteWaiter(client DescribeStepAPIClient, optFns ...func(*StepCom // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StepCompleteWaiter) Wait(ctx context.Context, params *DescribeStepInput, maxWaitDur time.Duration, optFns ...func(*StepCompleteWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StepComplete waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *StepCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeStepInput, maxWaitDur time.Duration, optFns ...func(*StepCompleteWaiterOptions)) (*DescribeStepOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -203,7 +211,7 @@ func (w *StepCompleteWaiter) Wait(ctx context.Context, params *DescribeStepInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -231,10 +239,10 @@ func (w *StepCompleteWaiter) Wait(ctx context.Context, params *DescribeStepInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -247,16 +255,16 @@ func (w *StepCompleteWaiter) Wait(ctx context.Context, params *DescribeStepInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StepComplete waiter") + return nil, fmt.Errorf("exceeded max wait time for StepComplete waiter") } func stepCompleteStateRetryable(ctx context.Context, input *DescribeStepInput, output *DescribeStepOutput, err error) (bool, error) { diff --git a/service/glacier/api_op_DescribeVault.go b/service/glacier/api_op_DescribeVault.go index 28e1c8d530e..c1a655a61ab 100644 --- a/service/glacier/api_op_DescribeVault.go +++ b/service/glacier/api_op_DescribeVault.go @@ -247,8 +247,16 @@ func NewVaultExistsWaiter(client DescribeVaultAPIClient, optFns ...func(*VaultEx // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VaultExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VaultExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *VaultExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultExistsWaiterOptions)) (*DescribeVaultOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -261,7 +269,7 @@ func (w *VaultExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -289,10 +297,10 @@ func (w *VaultExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -305,16 +313,16 @@ func (w *VaultExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VaultExists waiter") + return nil, fmt.Errorf("exceeded max wait time for VaultExists waiter") } func vaultExistsStateRetryable(ctx context.Context, input *DescribeVaultInput, output *DescribeVaultOutput, err error) (bool, error) { @@ -392,8 +400,17 @@ func NewVaultNotExistsWaiter(client DescribeVaultAPIClient, optFns ...func(*Vaul // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *VaultNotExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for VaultNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *VaultNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultNotExistsWaiterOptions)) (*DescribeVaultOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -406,7 +423,7 @@ func (w *VaultNotExistsWaiter) Wait(ctx context.Context, params *DescribeVaultIn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -434,10 +451,10 @@ func (w *VaultNotExistsWaiter) Wait(ctx context.Context, params *DescribeVaultIn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -450,16 +467,16 @@ func (w *VaultNotExistsWaiter) Wait(ctx context.Context, params *DescribeVaultIn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for VaultNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for VaultNotExists waiter") } func vaultNotExistsStateRetryable(ctx context.Context, input *DescribeVaultInput, output *DescribeVaultOutput, err error) (bool, error) { diff --git a/service/iam/api_op_GetInstanceProfile.go b/service/iam/api_op_GetInstanceProfile.go index 09ce4b389f3..d0cfd113f04 100644 --- a/service/iam/api_op_GetInstanceProfile.go +++ b/service/iam/api_op_GetInstanceProfile.go @@ -194,8 +194,17 @@ func NewInstanceProfileExistsWaiter(client GetInstanceProfileAPIClient, optFns . // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *InstanceProfileExistsWaiter) Wait(ctx context.Context, params *GetInstanceProfileInput, maxWaitDur time.Duration, optFns ...func(*InstanceProfileExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceProfileExists waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *InstanceProfileExistsWaiter) WaitForOutput(ctx context.Context, params *GetInstanceProfileInput, maxWaitDur time.Duration, optFns ...func(*InstanceProfileExistsWaiterOptions)) (*GetInstanceProfileOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -208,7 +217,7 @@ func (w *InstanceProfileExistsWaiter) Wait(ctx context.Context, params *GetInsta } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -236,10 +245,10 @@ func (w *InstanceProfileExistsWaiter) Wait(ctx context.Context, params *GetInsta retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -252,16 +261,16 @@ func (w *InstanceProfileExistsWaiter) Wait(ctx context.Context, params *GetInsta attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceProfileExists waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceProfileExists waiter") } func instanceProfileExistsStateRetryable(ctx context.Context, input *GetInstanceProfileInput, output *GetInstanceProfileOutput, err error) (bool, error) { diff --git a/service/iam/api_op_GetPolicy.go b/service/iam/api_op_GetPolicy.go index 68d6213ea5c..f181ca895f9 100644 --- a/service/iam/api_op_GetPolicy.go +++ b/service/iam/api_op_GetPolicy.go @@ -198,8 +198,16 @@ func NewPolicyExistsWaiter(client GetPolicyAPIClient, optFns ...func(*PolicyExis // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *PolicyExistsWaiter) Wait(ctx context.Context, params *GetPolicyInput, maxWaitDur time.Duration, optFns ...func(*PolicyExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for PolicyExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *PolicyExistsWaiter) WaitForOutput(ctx context.Context, params *GetPolicyInput, maxWaitDur time.Duration, optFns ...func(*PolicyExistsWaiterOptions)) (*GetPolicyOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -212,7 +220,7 @@ func (w *PolicyExistsWaiter) Wait(ctx context.Context, params *GetPolicyInput, m } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -240,10 +248,10 @@ func (w *PolicyExistsWaiter) Wait(ctx context.Context, params *GetPolicyInput, m retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -256,16 +264,16 @@ func (w *PolicyExistsWaiter) Wait(ctx context.Context, params *GetPolicyInput, m attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for PolicyExists waiter") + return nil, fmt.Errorf("exceeded max wait time for PolicyExists waiter") } func policyExistsStateRetryable(ctx context.Context, input *GetPolicyInput, output *GetPolicyOutput, err error) (bool, error) { diff --git a/service/iam/api_op_GetRole.go b/service/iam/api_op_GetRole.go index ef719a17bc9..533cce2b243 100644 --- a/service/iam/api_op_GetRole.go +++ b/service/iam/api_op_GetRole.go @@ -197,8 +197,16 @@ func NewRoleExistsWaiter(client GetRoleAPIClient, optFns ...func(*RoleExistsWait // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *RoleExistsWaiter) Wait(ctx context.Context, params *GetRoleInput, maxWaitDur time.Duration, optFns ...func(*RoleExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for RoleExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *RoleExistsWaiter) WaitForOutput(ctx context.Context, params *GetRoleInput, maxWaitDur time.Duration, optFns ...func(*RoleExistsWaiterOptions)) (*GetRoleOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -211,7 +219,7 @@ func (w *RoleExistsWaiter) Wait(ctx context.Context, params *GetRoleInput, maxWa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -239,10 +247,10 @@ func (w *RoleExistsWaiter) Wait(ctx context.Context, params *GetRoleInput, maxWa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -255,16 +263,16 @@ func (w *RoleExistsWaiter) Wait(ctx context.Context, params *GetRoleInput, maxWa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for RoleExists waiter") + return nil, fmt.Errorf("exceeded max wait time for RoleExists waiter") } func roleExistsStateRetryable(ctx context.Context, input *GetRoleInput, output *GetRoleOutput, err error) (bool, error) { diff --git a/service/iam/api_op_GetUser.go b/service/iam/api_op_GetUser.go index 840375384e3..02f93e5288a 100644 --- a/service/iam/api_op_GetUser.go +++ b/service/iam/api_op_GetUser.go @@ -204,8 +204,16 @@ func NewUserExistsWaiter(client GetUserAPIClient, optFns ...func(*UserExistsWait // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *UserExistsWaiter) Wait(ctx context.Context, params *GetUserInput, maxWaitDur time.Duration, optFns ...func(*UserExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for UserExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *UserExistsWaiter) WaitForOutput(ctx context.Context, params *GetUserInput, maxWaitDur time.Duration, optFns ...func(*UserExistsWaiterOptions)) (*GetUserOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -218,7 +226,7 @@ func (w *UserExistsWaiter) Wait(ctx context.Context, params *GetUserInput, maxWa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -246,10 +254,10 @@ func (w *UserExistsWaiter) Wait(ctx context.Context, params *GetUserInput, maxWa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -262,16 +270,16 @@ func (w *UserExistsWaiter) Wait(ctx context.Context, params *GetUserInput, maxWa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for UserExists waiter") + return nil, fmt.Errorf("exceeded max wait time for UserExists waiter") } func userExistsStateRetryable(ctx context.Context, input *GetUserInput, output *GetUserOutput, err error) (bool, error) { diff --git a/service/iotsitewise/api_op_DescribeAsset.go b/service/iotsitewise/api_op_DescribeAsset.go index 0df04221f17..b61090ed134 100644 --- a/service/iotsitewise/api_op_DescribeAsset.go +++ b/service/iotsitewise/api_op_DescribeAsset.go @@ -264,8 +264,16 @@ func NewAssetActiveWaiter(client DescribeAssetAPIClient, optFns ...func(*AssetAc // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AssetActiveWaiter) Wait(ctx context.Context, params *DescribeAssetInput, maxWaitDur time.Duration, optFns ...func(*AssetActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AssetActive waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *AssetActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeAssetInput, maxWaitDur time.Duration, optFns ...func(*AssetActiveWaiterOptions)) (*DescribeAssetOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -278,7 +286,7 @@ func (w *AssetActiveWaiter) Wait(ctx context.Context, params *DescribeAssetInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -306,10 +314,10 @@ func (w *AssetActiveWaiter) Wait(ctx context.Context, params *DescribeAssetInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -322,16 +330,16 @@ func (w *AssetActiveWaiter) Wait(ctx context.Context, params *DescribeAssetInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AssetActive waiter") + return nil, fmt.Errorf("exceeded max wait time for AssetActive waiter") } func assetActiveStateRetryable(ctx context.Context, input *DescribeAssetInput, output *DescribeAssetOutput, err error) (bool, error) { @@ -432,8 +440,17 @@ func NewAssetNotExistsWaiter(client DescribeAssetAPIClient, optFns ...func(*Asse // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AssetNotExistsWaiter) Wait(ctx context.Context, params *DescribeAssetInput, maxWaitDur time.Duration, optFns ...func(*AssetNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AssetNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *AssetNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAssetInput, maxWaitDur time.Duration, optFns ...func(*AssetNotExistsWaiterOptions)) (*DescribeAssetOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -446,7 +463,7 @@ func (w *AssetNotExistsWaiter) Wait(ctx context.Context, params *DescribeAssetIn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -474,10 +491,10 @@ func (w *AssetNotExistsWaiter) Wait(ctx context.Context, params *DescribeAssetIn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -490,16 +507,16 @@ func (w *AssetNotExistsWaiter) Wait(ctx context.Context, params *DescribeAssetIn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AssetNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for AssetNotExists waiter") } func assetNotExistsStateRetryable(ctx context.Context, input *DescribeAssetInput, output *DescribeAssetOutput, err error) (bool, error) { diff --git a/service/iotsitewise/api_op_DescribeAssetModel.go b/service/iotsitewise/api_op_DescribeAssetModel.go index 114cc7e27cb..7bab15037b8 100644 --- a/service/iotsitewise/api_op_DescribeAssetModel.go +++ b/service/iotsitewise/api_op_DescribeAssetModel.go @@ -267,8 +267,17 @@ func NewAssetModelActiveWaiter(client DescribeAssetModelAPIClient, optFns ...fun // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *AssetModelActiveWaiter) Wait(ctx context.Context, params *DescribeAssetModelInput, maxWaitDur time.Duration, optFns ...func(*AssetModelActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AssetModelActive waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *AssetModelActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeAssetModelInput, maxWaitDur time.Duration, optFns ...func(*AssetModelActiveWaiterOptions)) (*DescribeAssetModelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -281,7 +290,7 @@ func (w *AssetModelActiveWaiter) Wait(ctx context.Context, params *DescribeAsset } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -309,10 +318,10 @@ func (w *AssetModelActiveWaiter) Wait(ctx context.Context, params *DescribeAsset retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -325,16 +334,16 @@ func (w *AssetModelActiveWaiter) Wait(ctx context.Context, params *DescribeAsset attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AssetModelActive waiter") + return nil, fmt.Errorf("exceeded max wait time for AssetModelActive waiter") } func assetModelActiveStateRetryable(ctx context.Context, input *DescribeAssetModelInput, output *DescribeAssetModelOutput, err error) (bool, error) { @@ -436,8 +445,17 @@ func NewAssetModelNotExistsWaiter(client DescribeAssetModelAPIClient, optFns ... // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *AssetModelNotExistsWaiter) Wait(ctx context.Context, params *DescribeAssetModelInput, maxWaitDur time.Duration, optFns ...func(*AssetModelNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AssetModelNotExists waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *AssetModelNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAssetModelInput, maxWaitDur time.Duration, optFns ...func(*AssetModelNotExistsWaiterOptions)) (*DescribeAssetModelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -450,7 +468,7 @@ func (w *AssetModelNotExistsWaiter) Wait(ctx context.Context, params *DescribeAs } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -478,10 +496,10 @@ func (w *AssetModelNotExistsWaiter) Wait(ctx context.Context, params *DescribeAs retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -494,16 +512,16 @@ func (w *AssetModelNotExistsWaiter) Wait(ctx context.Context, params *DescribeAs attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AssetModelNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for AssetModelNotExists waiter") } func assetModelNotExistsStateRetryable(ctx context.Context, input *DescribeAssetModelInput, output *DescribeAssetModelOutput, err error) (bool, error) { diff --git a/service/iotsitewise/api_op_DescribePortal.go b/service/iotsitewise/api_op_DescribePortal.go index 4cca3bb5acb..c0315cb9107 100644 --- a/service/iotsitewise/api_op_DescribePortal.go +++ b/service/iotsitewise/api_op_DescribePortal.go @@ -289,8 +289,16 @@ func NewPortalActiveWaiter(client DescribePortalAPIClient, optFns ...func(*Porta // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *PortalActiveWaiter) Wait(ctx context.Context, params *DescribePortalInput, maxWaitDur time.Duration, optFns ...func(*PortalActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for PortalActive waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *PortalActiveWaiter) WaitForOutput(ctx context.Context, params *DescribePortalInput, maxWaitDur time.Duration, optFns ...func(*PortalActiveWaiterOptions)) (*DescribePortalOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -303,7 +311,7 @@ func (w *PortalActiveWaiter) Wait(ctx context.Context, params *DescribePortalInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -331,10 +339,10 @@ func (w *PortalActiveWaiter) Wait(ctx context.Context, params *DescribePortalInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -347,16 +355,16 @@ func (w *PortalActiveWaiter) Wait(ctx context.Context, params *DescribePortalInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for PortalActive waiter") + return nil, fmt.Errorf("exceeded max wait time for PortalActive waiter") } func portalActiveStateRetryable(ctx context.Context, input *DescribePortalInput, output *DescribePortalOutput, err error) (bool, error) { @@ -440,8 +448,17 @@ func NewPortalNotExistsWaiter(client DescribePortalAPIClient, optFns ...func(*Po // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *PortalNotExistsWaiter) Wait(ctx context.Context, params *DescribePortalInput, maxWaitDur time.Duration, optFns ...func(*PortalNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for PortalNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *PortalNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribePortalInput, maxWaitDur time.Duration, optFns ...func(*PortalNotExistsWaiterOptions)) (*DescribePortalOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -454,7 +471,7 @@ func (w *PortalNotExistsWaiter) Wait(ctx context.Context, params *DescribePortal } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -482,10 +499,10 @@ func (w *PortalNotExistsWaiter) Wait(ctx context.Context, params *DescribePortal retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -498,16 +515,16 @@ func (w *PortalNotExistsWaiter) Wait(ctx context.Context, params *DescribePortal attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for PortalNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for PortalNotExists waiter") } func portalNotExistsStateRetryable(ctx context.Context, input *DescribePortalInput, output *DescribePortalOutput, err error) (bool, error) { diff --git a/service/kinesis/api_op_DescribeStream.go b/service/kinesis/api_op_DescribeStream.go index f0a1243bf32..d2f0b8207d4 100644 --- a/service/kinesis/api_op_DescribeStream.go +++ b/service/kinesis/api_op_DescribeStream.go @@ -211,8 +211,16 @@ func NewStreamExistsWaiter(client DescribeStreamAPIClient, optFns ...func(*Strea // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StreamExistsWaiter) Wait(ctx context.Context, params *DescribeStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *StreamExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamExistsWaiterOptions)) (*DescribeStreamOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -225,7 +233,7 @@ func (w *StreamExistsWaiter) Wait(ctx context.Context, params *DescribeStreamInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -253,10 +261,10 @@ func (w *StreamExistsWaiter) Wait(ctx context.Context, params *DescribeStreamInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -269,16 +277,16 @@ func (w *StreamExistsWaiter) Wait(ctx context.Context, params *DescribeStreamInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamExists waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamExists waiter") } func streamExistsStateRetryable(ctx context.Context, input *DescribeStreamInput, output *DescribeStreamOutput, err error) (bool, error) { @@ -362,8 +370,17 @@ func NewStreamNotExistsWaiter(client DescribeStreamAPIClient, optFns ...func(*St // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StreamNotExistsWaiter) Wait(ctx context.Context, params *DescribeStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *StreamNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamNotExistsWaiterOptions)) (*DescribeStreamOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -376,7 +393,7 @@ func (w *StreamNotExistsWaiter) Wait(ctx context.Context, params *DescribeStream } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -404,10 +421,10 @@ func (w *StreamNotExistsWaiter) Wait(ctx context.Context, params *DescribeStream retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -420,16 +437,16 @@ func (w *StreamNotExistsWaiter) Wait(ctx context.Context, params *DescribeStream attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamNotExists waiter") } func streamNotExistsStateRetryable(ctx context.Context, input *DescribeStreamInput, output *DescribeStreamOutput, err error) (bool, error) { diff --git a/service/lambda/api_op_GetFunction.go b/service/lambda/api_op_GetFunction.go index bc0dc020a1f..46dafc86683 100644 --- a/service/lambda/api_op_GetFunction.go +++ b/service/lambda/api_op_GetFunction.go @@ -211,8 +211,17 @@ func NewFunctionExistsWaiter(client GetFunctionAPIClient, optFns ...func(*Functi // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FunctionExistsWaiter) Wait(ctx context.Context, params *GetFunctionInput, maxWaitDur time.Duration, optFns ...func(*FunctionExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FunctionExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *FunctionExistsWaiter) WaitForOutput(ctx context.Context, params *GetFunctionInput, maxWaitDur time.Duration, optFns ...func(*FunctionExistsWaiterOptions)) (*GetFunctionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -225,7 +234,7 @@ func (w *FunctionExistsWaiter) Wait(ctx context.Context, params *GetFunctionInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -253,10 +262,10 @@ func (w *FunctionExistsWaiter) Wait(ctx context.Context, params *GetFunctionInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -269,16 +278,16 @@ func (w *FunctionExistsWaiter) Wait(ctx context.Context, params *GetFunctionInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FunctionExists waiter") + return nil, fmt.Errorf("exceeded max wait time for FunctionExists waiter") } func functionExistsStateRetryable(ctx context.Context, input *GetFunctionInput, output *GetFunctionOutput, err error) (bool, error) { diff --git a/service/lambda/api_op_GetFunctionConfiguration.go b/service/lambda/api_op_GetFunctionConfiguration.go index 5df7dc69693..45c97971dab 100644 --- a/service/lambda/api_op_GetFunctionConfiguration.go +++ b/service/lambda/api_op_GetFunctionConfiguration.go @@ -309,8 +309,17 @@ func NewFunctionActiveWaiter(client GetFunctionConfigurationAPIClient, optFns .. // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FunctionActiveWaiter) Wait(ctx context.Context, params *GetFunctionConfigurationInput, maxWaitDur time.Duration, optFns ...func(*FunctionActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FunctionActive waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *FunctionActiveWaiter) WaitForOutput(ctx context.Context, params *GetFunctionConfigurationInput, maxWaitDur time.Duration, optFns ...func(*FunctionActiveWaiterOptions)) (*GetFunctionConfigurationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -323,7 +332,7 @@ func (w *FunctionActiveWaiter) Wait(ctx context.Context, params *GetFunctionConf } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -351,10 +360,10 @@ func (w *FunctionActiveWaiter) Wait(ctx context.Context, params *GetFunctionConf retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -367,16 +376,16 @@ func (w *FunctionActiveWaiter) Wait(ctx context.Context, params *GetFunctionConf attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FunctionActive waiter") + return nil, fmt.Errorf("exceeded max wait time for FunctionActive waiter") } func functionActiveStateRetryable(ctx context.Context, input *GetFunctionConfigurationInput, output *GetFunctionConfigurationOutput, err error) (bool, error) { @@ -494,8 +503,17 @@ func NewFunctionUpdatedWaiter(client GetFunctionConfigurationAPIClient, optFns . // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FunctionUpdatedWaiter) Wait(ctx context.Context, params *GetFunctionConfigurationInput, maxWaitDur time.Duration, optFns ...func(*FunctionUpdatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FunctionUpdated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *FunctionUpdatedWaiter) WaitForOutput(ctx context.Context, params *GetFunctionConfigurationInput, maxWaitDur time.Duration, optFns ...func(*FunctionUpdatedWaiterOptions)) (*GetFunctionConfigurationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -508,7 +526,7 @@ func (w *FunctionUpdatedWaiter) Wait(ctx context.Context, params *GetFunctionCon } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -536,10 +554,10 @@ func (w *FunctionUpdatedWaiter) Wait(ctx context.Context, params *GetFunctionCon retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -552,16 +570,16 @@ func (w *FunctionUpdatedWaiter) Wait(ctx context.Context, params *GetFunctionCon attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FunctionUpdated waiter") + return nil, fmt.Errorf("exceeded max wait time for FunctionUpdated waiter") } func functionUpdatedStateRetryable(ctx context.Context, input *GetFunctionConfigurationInput, output *GetFunctionConfigurationOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeBot.go b/service/lexmodelsv2/api_op_DescribeBot.go index 1fc3f8522b3..6ce24f2f7fc 100644 --- a/service/lexmodelsv2/api_op_DescribeBot.go +++ b/service/lexmodelsv2/api_op_DescribeBot.go @@ -209,8 +209,16 @@ func NewBotAvailableWaiter(client DescribeBotAPIClient, optFns ...func(*BotAvail // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *BotAvailableWaiter) Wait(ctx context.Context, params *DescribeBotInput, maxWaitDur time.Duration, optFns ...func(*BotAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotAvailable waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *BotAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeBotInput, maxWaitDur time.Duration, optFns ...func(*BotAvailableWaiterOptions)) (*DescribeBotOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -223,7 +231,7 @@ func (w *BotAvailableWaiter) Wait(ctx context.Context, params *DescribeBotInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -251,10 +259,10 @@ func (w *BotAvailableWaiter) Wait(ctx context.Context, params *DescribeBotInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -267,16 +275,16 @@ func (w *BotAvailableWaiter) Wait(ctx context.Context, params *DescribeBotInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for BotAvailable waiter") } func botAvailableStateRetryable(ctx context.Context, input *DescribeBotInput, output *DescribeBotOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeBotAlias.go b/service/lexmodelsv2/api_op_DescribeBotAlias.go index cc39d071074..32db0fd47a1 100644 --- a/service/lexmodelsv2/api_op_DescribeBotAlias.go +++ b/service/lexmodelsv2/api_op_DescribeBotAlias.go @@ -225,8 +225,17 @@ func NewBotAliasAvailableWaiter(client DescribeBotAliasAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BotAliasAvailableWaiter) Wait(ctx context.Context, params *DescribeBotAliasInput, maxWaitDur time.Duration, optFns ...func(*BotAliasAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotAliasAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *BotAliasAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeBotAliasInput, maxWaitDur time.Duration, optFns ...func(*BotAliasAvailableWaiterOptions)) (*DescribeBotAliasOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -239,7 +248,7 @@ func (w *BotAliasAvailableWaiter) Wait(ctx context.Context, params *DescribeBotA } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -267,10 +276,10 @@ func (w *BotAliasAvailableWaiter) Wait(ctx context.Context, params *DescribeBotA retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -283,16 +292,16 @@ func (w *BotAliasAvailableWaiter) Wait(ctx context.Context, params *DescribeBotA attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotAliasAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for BotAliasAvailable waiter") } func botAliasAvailableStateRetryable(ctx context.Context, input *DescribeBotAliasInput, output *DescribeBotAliasOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeBotLocale.go b/service/lexmodelsv2/api_op_DescribeBotLocale.go index 39f56ad5f81..3a8f4a2706d 100644 --- a/service/lexmodelsv2/api_op_DescribeBotLocale.go +++ b/service/lexmodelsv2/api_op_DescribeBotLocale.go @@ -242,8 +242,17 @@ func NewBotLocaleBuiltWaiter(client DescribeBotLocaleAPIClient, optFns ...func(* // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *BotLocaleBuiltWaiter) Wait(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleBuiltWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotLocaleBuilt waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *BotLocaleBuiltWaiter) WaitForOutput(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleBuiltWaiterOptions)) (*DescribeBotLocaleOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -256,7 +265,7 @@ func (w *BotLocaleBuiltWaiter) Wait(ctx context.Context, params *DescribeBotLoca } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -284,10 +293,10 @@ func (w *BotLocaleBuiltWaiter) Wait(ctx context.Context, params *DescribeBotLoca retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -300,16 +309,16 @@ func (w *BotLocaleBuiltWaiter) Wait(ctx context.Context, params *DescribeBotLoca attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotLocaleBuilt waiter") + return nil, fmt.Errorf("exceeded max wait time for BotLocaleBuilt waiter") } func botLocaleBuiltStateRetryable(ctx context.Context, input *DescribeBotLocaleInput, output *DescribeBotLocaleOutput, err error) (bool, error) { @@ -444,8 +453,17 @@ func NewBotLocaleCreatedWaiter(client DescribeBotLocaleAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BotLocaleCreatedWaiter) Wait(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotLocaleCreated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *BotLocaleCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleCreatedWaiterOptions)) (*DescribeBotLocaleOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -458,7 +476,7 @@ func (w *BotLocaleCreatedWaiter) Wait(ctx context.Context, params *DescribeBotLo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -486,10 +504,10 @@ func (w *BotLocaleCreatedWaiter) Wait(ctx context.Context, params *DescribeBotLo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -502,16 +520,16 @@ func (w *BotLocaleCreatedWaiter) Wait(ctx context.Context, params *DescribeBotLo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotLocaleCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for BotLocaleCreated waiter") } func botLocaleCreatedStateRetryable(ctx context.Context, input *DescribeBotLocaleInput, output *DescribeBotLocaleOutput, err error) (bool, error) { @@ -668,8 +686,17 @@ func NewBotLocaleExpressTestingAvailableWaiter(client DescribeBotLocaleAPIClient // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *BotLocaleExpressTestingAvailableWaiter) Wait(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleExpressTestingAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotLocaleExpressTestingAvailable +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *BotLocaleExpressTestingAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeBotLocaleInput, maxWaitDur time.Duration, optFns ...func(*BotLocaleExpressTestingAvailableWaiterOptions)) (*DescribeBotLocaleOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -682,7 +709,7 @@ func (w *BotLocaleExpressTestingAvailableWaiter) Wait(ctx context.Context, param } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -710,10 +737,10 @@ func (w *BotLocaleExpressTestingAvailableWaiter) Wait(ctx context.Context, param retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -726,16 +753,16 @@ func (w *BotLocaleExpressTestingAvailableWaiter) Wait(ctx context.Context, param attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotLocaleExpressTestingAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for BotLocaleExpressTestingAvailable waiter") } func botLocaleExpressTestingAvailableStateRetryable(ctx context.Context, input *DescribeBotLocaleInput, output *DescribeBotLocaleOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeBotVersion.go b/service/lexmodelsv2/api_op_DescribeBotVersion.go index c97cc57a242..7528148364e 100644 --- a/service/lexmodelsv2/api_op_DescribeBotVersion.go +++ b/service/lexmodelsv2/api_op_DescribeBotVersion.go @@ -221,8 +221,17 @@ func NewBotVersionAvailableWaiter(client DescribeBotVersionAPIClient, optFns ... // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BotVersionAvailableWaiter) Wait(ctx context.Context, params *DescribeBotVersionInput, maxWaitDur time.Duration, optFns ...func(*BotVersionAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotVersionAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *BotVersionAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeBotVersionInput, maxWaitDur time.Duration, optFns ...func(*BotVersionAvailableWaiterOptions)) (*DescribeBotVersionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -235,7 +244,7 @@ func (w *BotVersionAvailableWaiter) Wait(ctx context.Context, params *DescribeBo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -263,10 +272,10 @@ func (w *BotVersionAvailableWaiter) Wait(ctx context.Context, params *DescribeBo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -279,16 +288,16 @@ func (w *BotVersionAvailableWaiter) Wait(ctx context.Context, params *DescribeBo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotVersionAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for BotVersionAvailable waiter") } func botVersionAvailableStateRetryable(ctx context.Context, input *DescribeBotVersionInput, output *DescribeBotVersionOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeExport.go b/service/lexmodelsv2/api_op_DescribeExport.go index 733e552c81e..eb3a8855510 100644 --- a/service/lexmodelsv2/api_op_DescribeExport.go +++ b/service/lexmodelsv2/api_op_DescribeExport.go @@ -207,8 +207,17 @@ func NewBotExportCompletedWaiter(client DescribeExportAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BotExportCompletedWaiter) Wait(ctx context.Context, params *DescribeExportInput, maxWaitDur time.Duration, optFns ...func(*BotExportCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotExportCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *BotExportCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeExportInput, maxWaitDur time.Duration, optFns ...func(*BotExportCompletedWaiterOptions)) (*DescribeExportOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -221,7 +230,7 @@ func (w *BotExportCompletedWaiter) Wait(ctx context.Context, params *DescribeExp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -249,10 +258,10 @@ func (w *BotExportCompletedWaiter) Wait(ctx context.Context, params *DescribeExp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -265,16 +274,16 @@ func (w *BotExportCompletedWaiter) Wait(ctx context.Context, params *DescribeExp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotExportCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for BotExportCompleted waiter") } func botExportCompletedStateRetryable(ctx context.Context, input *DescribeExportInput, output *DescribeExportOutput, err error) (bool, error) { diff --git a/service/lexmodelsv2/api_op_DescribeImport.go b/service/lexmodelsv2/api_op_DescribeImport.go index 741ffe2802a..a01357f24f2 100644 --- a/service/lexmodelsv2/api_op_DescribeImport.go +++ b/service/lexmodelsv2/api_op_DescribeImport.go @@ -212,8 +212,17 @@ func NewBotImportCompletedWaiter(client DescribeImportAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *BotImportCompletedWaiter) Wait(ctx context.Context, params *DescribeImportInput, maxWaitDur time.Duration, optFns ...func(*BotImportCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BotImportCompleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *BotImportCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeImportInput, maxWaitDur time.Duration, optFns ...func(*BotImportCompletedWaiterOptions)) (*DescribeImportOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -226,7 +235,7 @@ func (w *BotImportCompletedWaiter) Wait(ctx context.Context, params *DescribeImp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -254,10 +263,10 @@ func (w *BotImportCompletedWaiter) Wait(ctx context.Context, params *DescribeImp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -270,16 +279,16 @@ func (w *BotImportCompletedWaiter) Wait(ctx context.Context, params *DescribeImp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BotImportCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for BotImportCompleted waiter") } func botImportCompletedStateRetryable(ctx context.Context, input *DescribeImportInput, output *DescribeImportOutput, err error) (bool, error) { diff --git a/service/machinelearning/api_op_DescribeBatchPredictions.go b/service/machinelearning/api_op_DescribeBatchPredictions.go index 7d8ec0c3d6c..3e123fe44a2 100644 --- a/service/machinelearning/api_op_DescribeBatchPredictions.go +++ b/service/machinelearning/api_op_DescribeBatchPredictions.go @@ -349,8 +349,17 @@ func NewBatchPredictionAvailableWaiter(client DescribeBatchPredictionsAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *BatchPredictionAvailableWaiter) Wait(ctx context.Context, params *DescribeBatchPredictionsInput, maxWaitDur time.Duration, optFns ...func(*BatchPredictionAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BatchPredictionAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *BatchPredictionAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeBatchPredictionsInput, maxWaitDur time.Duration, optFns ...func(*BatchPredictionAvailableWaiterOptions)) (*DescribeBatchPredictionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -363,7 +372,7 @@ func (w *BatchPredictionAvailableWaiter) Wait(ctx context.Context, params *Descr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -391,10 +400,10 @@ func (w *BatchPredictionAvailableWaiter) Wait(ctx context.Context, params *Descr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -407,16 +416,16 @@ func (w *BatchPredictionAvailableWaiter) Wait(ctx context.Context, params *Descr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BatchPredictionAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for BatchPredictionAvailable waiter") } func batchPredictionAvailableStateRetryable(ctx context.Context, input *DescribeBatchPredictionsInput, output *DescribeBatchPredictionsOutput, err error) (bool, error) { diff --git a/service/machinelearning/api_op_DescribeDataSources.go b/service/machinelearning/api_op_DescribeDataSources.go index eaa426d3d10..8372e1baa8b 100644 --- a/service/machinelearning/api_op_DescribeDataSources.go +++ b/service/machinelearning/api_op_DescribeDataSources.go @@ -337,8 +337,17 @@ func NewDataSourceAvailableWaiter(client DescribeDataSourcesAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DataSourceAvailableWaiter) Wait(ctx context.Context, params *DescribeDataSourcesInput, maxWaitDur time.Duration, optFns ...func(*DataSourceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DataSourceAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DataSourceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDataSourcesInput, maxWaitDur time.Duration, optFns ...func(*DataSourceAvailableWaiterOptions)) (*DescribeDataSourcesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -351,7 +360,7 @@ func (w *DataSourceAvailableWaiter) Wait(ctx context.Context, params *DescribeDa } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -379,10 +388,10 @@ func (w *DataSourceAvailableWaiter) Wait(ctx context.Context, params *DescribeDa retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -395,16 +404,16 @@ func (w *DataSourceAvailableWaiter) Wait(ctx context.Context, params *DescribeDa attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DataSourceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DataSourceAvailable waiter") } func dataSourceAvailableStateRetryable(ctx context.Context, input *DescribeDataSourcesInput, output *DescribeDataSourcesOutput, err error) (bool, error) { diff --git a/service/machinelearning/api_op_DescribeEvaluations.go b/service/machinelearning/api_op_DescribeEvaluations.go index 4a79230c1e6..3e26271b68f 100644 --- a/service/machinelearning/api_op_DescribeEvaluations.go +++ b/service/machinelearning/api_op_DescribeEvaluations.go @@ -344,8 +344,17 @@ func NewEvaluationAvailableWaiter(client DescribeEvaluationsAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *EvaluationAvailableWaiter) Wait(ctx context.Context, params *DescribeEvaluationsInput, maxWaitDur time.Duration, optFns ...func(*EvaluationAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EvaluationAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *EvaluationAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeEvaluationsInput, maxWaitDur time.Duration, optFns ...func(*EvaluationAvailableWaiterOptions)) (*DescribeEvaluationsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -358,7 +367,7 @@ func (w *EvaluationAvailableWaiter) Wait(ctx context.Context, params *DescribeEv } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -386,10 +395,10 @@ func (w *EvaluationAvailableWaiter) Wait(ctx context.Context, params *DescribeEv retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -402,16 +411,16 @@ func (w *EvaluationAvailableWaiter) Wait(ctx context.Context, params *DescribeEv attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EvaluationAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for EvaluationAvailable waiter") } func evaluationAvailableStateRetryable(ctx context.Context, input *DescribeEvaluationsInput, output *DescribeEvaluationsOutput, err error) (bool, error) { diff --git a/service/machinelearning/api_op_DescribeMLModels.go b/service/machinelearning/api_op_DescribeMLModels.go index 69ecc1d1aaa..69b70213ed3 100644 --- a/service/machinelearning/api_op_DescribeMLModels.go +++ b/service/machinelearning/api_op_DescribeMLModels.go @@ -348,8 +348,17 @@ func NewMLModelAvailableWaiter(client DescribeMLModelsAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *MLModelAvailableWaiter) Wait(ctx context.Context, params *DescribeMLModelsInput, maxWaitDur time.Duration, optFns ...func(*MLModelAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for MLModelAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *MLModelAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeMLModelsInput, maxWaitDur time.Duration, optFns ...func(*MLModelAvailableWaiterOptions)) (*DescribeMLModelsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -362,7 +371,7 @@ func (w *MLModelAvailableWaiter) Wait(ctx context.Context, params *DescribeMLMod } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -390,10 +399,10 @@ func (w *MLModelAvailableWaiter) Wait(ctx context.Context, params *DescribeMLMod retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -406,16 +415,16 @@ func (w *MLModelAvailableWaiter) Wait(ctx context.Context, params *DescribeMLMod attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for MLModelAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for MLModelAvailable waiter") } func mLModelAvailableStateRetryable(ctx context.Context, input *DescribeMLModelsInput, output *DescribeMLModelsOutput, err error) (bool, error) { diff --git a/service/mediaconnect/api_op_DescribeFlow.go b/service/mediaconnect/api_op_DescribeFlow.go index 8890eb632ed..73ea5271202 100644 --- a/service/mediaconnect/api_op_DescribeFlow.go +++ b/service/mediaconnect/api_op_DescribeFlow.go @@ -188,8 +188,16 @@ func NewFlowActiveWaiter(client DescribeFlowAPIClient, optFns ...func(*FlowActiv // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FlowActiveWaiter) Wait(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FlowActive waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *FlowActiveWaiter) WaitForOutput(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowActiveWaiterOptions)) (*DescribeFlowOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -202,7 +210,7 @@ func (w *FlowActiveWaiter) Wait(ctx context.Context, params *DescribeFlowInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -230,10 +238,10 @@ func (w *FlowActiveWaiter) Wait(ctx context.Context, params *DescribeFlowInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -246,16 +254,16 @@ func (w *FlowActiveWaiter) Wait(ctx context.Context, params *DescribeFlowInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FlowActive waiter") + return nil, fmt.Errorf("exceeded max wait time for FlowActive waiter") } func flowActiveStateRetryable(ctx context.Context, input *DescribeFlowInput, output *DescribeFlowOutput, err error) (bool, error) { @@ -404,8 +412,16 @@ func NewFlowDeletedWaiter(client DescribeFlowAPIClient, optFns ...func(*FlowDele // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FlowDeletedWaiter) Wait(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FlowDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *FlowDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowDeletedWaiterOptions)) (*DescribeFlowOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -418,7 +434,7 @@ func (w *FlowDeletedWaiter) Wait(ctx context.Context, params *DescribeFlowInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -446,10 +462,10 @@ func (w *FlowDeletedWaiter) Wait(ctx context.Context, params *DescribeFlowInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -462,16 +478,16 @@ func (w *FlowDeletedWaiter) Wait(ctx context.Context, params *DescribeFlowInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FlowDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for FlowDeleted waiter") } func flowDeletedStateRetryable(ctx context.Context, input *DescribeFlowInput, output *DescribeFlowOutput, err error) (bool, error) { @@ -593,8 +609,16 @@ func NewFlowStandbyWaiter(client DescribeFlowAPIClient, optFns ...func(*FlowStan // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *FlowStandbyWaiter) Wait(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowStandbyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for FlowStandby waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *FlowStandbyWaiter) WaitForOutput(ctx context.Context, params *DescribeFlowInput, maxWaitDur time.Duration, optFns ...func(*FlowStandbyWaiterOptions)) (*DescribeFlowOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -607,7 +631,7 @@ func (w *FlowStandbyWaiter) Wait(ctx context.Context, params *DescribeFlowInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -635,10 +659,10 @@ func (w *FlowStandbyWaiter) Wait(ctx context.Context, params *DescribeFlowInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -651,16 +675,16 @@ func (w *FlowStandbyWaiter) Wait(ctx context.Context, params *DescribeFlowInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for FlowStandby waiter") + return nil, fmt.Errorf("exceeded max wait time for FlowStandby waiter") } func flowStandbyStateRetryable(ctx context.Context, input *DescribeFlowInput, output *DescribeFlowOutput, err error) (bool, error) { diff --git a/service/medialive/api_op_DescribeChannel.go b/service/medialive/api_op_DescribeChannel.go index d35724d9f7e..b9a37c538a9 100644 --- a/service/medialive/api_op_DescribeChannel.go +++ b/service/medialive/api_op_DescribeChannel.go @@ -237,8 +237,17 @@ func NewChannelCreatedWaiter(client DescribeChannelAPIClient, optFns ...func(*Ch // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ChannelCreatedWaiter) Wait(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ChannelCreated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ChannelCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelCreatedWaiterOptions)) (*DescribeChannelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -251,7 +260,7 @@ func (w *ChannelCreatedWaiter) Wait(ctx context.Context, params *DescribeChannel } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -279,10 +288,10 @@ func (w *ChannelCreatedWaiter) Wait(ctx context.Context, params *DescribeChannel retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -295,16 +304,16 @@ func (w *ChannelCreatedWaiter) Wait(ctx context.Context, params *DescribeChannel attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ChannelCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ChannelCreated waiter") } func channelCreatedStateRetryable(ctx context.Context, input *DescribeChannelInput, output *DescribeChannelOutput, err error) (bool, error) { @@ -429,8 +438,17 @@ func NewChannelDeletedWaiter(client DescribeChannelAPIClient, optFns ...func(*Ch // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ChannelDeletedWaiter) Wait(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ChannelDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ChannelDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelDeletedWaiterOptions)) (*DescribeChannelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -443,7 +461,7 @@ func (w *ChannelDeletedWaiter) Wait(ctx context.Context, params *DescribeChannel } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -471,10 +489,10 @@ func (w *ChannelDeletedWaiter) Wait(ctx context.Context, params *DescribeChannel retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -487,16 +505,16 @@ func (w *ChannelDeletedWaiter) Wait(ctx context.Context, params *DescribeChannel attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ChannelDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ChannelDeleted waiter") } func channelDeletedStateRetryable(ctx context.Context, input *DescribeChannelInput, output *DescribeChannelOutput, err error) (bool, error) { @@ -604,8 +622,17 @@ func NewChannelRunningWaiter(client DescribeChannelAPIClient, optFns ...func(*Ch // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ChannelRunningWaiter) Wait(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ChannelRunning waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ChannelRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelRunningWaiterOptions)) (*DescribeChannelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -618,7 +645,7 @@ func (w *ChannelRunningWaiter) Wait(ctx context.Context, params *DescribeChannel } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -646,10 +673,10 @@ func (w *ChannelRunningWaiter) Wait(ctx context.Context, params *DescribeChannel retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -662,16 +689,16 @@ func (w *ChannelRunningWaiter) Wait(ctx context.Context, params *DescribeChannel attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ChannelRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for ChannelRunning waiter") } func channelRunningStateRetryable(ctx context.Context, input *DescribeChannelInput, output *DescribeChannelOutput, err error) (bool, error) { @@ -779,8 +806,17 @@ func NewChannelStoppedWaiter(client DescribeChannelAPIClient, optFns ...func(*Ch // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ChannelStoppedWaiter) Wait(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ChannelStopped waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ChannelStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeChannelInput, maxWaitDur time.Duration, optFns ...func(*ChannelStoppedWaiterOptions)) (*DescribeChannelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -793,7 +829,7 @@ func (w *ChannelStoppedWaiter) Wait(ctx context.Context, params *DescribeChannel } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -821,10 +857,10 @@ func (w *ChannelStoppedWaiter) Wait(ctx context.Context, params *DescribeChannel retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -837,16 +873,16 @@ func (w *ChannelStoppedWaiter) Wait(ctx context.Context, params *DescribeChannel attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ChannelStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for ChannelStopped waiter") } func channelStoppedStateRetryable(ctx context.Context, input *DescribeChannelInput, output *DescribeChannelOutput, err error) (bool, error) { diff --git a/service/medialive/api_op_DescribeInput.go b/service/medialive/api_op_DescribeInput.go index 7ef286a9bb8..cf1063b1be9 100644 --- a/service/medialive/api_op_DescribeInput.go +++ b/service/medialive/api_op_DescribeInput.go @@ -240,8 +240,16 @@ func NewInputAttachedWaiter(client DescribeInputAPIClient, optFns ...func(*Input // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InputAttachedWaiter) Wait(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputAttachedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InputAttached waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *InputAttachedWaiter) WaitForOutput(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputAttachedWaiterOptions)) (*DescribeInputOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -254,7 +262,7 @@ func (w *InputAttachedWaiter) Wait(ctx context.Context, params *DescribeInputInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -282,10 +290,10 @@ func (w *InputAttachedWaiter) Wait(ctx context.Context, params *DescribeInputInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -298,16 +306,16 @@ func (w *InputAttachedWaiter) Wait(ctx context.Context, params *DescribeInputInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InputAttached waiter") + return nil, fmt.Errorf("exceeded max wait time for InputAttached waiter") } func inputAttachedStateRetryable(ctx context.Context, input *DescribeInputInput, output *DescribeInputOutput, err error) (bool, error) { @@ -415,8 +423,16 @@ func NewInputDeletedWaiter(client DescribeInputAPIClient, optFns ...func(*InputD // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InputDeletedWaiter) Wait(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InputDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *InputDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputDeletedWaiterOptions)) (*DescribeInputOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -429,7 +445,7 @@ func (w *InputDeletedWaiter) Wait(ctx context.Context, params *DescribeInputInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -457,10 +473,10 @@ func (w *InputDeletedWaiter) Wait(ctx context.Context, params *DescribeInputInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -473,16 +489,16 @@ func (w *InputDeletedWaiter) Wait(ctx context.Context, params *DescribeInputInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InputDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for InputDeleted waiter") } func inputDeletedStateRetryable(ctx context.Context, input *DescribeInputInput, output *DescribeInputOutput, err error) (bool, error) { @@ -590,8 +606,16 @@ func NewInputDetachedWaiter(client DescribeInputAPIClient, optFns ...func(*Input // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InputDetachedWaiter) Wait(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputDetachedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InputDetached waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *InputDetachedWaiter) WaitForOutput(ctx context.Context, params *DescribeInputInput, maxWaitDur time.Duration, optFns ...func(*InputDetachedWaiterOptions)) (*DescribeInputOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -604,7 +628,7 @@ func (w *InputDetachedWaiter) Wait(ctx context.Context, params *DescribeInputInp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -632,10 +656,10 @@ func (w *InputDetachedWaiter) Wait(ctx context.Context, params *DescribeInputInp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -648,16 +672,16 @@ func (w *InputDetachedWaiter) Wait(ctx context.Context, params *DescribeInputInp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InputDetached waiter") + return nil, fmt.Errorf("exceeded max wait time for InputDetached waiter") } func inputDetachedStateRetryable(ctx context.Context, input *DescribeInputInput, output *DescribeInputOutput, err error) (bool, error) { diff --git a/service/medialive/api_op_DescribeMultiplex.go b/service/medialive/api_op_DescribeMultiplex.go index d7345c1348e..4780aee79e8 100644 --- a/service/medialive/api_op_DescribeMultiplex.go +++ b/service/medialive/api_op_DescribeMultiplex.go @@ -213,8 +213,17 @@ func NewMultiplexCreatedWaiter(client DescribeMultiplexAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *MultiplexCreatedWaiter) Wait(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for MultiplexCreated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *MultiplexCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexCreatedWaiterOptions)) (*DescribeMultiplexOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -227,7 +236,7 @@ func (w *MultiplexCreatedWaiter) Wait(ctx context.Context, params *DescribeMulti } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -255,10 +264,10 @@ func (w *MultiplexCreatedWaiter) Wait(ctx context.Context, params *DescribeMulti retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -271,16 +280,16 @@ func (w *MultiplexCreatedWaiter) Wait(ctx context.Context, params *DescribeMulti attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for MultiplexCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for MultiplexCreated waiter") } func multiplexCreatedStateRetryable(ctx context.Context, input *DescribeMultiplexInput, output *DescribeMultiplexOutput, err error) (bool, error) { @@ -405,8 +414,17 @@ func NewMultiplexDeletedWaiter(client DescribeMultiplexAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *MultiplexDeletedWaiter) Wait(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for MultiplexDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *MultiplexDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexDeletedWaiterOptions)) (*DescribeMultiplexOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -419,7 +437,7 @@ func (w *MultiplexDeletedWaiter) Wait(ctx context.Context, params *DescribeMulti } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -447,10 +465,10 @@ func (w *MultiplexDeletedWaiter) Wait(ctx context.Context, params *DescribeMulti retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -463,16 +481,16 @@ func (w *MultiplexDeletedWaiter) Wait(ctx context.Context, params *DescribeMulti attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for MultiplexDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for MultiplexDeleted waiter") } func multiplexDeletedStateRetryable(ctx context.Context, input *DescribeMultiplexInput, output *DescribeMultiplexOutput, err error) (bool, error) { @@ -580,8 +598,17 @@ func NewMultiplexRunningWaiter(client DescribeMultiplexAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *MultiplexRunningWaiter) Wait(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for MultiplexRunning waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *MultiplexRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexRunningWaiterOptions)) (*DescribeMultiplexOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -594,7 +621,7 @@ func (w *MultiplexRunningWaiter) Wait(ctx context.Context, params *DescribeMulti } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -622,10 +649,10 @@ func (w *MultiplexRunningWaiter) Wait(ctx context.Context, params *DescribeMulti retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -638,16 +665,16 @@ func (w *MultiplexRunningWaiter) Wait(ctx context.Context, params *DescribeMulti attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for MultiplexRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for MultiplexRunning waiter") } func multiplexRunningStateRetryable(ctx context.Context, input *DescribeMultiplexInput, output *DescribeMultiplexOutput, err error) (bool, error) { @@ -755,8 +782,17 @@ func NewMultiplexStoppedWaiter(client DescribeMultiplexAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *MultiplexStoppedWaiter) Wait(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for MultiplexStopped waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *MultiplexStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeMultiplexInput, maxWaitDur time.Duration, optFns ...func(*MultiplexStoppedWaiterOptions)) (*DescribeMultiplexOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -769,7 +805,7 @@ func (w *MultiplexStoppedWaiter) Wait(ctx context.Context, params *DescribeMulti } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -797,10 +833,10 @@ func (w *MultiplexStoppedWaiter) Wait(ctx context.Context, params *DescribeMulti retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -813,16 +849,16 @@ func (w *MultiplexStoppedWaiter) Wait(ctx context.Context, params *DescribeMulti attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for MultiplexStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for MultiplexStopped waiter") } func multiplexStoppedStateRetryable(ctx context.Context, input *DescribeMultiplexInput, output *DescribeMultiplexOutput, err error) (bool, error) { diff --git a/service/neptune/api_op_DescribeDBInstances.go b/service/neptune/api_op_DescribeDBInstances.go index c0a3f12044a..9b402f510b3 100644 --- a/service/neptune/api_op_DescribeDBInstances.go +++ b/service/neptune/api_op_DescribeDBInstances.go @@ -305,8 +305,17 @@ func NewDBInstanceAvailableWaiter(client DescribeDBInstancesAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBInstanceAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBInstanceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) (*DescribeDBInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -319,7 +328,7 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -347,10 +356,10 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -363,16 +372,16 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") } func dBInstanceAvailableStateRetryable(ctx context.Context, input *DescribeDBInstancesInput, output *DescribeDBInstancesOutput, err error) (bool, error) { @@ -591,8 +600,17 @@ func NewDBInstanceDeletedWaiter(client DescribeDBInstancesAPIClient, optFns ...f // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBInstanceDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *DBInstanceDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceDeletedWaiterOptions)) (*DescribeDBInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -605,7 +623,7 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -633,10 +651,10 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -649,16 +667,16 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBInstanceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for DBInstanceDeleted waiter") } func dBInstanceDeletedStateRetryable(ctx context.Context, input *DescribeDBInstancesInput, output *DescribeDBInstancesOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetLaunchProfile.go b/service/nimble/api_op_GetLaunchProfile.go index 339b51cb195..ead6cd21d38 100644 --- a/service/nimble/api_op_GetLaunchProfile.go +++ b/service/nimble/api_op_GetLaunchProfile.go @@ -189,8 +189,17 @@ func NewLaunchProfileReadyWaiter(client GetLaunchProfileAPIClient, optFns ...fun // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *LaunchProfileReadyWaiter) Wait(ctx context.Context, params *GetLaunchProfileInput, maxWaitDur time.Duration, optFns ...func(*LaunchProfileReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LaunchProfileReady waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *LaunchProfileReadyWaiter) WaitForOutput(ctx context.Context, params *GetLaunchProfileInput, maxWaitDur time.Duration, optFns ...func(*LaunchProfileReadyWaiterOptions)) (*GetLaunchProfileOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -203,7 +212,7 @@ func (w *LaunchProfileReadyWaiter) Wait(ctx context.Context, params *GetLaunchPr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -231,10 +240,10 @@ func (w *LaunchProfileReadyWaiter) Wait(ctx context.Context, params *GetLaunchPr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -247,16 +256,16 @@ func (w *LaunchProfileReadyWaiter) Wait(ctx context.Context, params *GetLaunchPr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LaunchProfileReady waiter") + return nil, fmt.Errorf("exceeded max wait time for LaunchProfileReady waiter") } func launchProfileReadyStateRetryable(ctx context.Context, input *GetLaunchProfileInput, output *GetLaunchProfileOutput, err error) (bool, error) { @@ -375,8 +384,17 @@ func NewLaunchProfileDeletedWaiter(client GetLaunchProfileAPIClient, optFns ...f // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *LaunchProfileDeletedWaiter) Wait(ctx context.Context, params *GetLaunchProfileInput, maxWaitDur time.Duration, optFns ...func(*LaunchProfileDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for LaunchProfileDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *LaunchProfileDeletedWaiter) WaitForOutput(ctx context.Context, params *GetLaunchProfileInput, maxWaitDur time.Duration, optFns ...func(*LaunchProfileDeletedWaiterOptions)) (*GetLaunchProfileOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -389,7 +407,7 @@ func (w *LaunchProfileDeletedWaiter) Wait(ctx context.Context, params *GetLaunch } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -417,10 +435,10 @@ func (w *LaunchProfileDeletedWaiter) Wait(ctx context.Context, params *GetLaunch retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -433,16 +451,16 @@ func (w *LaunchProfileDeletedWaiter) Wait(ctx context.Context, params *GetLaunch attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for LaunchProfileDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for LaunchProfileDeleted waiter") } func launchProfileDeletedStateRetryable(ctx context.Context, input *GetLaunchProfileInput, output *GetLaunchProfileOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetStreamingImage.go b/service/nimble/api_op_GetStreamingImage.go index 347c671160b..6e40e6d13e8 100644 --- a/service/nimble/api_op_GetStreamingImage.go +++ b/service/nimble/api_op_GetStreamingImage.go @@ -190,8 +190,17 @@ func NewStreamingImageReadyWaiter(client GetStreamingImageAPIClient, optFns ...f // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *StreamingImageReadyWaiter) Wait(ctx context.Context, params *GetStreamingImageInput, maxWaitDur time.Duration, optFns ...func(*StreamingImageReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingImageReady waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StreamingImageReadyWaiter) WaitForOutput(ctx context.Context, params *GetStreamingImageInput, maxWaitDur time.Duration, optFns ...func(*StreamingImageReadyWaiterOptions)) (*GetStreamingImageOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *StreamingImageReadyWaiter) Wait(ctx context.Context, params *GetStreami } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *StreamingImageReadyWaiter) Wait(ctx context.Context, params *GetStreami retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *StreamingImageReadyWaiter) Wait(ctx context.Context, params *GetStreami attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingImageReady waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingImageReady waiter") } func streamingImageReadyStateRetryable(ctx context.Context, input *GetStreamingImageInput, output *GetStreamingImageOutput, err error) (bool, error) { @@ -376,8 +385,17 @@ func NewStreamingImageDeletedWaiter(client GetStreamingImageAPIClient, optFns .. // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *StreamingImageDeletedWaiter) Wait(ctx context.Context, params *GetStreamingImageInput, maxWaitDur time.Duration, optFns ...func(*StreamingImageDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingImageDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StreamingImageDeletedWaiter) WaitForOutput(ctx context.Context, params *GetStreamingImageInput, maxWaitDur time.Duration, optFns ...func(*StreamingImageDeletedWaiterOptions)) (*GetStreamingImageOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -390,7 +408,7 @@ func (w *StreamingImageDeletedWaiter) Wait(ctx context.Context, params *GetStrea } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -418,10 +436,10 @@ func (w *StreamingImageDeletedWaiter) Wait(ctx context.Context, params *GetStrea retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -434,16 +452,16 @@ func (w *StreamingImageDeletedWaiter) Wait(ctx context.Context, params *GetStrea attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingImageDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingImageDeleted waiter") } func streamingImageDeletedStateRetryable(ctx context.Context, input *GetStreamingImageInput, output *GetStreamingImageOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetStreamingSession.go b/service/nimble/api_op_GetStreamingSession.go index a11eb5bf26e..04eaf1cf919 100644 --- a/service/nimble/api_op_GetStreamingSession.go +++ b/service/nimble/api_op_GetStreamingSession.go @@ -191,8 +191,17 @@ func NewStreamingSessionReadyWaiter(client GetStreamingSessionAPIClient, optFns // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *StreamingSessionReadyWaiter) Wait(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingSessionReady waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StreamingSessionReadyWaiter) WaitForOutput(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionReadyWaiterOptions)) (*GetStreamingSessionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -205,7 +214,7 @@ func (w *StreamingSessionReadyWaiter) Wait(ctx context.Context, params *GetStrea } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -233,10 +242,10 @@ func (w *StreamingSessionReadyWaiter) Wait(ctx context.Context, params *GetStrea retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -249,16 +258,16 @@ func (w *StreamingSessionReadyWaiter) Wait(ctx context.Context, params *GetStrea attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingSessionReady waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingSessionReady waiter") } func streamingSessionReadyStateRetryable(ctx context.Context, input *GetStreamingSessionInput, output *GetStreamingSessionOutput, err error) (bool, error) { @@ -378,8 +387,17 @@ func NewStreamingSessionStoppedWaiter(client GetStreamingSessionAPIClient, optFn // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *StreamingSessionStoppedWaiter) Wait(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingSessionStopped waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StreamingSessionStoppedWaiter) WaitForOutput(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionStoppedWaiterOptions)) (*GetStreamingSessionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -392,7 +410,7 @@ func (w *StreamingSessionStoppedWaiter) Wait(ctx context.Context, params *GetStr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -420,10 +438,10 @@ func (w *StreamingSessionStoppedWaiter) Wait(ctx context.Context, params *GetStr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -436,16 +454,16 @@ func (w *StreamingSessionStoppedWaiter) Wait(ctx context.Context, params *GetStr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingSessionStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingSessionStopped waiter") } func streamingSessionStoppedStateRetryable(ctx context.Context, input *GetStreamingSessionInput, output *GetStreamingSessionOutput, err error) (bool, error) { @@ -548,8 +566,17 @@ func NewStreamingSessionDeletedWaiter(client GetStreamingSessionAPIClient, optFn // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *StreamingSessionDeletedWaiter) Wait(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingSessionDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StreamingSessionDeletedWaiter) WaitForOutput(ctx context.Context, params *GetStreamingSessionInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionDeletedWaiterOptions)) (*GetStreamingSessionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -562,7 +589,7 @@ func (w *StreamingSessionDeletedWaiter) Wait(ctx context.Context, params *GetStr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -590,10 +617,10 @@ func (w *StreamingSessionDeletedWaiter) Wait(ctx context.Context, params *GetStr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -606,16 +633,16 @@ func (w *StreamingSessionDeletedWaiter) Wait(ctx context.Context, params *GetStr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingSessionDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingSessionDeleted waiter") } func streamingSessionDeletedStateRetryable(ctx context.Context, input *GetStreamingSessionInput, output *GetStreamingSessionOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetStreamingSessionStream.go b/service/nimble/api_op_GetStreamingSessionStream.go index c0d828df3a1..c314617c09d 100644 --- a/service/nimble/api_op_GetStreamingSessionStream.go +++ b/service/nimble/api_op_GetStreamingSessionStream.go @@ -201,8 +201,17 @@ func NewStreamingSessionStreamReadyWaiter(client GetStreamingSessionStreamAPICli // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *StreamingSessionStreamReadyWaiter) Wait(ctx context.Context, params *GetStreamingSessionStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionStreamReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StreamingSessionStreamReady waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *StreamingSessionStreamReadyWaiter) WaitForOutput(ctx context.Context, params *GetStreamingSessionStreamInput, maxWaitDur time.Duration, optFns ...func(*StreamingSessionStreamReadyWaiterOptions)) (*GetStreamingSessionStreamOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -215,7 +224,7 @@ func (w *StreamingSessionStreamReadyWaiter) Wait(ctx context.Context, params *Ge } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -243,10 +252,10 @@ func (w *StreamingSessionStreamReadyWaiter) Wait(ctx context.Context, params *Ge retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -259,16 +268,16 @@ func (w *StreamingSessionStreamReadyWaiter) Wait(ctx context.Context, params *Ge attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StreamingSessionStreamReady waiter") + return nil, fmt.Errorf("exceeded max wait time for StreamingSessionStreamReady waiter") } func streamingSessionStreamReadyStateRetryable(ctx context.Context, input *GetStreamingSessionStreamInput, output *GetStreamingSessionStreamOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetStudio.go b/service/nimble/api_op_GetStudio.go index 1030616ab83..8cd1b3e6eca 100644 --- a/service/nimble/api_op_GetStudio.go +++ b/service/nimble/api_op_GetStudio.go @@ -185,8 +185,16 @@ func NewStudioReadyWaiter(client GetStudioAPIClient, optFns ...func(*StudioReady // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StudioReadyWaiter) Wait(ctx context.Context, params *GetStudioInput, maxWaitDur time.Duration, optFns ...func(*StudioReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StudioReady waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *StudioReadyWaiter) WaitForOutput(ctx context.Context, params *GetStudioInput, maxWaitDur time.Duration, optFns ...func(*StudioReadyWaiterOptions)) (*GetStudioOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -199,7 +207,7 @@ func (w *StudioReadyWaiter) Wait(ctx context.Context, params *GetStudioInput, ma } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -227,10 +235,10 @@ func (w *StudioReadyWaiter) Wait(ctx context.Context, params *GetStudioInput, ma retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -243,16 +251,16 @@ func (w *StudioReadyWaiter) Wait(ctx context.Context, params *GetStudioInput, ma attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StudioReady waiter") + return nil, fmt.Errorf("exceeded max wait time for StudioReady waiter") } func studioReadyStateRetryable(ctx context.Context, input *GetStudioInput, output *GetStudioOutput, err error) (bool, error) { @@ -370,8 +378,16 @@ func NewStudioDeletedWaiter(client GetStudioAPIClient, optFns ...func(*StudioDel // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *StudioDeletedWaiter) Wait(ctx context.Context, params *GetStudioInput, maxWaitDur time.Duration, optFns ...func(*StudioDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StudioDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *StudioDeletedWaiter) WaitForOutput(ctx context.Context, params *GetStudioInput, maxWaitDur time.Duration, optFns ...func(*StudioDeletedWaiterOptions)) (*GetStudioOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -384,7 +400,7 @@ func (w *StudioDeletedWaiter) Wait(ctx context.Context, params *GetStudioInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -412,10 +428,10 @@ func (w *StudioDeletedWaiter) Wait(ctx context.Context, params *GetStudioInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -428,16 +444,16 @@ func (w *StudioDeletedWaiter) Wait(ctx context.Context, params *GetStudioInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StudioDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for StudioDeleted waiter") } func studioDeletedStateRetryable(ctx context.Context, input *GetStudioInput, output *GetStudioOutput, err error) (bool, error) { diff --git a/service/nimble/api_op_GetStudioComponent.go b/service/nimble/api_op_GetStudioComponent.go index fe154a9472c..6df7ff2e4b2 100644 --- a/service/nimble/api_op_GetStudioComponent.go +++ b/service/nimble/api_op_GetStudioComponent.go @@ -190,8 +190,17 @@ func NewStudioComponentReadyWaiter(client GetStudioComponentAPIClient, optFns .. // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *StudioComponentReadyWaiter) Wait(ctx context.Context, params *GetStudioComponentInput, maxWaitDur time.Duration, optFns ...func(*StudioComponentReadyWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StudioComponentReady waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StudioComponentReadyWaiter) WaitForOutput(ctx context.Context, params *GetStudioComponentInput, maxWaitDur time.Duration, optFns ...func(*StudioComponentReadyWaiterOptions)) (*GetStudioComponentOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *StudioComponentReadyWaiter) Wait(ctx context.Context, params *GetStudio } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *StudioComponentReadyWaiter) Wait(ctx context.Context, params *GetStudio retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *StudioComponentReadyWaiter) Wait(ctx context.Context, params *GetStudio attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StudioComponentReady waiter") + return nil, fmt.Errorf("exceeded max wait time for StudioComponentReady waiter") } func studioComponentReadyStateRetryable(ctx context.Context, input *GetStudioComponentInput, output *GetStudioComponentOutput, err error) (bool, error) { @@ -376,8 +385,17 @@ func NewStudioComponentDeletedWaiter(client GetStudioComponentAPIClient, optFns // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *StudioComponentDeletedWaiter) Wait(ctx context.Context, params *GetStudioComponentInput, maxWaitDur time.Duration, optFns ...func(*StudioComponentDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for StudioComponentDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *StudioComponentDeletedWaiter) WaitForOutput(ctx context.Context, params *GetStudioComponentInput, maxWaitDur time.Duration, optFns ...func(*StudioComponentDeletedWaiterOptions)) (*GetStudioComponentOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -390,7 +408,7 @@ func (w *StudioComponentDeletedWaiter) Wait(ctx context.Context, params *GetStud } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -418,10 +436,10 @@ func (w *StudioComponentDeletedWaiter) Wait(ctx context.Context, params *GetStud retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -434,16 +452,16 @@ func (w *StudioComponentDeletedWaiter) Wait(ctx context.Context, params *GetStud attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for StudioComponentDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for StudioComponentDeleted waiter") } func studioComponentDeletedStateRetryable(ctx context.Context, input *GetStudioComponentInput, output *GetStudioComponentOutput, err error) (bool, error) { diff --git a/service/opsworks/api_op_DescribeApps.go b/service/opsworks/api_op_DescribeApps.go index b46a34909a1..3b602437b33 100644 --- a/service/opsworks/api_op_DescribeApps.go +++ b/service/opsworks/api_op_DescribeApps.go @@ -188,8 +188,16 @@ func NewAppExistsWaiter(client DescribeAppsAPIClient, optFns ...func(*AppExistsW // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *AppExistsWaiter) Wait(ctx context.Context, params *DescribeAppsInput, maxWaitDur time.Duration, optFns ...func(*AppExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for AppExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *AppExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeAppsInput, maxWaitDur time.Duration, optFns ...func(*AppExistsWaiterOptions)) (*DescribeAppsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -202,7 +210,7 @@ func (w *AppExistsWaiter) Wait(ctx context.Context, params *DescribeAppsInput, m } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -230,10 +238,10 @@ func (w *AppExistsWaiter) Wait(ctx context.Context, params *DescribeAppsInput, m retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -246,16 +254,16 @@ func (w *AppExistsWaiter) Wait(ctx context.Context, params *DescribeAppsInput, m attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for AppExists waiter") + return nil, fmt.Errorf("exceeded max wait time for AppExists waiter") } func appExistsStateRetryable(ctx context.Context, input *DescribeAppsInput, output *DescribeAppsOutput, err error) (bool, error) { diff --git a/service/opsworks/api_op_DescribeDeployments.go b/service/opsworks/api_op_DescribeDeployments.go index 47df6783a74..7e2cbaf5dfd 100644 --- a/service/opsworks/api_op_DescribeDeployments.go +++ b/service/opsworks/api_op_DescribeDeployments.go @@ -195,8 +195,17 @@ func NewDeploymentSuccessfulWaiter(client DescribeDeploymentsAPIClient, optFns . // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *DescribeDeploymentsInput, maxWaitDur time.Duration, optFns ...func(*DeploymentSuccessfulWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DeploymentSuccessful waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DeploymentSuccessfulWaiter) WaitForOutput(ctx context.Context, params *DescribeDeploymentsInput, maxWaitDur time.Duration, optFns ...func(*DeploymentSuccessfulWaiterOptions)) (*DescribeDeploymentsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -209,7 +218,7 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *DescribeD } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -237,10 +246,10 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *DescribeD retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -253,16 +262,16 @@ func (w *DeploymentSuccessfulWaiter) Wait(ctx context.Context, params *DescribeD attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DeploymentSuccessful waiter") + return nil, fmt.Errorf("exceeded max wait time for DeploymentSuccessful waiter") } func deploymentSuccessfulStateRetryable(ctx context.Context, input *DescribeDeploymentsInput, output *DescribeDeploymentsOutput, err error) (bool, error) { diff --git a/service/opsworks/api_op_DescribeInstances.go b/service/opsworks/api_op_DescribeInstances.go index fc27c1ff3c5..1e3e6e08255 100644 --- a/service/opsworks/api_op_DescribeInstances.go +++ b/service/opsworks/api_op_DescribeInstances.go @@ -195,8 +195,17 @@ func NewInstanceOnlineWaiter(client DescribeInstancesAPIClient, optFns ...func(* // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InstanceOnlineWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceOnlineWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceOnline waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceOnlineWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceOnlineWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -209,7 +218,7 @@ func (w *InstanceOnlineWaiter) Wait(ctx context.Context, params *DescribeInstanc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -237,10 +246,10 @@ func (w *InstanceOnlineWaiter) Wait(ctx context.Context, params *DescribeInstanc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -253,16 +262,16 @@ func (w *InstanceOnlineWaiter) Wait(ctx context.Context, params *DescribeInstanc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceOnline waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceOnline waiter") } func instanceOnlineStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -553,8 +562,17 @@ func NewInstanceRegisteredWaiter(client DescribeInstancesAPIClient, optFns ...fu // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *InstanceRegisteredWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceRegisteredWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceRegistered waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *InstanceRegisteredWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceRegisteredWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -567,7 +585,7 @@ func (w *InstanceRegisteredWaiter) Wait(ctx context.Context, params *DescribeIns } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -595,10 +613,10 @@ func (w *InstanceRegisteredWaiter) Wait(ctx context.Context, params *DescribeIns retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -611,16 +629,16 @@ func (w *InstanceRegisteredWaiter) Wait(ctx context.Context, params *DescribeIns attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceRegistered waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceRegistered waiter") } func instanceRegisteredStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -887,8 +905,17 @@ func NewInstanceStoppedWaiter(client DescribeInstancesAPIClient, optFns ...func( // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceStopped waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *InstanceStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceStoppedWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -901,7 +928,7 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -929,10 +956,10 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -945,16 +972,16 @@ func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstan attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceStopped waiter") } func instanceStoppedStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { @@ -1245,8 +1272,17 @@ func NewInstanceTerminatedWaiter(client DescribeInstancesAPIClient, optFns ...fu // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceTerminatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for InstanceTerminated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *InstanceTerminatedWaiter) WaitForOutput(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceTerminatedWaiterOptions)) (*DescribeInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -1259,7 +1295,7 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -1287,10 +1323,10 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -1303,16 +1339,16 @@ func (w *InstanceTerminatedWaiter) Wait(ctx context.Context, params *DescribeIns attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for InstanceTerminated waiter") + return nil, fmt.Errorf("exceeded max wait time for InstanceTerminated waiter") } func instanceTerminatedStateRetryable(ctx context.Context, input *DescribeInstancesInput, output *DescribeInstancesOutput, err error) (bool, error) { diff --git a/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go b/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go index 8ce21efb5d4..e406c57c10e 100644 --- a/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go +++ b/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go @@ -206,8 +206,17 @@ func NewNodeAssociatedWaiter(client DescribeNodeAssociationStatusAPIClient, optF // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *NodeAssociatedWaiter) Wait(ctx context.Context, params *DescribeNodeAssociationStatusInput, maxWaitDur time.Duration, optFns ...func(*NodeAssociatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NodeAssociated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *NodeAssociatedWaiter) WaitForOutput(ctx context.Context, params *DescribeNodeAssociationStatusInput, maxWaitDur time.Duration, optFns ...func(*NodeAssociatedWaiterOptions)) (*DescribeNodeAssociationStatusOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -220,7 +229,7 @@ func (w *NodeAssociatedWaiter) Wait(ctx context.Context, params *DescribeNodeAss } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -248,10 +257,10 @@ func (w *NodeAssociatedWaiter) Wait(ctx context.Context, params *DescribeNodeAss retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -264,16 +273,16 @@ func (w *NodeAssociatedWaiter) Wait(ctx context.Context, params *DescribeNodeAss attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NodeAssociated waiter") + return nil, fmt.Errorf("exceeded max wait time for NodeAssociated waiter") } func nodeAssociatedStateRetryable(ctx context.Context, input *DescribeNodeAssociationStatusInput, output *DescribeNodeAssociationStatusOutput, err error) (bool, error) { diff --git a/service/proton/api_op_GetEnvironment.go b/service/proton/api_op_GetEnvironment.go index 8ab6428d01a..7f3952fd4c5 100644 --- a/service/proton/api_op_GetEnvironment.go +++ b/service/proton/api_op_GetEnvironment.go @@ -186,8 +186,17 @@ func NewEnvironmentDeployedWaiter(client GetEnvironmentAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *EnvironmentDeployedWaiter) Wait(ctx context.Context, params *GetEnvironmentInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentDeployedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EnvironmentDeployed waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *EnvironmentDeployedWaiter) WaitForOutput(ctx context.Context, params *GetEnvironmentInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentDeployedWaiterOptions)) (*GetEnvironmentOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -200,7 +209,7 @@ func (w *EnvironmentDeployedWaiter) Wait(ctx context.Context, params *GetEnviron } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -228,10 +237,10 @@ func (w *EnvironmentDeployedWaiter) Wait(ctx context.Context, params *GetEnviron retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -244,16 +253,16 @@ func (w *EnvironmentDeployedWaiter) Wait(ctx context.Context, params *GetEnviron attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EnvironmentDeployed waiter") + return nil, fmt.Errorf("exceeded max wait time for EnvironmentDeployed waiter") } func environmentDeployedStateRetryable(ctx context.Context, input *GetEnvironmentInput, output *GetEnvironmentOutput, err error) (bool, error) { diff --git a/service/proton/api_op_GetEnvironmentTemplateVersion.go b/service/proton/api_op_GetEnvironmentTemplateVersion.go index 4debb5cdc69..5b0f1372e03 100644 --- a/service/proton/api_op_GetEnvironmentTemplateVersion.go +++ b/service/proton/api_op_GetEnvironmentTemplateVersion.go @@ -200,8 +200,17 @@ func NewEnvironmentTemplateVersionRegisteredWaiter(client GetEnvironmentTemplate // The maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur // is required and must be greater than zero. func (w *EnvironmentTemplateVersionRegisteredWaiter) Wait(ctx context.Context, params *GetEnvironmentTemplateVersionInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentTemplateVersionRegisteredWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EnvironmentTemplateVersionRegistered +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *EnvironmentTemplateVersionRegisteredWaiter) WaitForOutput(ctx context.Context, params *GetEnvironmentTemplateVersionInput, maxWaitDur time.Duration, optFns ...func(*EnvironmentTemplateVersionRegisteredWaiterOptions)) (*GetEnvironmentTemplateVersionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -214,7 +223,7 @@ func (w *EnvironmentTemplateVersionRegisteredWaiter) Wait(ctx context.Context, p } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -242,10 +251,10 @@ func (w *EnvironmentTemplateVersionRegisteredWaiter) Wait(ctx context.Context, p retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -258,16 +267,16 @@ func (w *EnvironmentTemplateVersionRegisteredWaiter) Wait(ctx context.Context, p attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EnvironmentTemplateVersionRegistered waiter") + return nil, fmt.Errorf("exceeded max wait time for EnvironmentTemplateVersionRegistered waiter") } func environmentTemplateVersionRegisteredStateRetryable(ctx context.Context, input *GetEnvironmentTemplateVersionInput, output *GetEnvironmentTemplateVersionOutput, err error) (bool, error) { diff --git a/service/proton/api_op_GetService.go b/service/proton/api_op_GetService.go index d33871750ff..9569be3921d 100644 --- a/service/proton/api_op_GetService.go +++ b/service/proton/api_op_GetService.go @@ -183,8 +183,17 @@ func NewServiceCreatedWaiter(client GetServiceAPIClient, optFns ...func(*Service // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ServiceCreatedWaiter) Wait(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServiceCreated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ServiceCreatedWaiter) WaitForOutput(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceCreatedWaiterOptions)) (*GetServiceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -197,7 +206,7 @@ func (w *ServiceCreatedWaiter) Wait(ctx context.Context, params *GetServiceInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -225,10 +234,10 @@ func (w *ServiceCreatedWaiter) Wait(ctx context.Context, params *GetServiceInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -241,16 +250,16 @@ func (w *ServiceCreatedWaiter) Wait(ctx context.Context, params *GetServiceInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServiceCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ServiceCreated waiter") } func serviceCreatedStateRetryable(ctx context.Context, input *GetServiceInput, output *GetServiceOutput, err error) (bool, error) { @@ -385,8 +394,17 @@ func NewServiceUpdatedWaiter(client GetServiceAPIClient, optFns ...func(*Service // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ServiceUpdatedWaiter) Wait(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceUpdatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServiceUpdated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ServiceUpdatedWaiter) WaitForOutput(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceUpdatedWaiterOptions)) (*GetServiceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -399,7 +417,7 @@ func (w *ServiceUpdatedWaiter) Wait(ctx context.Context, params *GetServiceInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -427,10 +445,10 @@ func (w *ServiceUpdatedWaiter) Wait(ctx context.Context, params *GetServiceInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -443,16 +461,16 @@ func (w *ServiceUpdatedWaiter) Wait(ctx context.Context, params *GetServiceInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServiceUpdated waiter") + return nil, fmt.Errorf("exceeded max wait time for ServiceUpdated waiter") } func serviceUpdatedStateRetryable(ctx context.Context, input *GetServiceInput, output *GetServiceOutput, err error) (bool, error) { @@ -604,8 +622,17 @@ func NewServiceDeletedWaiter(client GetServiceAPIClient, optFns ...func(*Service // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ServiceDeletedWaiter) Wait(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServiceDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ServiceDeletedWaiter) WaitForOutput(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServiceDeletedWaiterOptions)) (*GetServiceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -618,7 +645,7 @@ func (w *ServiceDeletedWaiter) Wait(ctx context.Context, params *GetServiceInput } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -646,10 +673,10 @@ func (w *ServiceDeletedWaiter) Wait(ctx context.Context, params *GetServiceInput retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -662,16 +689,16 @@ func (w *ServiceDeletedWaiter) Wait(ctx context.Context, params *GetServiceInput attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServiceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ServiceDeleted waiter") } func serviceDeletedStateRetryable(ctx context.Context, input *GetServiceInput, output *GetServiceOutput, err error) (bool, error) { @@ -764,8 +791,17 @@ func NewServicePipelineDeployedWaiter(client GetServiceAPIClient, optFns ...func // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ServicePipelineDeployedWaiter) Wait(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServicePipelineDeployedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServicePipelineDeployed waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ServicePipelineDeployedWaiter) WaitForOutput(ctx context.Context, params *GetServiceInput, maxWaitDur time.Duration, optFns ...func(*ServicePipelineDeployedWaiterOptions)) (*GetServiceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -778,7 +814,7 @@ func (w *ServicePipelineDeployedWaiter) Wait(ctx context.Context, params *GetSer } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -806,10 +842,10 @@ func (w *ServicePipelineDeployedWaiter) Wait(ctx context.Context, params *GetSer retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -822,16 +858,16 @@ func (w *ServicePipelineDeployedWaiter) Wait(ctx context.Context, params *GetSer attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServicePipelineDeployed waiter") + return nil, fmt.Errorf("exceeded max wait time for ServicePipelineDeployed waiter") } func servicePipelineDeployedStateRetryable(ctx context.Context, input *GetServiceInput, output *GetServiceOutput, err error) (bool, error) { diff --git a/service/proton/api_op_GetServiceInstance.go b/service/proton/api_op_GetServiceInstance.go index 86ed2619b61..024437e6370 100644 --- a/service/proton/api_op_GetServiceInstance.go +++ b/service/proton/api_op_GetServiceInstance.go @@ -193,8 +193,17 @@ func NewServiceInstanceDeployedWaiter(client GetServiceInstanceAPIClient, optFns // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ServiceInstanceDeployedWaiter) Wait(ctx context.Context, params *GetServiceInstanceInput, maxWaitDur time.Duration, optFns ...func(*ServiceInstanceDeployedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServiceInstanceDeployed waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ServiceInstanceDeployedWaiter) WaitForOutput(ctx context.Context, params *GetServiceInstanceInput, maxWaitDur time.Duration, optFns ...func(*ServiceInstanceDeployedWaiterOptions)) (*GetServiceInstanceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -207,7 +216,7 @@ func (w *ServiceInstanceDeployedWaiter) Wait(ctx context.Context, params *GetSer } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -235,10 +244,10 @@ func (w *ServiceInstanceDeployedWaiter) Wait(ctx context.Context, params *GetSer retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -251,16 +260,16 @@ func (w *ServiceInstanceDeployedWaiter) Wait(ctx context.Context, params *GetSer attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServiceInstanceDeployed waiter") + return nil, fmt.Errorf("exceeded max wait time for ServiceInstanceDeployed waiter") } func serviceInstanceDeployedStateRetryable(ctx context.Context, input *GetServiceInstanceInput, output *GetServiceInstanceOutput, err error) (bool, error) { diff --git a/service/proton/api_op_GetServiceTemplateVersion.go b/service/proton/api_op_GetServiceTemplateVersion.go index 1ab0cb50714..57937f34500 100644 --- a/service/proton/api_op_GetServiceTemplateVersion.go +++ b/service/proton/api_op_GetServiceTemplateVersion.go @@ -200,8 +200,17 @@ func NewServiceTemplateVersionRegisteredWaiter(client GetServiceTemplateVersionA // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ServiceTemplateVersionRegisteredWaiter) Wait(ctx context.Context, params *GetServiceTemplateVersionInput, maxWaitDur time.Duration, optFns ...func(*ServiceTemplateVersionRegisteredWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ServiceTemplateVersionRegistered +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *ServiceTemplateVersionRegisteredWaiter) WaitForOutput(ctx context.Context, params *GetServiceTemplateVersionInput, maxWaitDur time.Duration, optFns ...func(*ServiceTemplateVersionRegisteredWaiterOptions)) (*GetServiceTemplateVersionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -214,7 +223,7 @@ func (w *ServiceTemplateVersionRegisteredWaiter) Wait(ctx context.Context, param } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -242,10 +251,10 @@ func (w *ServiceTemplateVersionRegisteredWaiter) Wait(ctx context.Context, param retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -258,16 +267,16 @@ func (w *ServiceTemplateVersionRegisteredWaiter) Wait(ctx context.Context, param attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ServiceTemplateVersionRegistered waiter") + return nil, fmt.Errorf("exceeded max wait time for ServiceTemplateVersionRegistered waiter") } func serviceTemplateVersionRegisteredStateRetryable(ctx context.Context, input *GetServiceTemplateVersionInput, output *GetServiceTemplateVersionOutput, err error) (bool, error) { diff --git a/service/rds/api_op_DescribeDBClusterSnapshots.go b/service/rds/api_op_DescribeDBClusterSnapshots.go index 4701c5720d2..038831226cc 100644 --- a/service/rds/api_op_DescribeDBClusterSnapshots.go +++ b/service/rds/api_op_DescribeDBClusterSnapshots.go @@ -366,8 +366,17 @@ func NewDBClusterSnapshotAvailableWaiter(client DescribeDBClusterSnapshotsAPICli // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *DBClusterSnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeDBClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBClusterSnapshotAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBClusterSnapshotAvailable waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *DBClusterSnapshotAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBClusterSnapshotAvailableWaiterOptions)) (*DescribeDBClusterSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -380,7 +389,7 @@ func (w *DBClusterSnapshotAvailableWaiter) Wait(ctx context.Context, params *Des } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -408,10 +417,10 @@ func (w *DBClusterSnapshotAvailableWaiter) Wait(ctx context.Context, params *Des retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -424,16 +433,16 @@ func (w *DBClusterSnapshotAvailableWaiter) Wait(ctx context.Context, params *Des attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBClusterSnapshotAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DBClusterSnapshotAvailable waiter") } func dBClusterSnapshotAvailableStateRetryable(ctx context.Context, input *DescribeDBClusterSnapshotsInput, output *DescribeDBClusterSnapshotsOutput, err error) (bool, error) { @@ -654,8 +663,17 @@ func NewDBClusterSnapshotDeletedWaiter(client DescribeDBClusterSnapshotsAPIClien // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *DBClusterSnapshotDeletedWaiter) Wait(ctx context.Context, params *DescribeDBClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBClusterSnapshotDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBClusterSnapshotDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBClusterSnapshotDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeDBClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBClusterSnapshotDeletedWaiterOptions)) (*DescribeDBClusterSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -668,7 +686,7 @@ func (w *DBClusterSnapshotDeletedWaiter) Wait(ctx context.Context, params *Descr } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -696,10 +714,10 @@ func (w *DBClusterSnapshotDeletedWaiter) Wait(ctx context.Context, params *Descr retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -712,16 +730,16 @@ func (w *DBClusterSnapshotDeletedWaiter) Wait(ctx context.Context, params *Descr attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBClusterSnapshotDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for DBClusterSnapshotDeleted waiter") } func dBClusterSnapshotDeletedStateRetryable(ctx context.Context, input *DescribeDBClusterSnapshotsInput, output *DescribeDBClusterSnapshotsOutput, err error) (bool, error) { diff --git a/service/rds/api_op_DescribeDBInstances.go b/service/rds/api_op_DescribeDBInstances.go index 51a5c7617aa..ab59a513908 100644 --- a/service/rds/api_op_DescribeDBInstances.go +++ b/service/rds/api_op_DescribeDBInstances.go @@ -318,8 +318,17 @@ func NewDBInstanceAvailableWaiter(client DescribeDBInstancesAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBInstanceAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBInstanceAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceAvailableWaiterOptions)) (*DescribeDBInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -332,7 +341,7 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -360,10 +369,10 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -376,16 +385,16 @@ func (w *DBInstanceAvailableWaiter) Wait(ctx context.Context, params *DescribeDB attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DBInstanceAvailable waiter") } func dBInstanceAvailableStateRetryable(ctx context.Context, input *DescribeDBInstancesInput, output *DescribeDBInstancesOutput, err error) (bool, error) { @@ -604,8 +613,17 @@ func NewDBInstanceDeletedWaiter(client DescribeDBInstancesAPIClient, optFns ...f // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBInstanceDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *DBInstanceDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeDBInstancesInput, maxWaitDur time.Duration, optFns ...func(*DBInstanceDeletedWaiterOptions)) (*DescribeDBInstancesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -618,7 +636,7 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -646,10 +664,10 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -662,16 +680,16 @@ func (w *DBInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeDBIn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBInstanceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for DBInstanceDeleted waiter") } func dBInstanceDeletedStateRetryable(ctx context.Context, input *DescribeDBInstancesInput, output *DescribeDBInstancesOutput, err error) (bool, error) { diff --git a/service/rds/api_op_DescribeDBSnapshots.go b/service/rds/api_op_DescribeDBSnapshots.go index e22c2eba7a4..e8498659884 100644 --- a/service/rds/api_op_DescribeDBSnapshots.go +++ b/service/rds/api_op_DescribeDBSnapshots.go @@ -371,8 +371,17 @@ func NewDBSnapshotAvailableWaiter(client DescribeDBSnapshotsAPIClient, optFns .. // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBSnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeDBSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBSnapshotAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBSnapshotAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBSnapshotAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBSnapshotAvailableWaiterOptions)) (*DescribeDBSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -385,7 +394,7 @@ func (w *DBSnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeDB } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -413,10 +422,10 @@ func (w *DBSnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeDB retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -429,16 +438,16 @@ func (w *DBSnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeDB attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBSnapshotAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for DBSnapshotAvailable waiter") } func dBSnapshotAvailableStateRetryable(ctx context.Context, input *DescribeDBSnapshotsInput, output *DescribeDBSnapshotsOutput, err error) (bool, error) { @@ -657,8 +666,17 @@ func NewDBSnapshotDeletedWaiter(client DescribeDBSnapshotsAPIClient, optFns ...f // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *DBSnapshotDeletedWaiter) Wait(ctx context.Context, params *DescribeDBSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBSnapshotDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBSnapshotDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *DBSnapshotDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeDBSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*DBSnapshotDeletedWaiterOptions)) (*DescribeDBSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -671,7 +689,7 @@ func (w *DBSnapshotDeletedWaiter) Wait(ctx context.Context, params *DescribeDBSn } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -699,10 +717,10 @@ func (w *DBSnapshotDeletedWaiter) Wait(ctx context.Context, params *DescribeDBSn retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -715,16 +733,16 @@ func (w *DBSnapshotDeletedWaiter) Wait(ctx context.Context, params *DescribeDBSn attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for DBSnapshotDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for DBSnapshotDeleted waiter") } func dBSnapshotDeletedStateRetryable(ctx context.Context, input *DescribeDBSnapshotsInput, output *DescribeDBSnapshotsOutput, err error) (bool, error) { diff --git a/service/redshift/api_op_DescribeClusterSnapshots.go b/service/redshift/api_op_DescribeClusterSnapshots.go index e8158cbde4a..9cca6812355 100644 --- a/service/redshift/api_op_DescribeClusterSnapshots.go +++ b/service/redshift/api_op_DescribeClusterSnapshots.go @@ -364,8 +364,17 @@ func NewSnapshotAvailableWaiter(client DescribeClusterSnapshotsAPIClient, optFns // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *SnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SnapshotAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *SnapshotAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterSnapshotsInput, maxWaitDur time.Duration, optFns ...func(*SnapshotAvailableWaiterOptions)) (*DescribeClusterSnapshotsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -378,7 +387,7 @@ func (w *SnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeClus } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -406,10 +415,10 @@ func (w *SnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeClus retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -422,16 +431,16 @@ func (w *SnapshotAvailableWaiter) Wait(ctx context.Context, params *DescribeClus attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SnapshotAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for SnapshotAvailable waiter") } func snapshotAvailableStateRetryable(ctx context.Context, input *DescribeClusterSnapshotsInput, output *DescribeClusterSnapshotsOutput, err error) (bool, error) { diff --git a/service/redshift/api_op_DescribeClusters.go b/service/redshift/api_op_DescribeClusters.go index 0261c163346..80ab50975b6 100644 --- a/service/redshift/api_op_DescribeClusters.go +++ b/service/redshift/api_op_DescribeClusters.go @@ -315,8 +315,17 @@ func NewClusterAvailableWaiter(client DescribeClustersAPIClient, optFns ...func( // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterAvailable waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterAvailableWaiterOptions)) (*DescribeClustersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -329,7 +338,7 @@ func (w *ClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeClust } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -357,10 +366,10 @@ func (w *ClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeClust retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -373,16 +382,16 @@ func (w *ClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeClust attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterAvailable waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterAvailable waiter") } func clusterAvailableStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) { @@ -517,8 +526,17 @@ func NewClusterDeletedWaiter(client DescribeClustersAPIClient, optFns ...func(*C // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) (*DescribeClustersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -531,7 +549,7 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -559,10 +577,10 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -575,16 +593,16 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") } func clusterDeletedStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) { @@ -711,8 +729,17 @@ func NewClusterRestoredWaiter(client DescribeClustersAPIClient, optFns ...func(* // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterRestoredWaiter) Wait(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterRestoredWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterRestored waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterRestoredWaiter) WaitForOutput(ctx context.Context, params *DescribeClustersInput, maxWaitDur time.Duration, optFns ...func(*ClusterRestoredWaiterOptions)) (*DescribeClustersOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -725,7 +752,7 @@ func (w *ClusterRestoredWaiter) Wait(ctx context.Context, params *DescribeCluste } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -753,10 +780,10 @@ func (w *ClusterRestoredWaiter) Wait(ctx context.Context, params *DescribeCluste retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -769,16 +796,16 @@ func (w *ClusterRestoredWaiter) Wait(ctx context.Context, params *DescribeCluste attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterRestored waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterRestored waiter") } func clusterRestoredStateRetryable(ctx context.Context, input *DescribeClustersInput, output *DescribeClustersOutput, err error) (bool, error) { diff --git a/service/rekognition/api_op_DescribeProjectVersions.go b/service/rekognition/api_op_DescribeProjectVersions.go index 038af7c5b7f..bca838a3714 100644 --- a/service/rekognition/api_op_DescribeProjectVersions.go +++ b/service/rekognition/api_op_DescribeProjectVersions.go @@ -295,8 +295,17 @@ func NewProjectVersionRunningWaiter(client DescribeProjectVersionsAPIClient, opt // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *ProjectVersionRunningWaiter) Wait(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionRunningWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ProjectVersionRunning waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ProjectVersionRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionRunningWaiterOptions)) (*DescribeProjectVersionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -309,7 +318,7 @@ func (w *ProjectVersionRunningWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -337,10 +346,10 @@ func (w *ProjectVersionRunningWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -353,16 +362,16 @@ func (w *ProjectVersionRunningWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ProjectVersionRunning waiter") + return nil, fmt.Errorf("exceeded max wait time for ProjectVersionRunning waiter") } func projectVersionRunningStateRetryable(ctx context.Context, input *DescribeProjectVersionsInput, output *DescribeProjectVersionsOutput, err error) (bool, error) { @@ -490,8 +499,17 @@ func NewProjectVersionTrainingCompletedWaiter(client DescribeProjectVersionsAPIC // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ProjectVersionTrainingCompletedWaiter) Wait(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionTrainingCompletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ProjectVersionTrainingCompleted +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *ProjectVersionTrainingCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionTrainingCompletedWaiterOptions)) (*DescribeProjectVersionsOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -504,7 +522,7 @@ func (w *ProjectVersionTrainingCompletedWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -532,10 +550,10 @@ func (w *ProjectVersionTrainingCompletedWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -548,16 +566,16 @@ func (w *ProjectVersionTrainingCompletedWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ProjectVersionTrainingCompleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ProjectVersionTrainingCompleted waiter") } func projectVersionTrainingCompletedStateRetryable(ctx context.Context, input *DescribeProjectVersionsInput, output *DescribeProjectVersionsOutput, err error) (bool, error) { diff --git a/service/route53/api_op_GetChange.go b/service/route53/api_op_GetChange.go index 66a16ccd828..a0f1dfa7034 100644 --- a/service/route53/api_op_GetChange.go +++ b/service/route53/api_op_GetChange.go @@ -202,8 +202,17 @@ func NewResourceRecordSetsChangedWaiter(client GetChangeAPIClient, optFns ...fun // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ResourceRecordSetsChangedWaiter) Wait(ctx context.Context, params *GetChangeInput, maxWaitDur time.Duration, optFns ...func(*ResourceRecordSetsChangedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ResourceRecordSetsChanged waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ResourceRecordSetsChangedWaiter) WaitForOutput(ctx context.Context, params *GetChangeInput, maxWaitDur time.Duration, optFns ...func(*ResourceRecordSetsChangedWaiterOptions)) (*GetChangeOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -216,7 +225,7 @@ func (w *ResourceRecordSetsChangedWaiter) Wait(ctx context.Context, params *GetC } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -244,10 +253,10 @@ func (w *ResourceRecordSetsChangedWaiter) Wait(ctx context.Context, params *GetC retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -260,16 +269,16 @@ func (w *ResourceRecordSetsChangedWaiter) Wait(ctx context.Context, params *GetC attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ResourceRecordSetsChanged waiter") + return nil, fmt.Errorf("exceeded max wait time for ResourceRecordSetsChanged waiter") } func resourceRecordSetsChangedStateRetryable(ctx context.Context, input *GetChangeInput, output *GetChangeOutput, err error) (bool, error) { diff --git a/service/route53recoverycontrolconfig/api_op_DescribeCluster.go b/service/route53recoverycontrolconfig/api_op_DescribeCluster.go index 174043ba0f4..737dd115eab 100644 --- a/service/route53recoverycontrolconfig/api_op_DescribeCluster.go +++ b/service/route53recoverycontrolconfig/api_op_DescribeCluster.go @@ -185,8 +185,17 @@ func NewClusterCreatedWaiter(client DescribeClusterAPIClient, optFns ...func(*Cl // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterCreatedWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterCreated waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterCreatedWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -199,7 +208,7 @@ func (w *ClusterCreatedWaiter) Wait(ctx context.Context, params *DescribeCluster } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -227,10 +236,10 @@ func (w *ClusterCreatedWaiter) Wait(ctx context.Context, params *DescribeCluster retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -243,16 +252,16 @@ func (w *ClusterCreatedWaiter) Wait(ctx context.Context, params *DescribeCluster attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterCreated waiter") } func clusterCreatedStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { @@ -360,8 +369,17 @@ func NewClusterDeletedWaiter(client DescribeClusterAPIClient, optFns ...func(*Cl // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ClusterDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeClusterInput, maxWaitDur time.Duration, optFns ...func(*ClusterDeletedWaiterOptions)) (*DescribeClusterOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -374,7 +392,7 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -402,10 +420,10 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -418,16 +436,16 @@ func (w *ClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeCluster attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ClusterDeleted waiter") } func clusterDeletedStateRetryable(ctx context.Context, input *DescribeClusterInput, output *DescribeClusterOutput, err error) (bool, error) { diff --git a/service/route53recoverycontrolconfig/api_op_DescribeControlPanel.go b/service/route53recoverycontrolconfig/api_op_DescribeControlPanel.go index 1cf1ae00748..1955373590c 100644 --- a/service/route53recoverycontrolconfig/api_op_DescribeControlPanel.go +++ b/service/route53recoverycontrolconfig/api_op_DescribeControlPanel.go @@ -186,8 +186,17 @@ func NewControlPanelCreatedWaiter(client DescribeControlPanelAPIClient, optFns . // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ControlPanelCreatedWaiter) Wait(ctx context.Context, params *DescribeControlPanelInput, maxWaitDur time.Duration, optFns ...func(*ControlPanelCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ControlPanelCreated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ControlPanelCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeControlPanelInput, maxWaitDur time.Duration, optFns ...func(*ControlPanelCreatedWaiterOptions)) (*DescribeControlPanelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -200,7 +209,7 @@ func (w *ControlPanelCreatedWaiter) Wait(ctx context.Context, params *DescribeCo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -228,10 +237,10 @@ func (w *ControlPanelCreatedWaiter) Wait(ctx context.Context, params *DescribeCo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -244,16 +253,16 @@ func (w *ControlPanelCreatedWaiter) Wait(ctx context.Context, params *DescribeCo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ControlPanelCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ControlPanelCreated waiter") } func controlPanelCreatedStateRetryable(ctx context.Context, input *DescribeControlPanelInput, output *DescribeControlPanelOutput, err error) (bool, error) { @@ -362,8 +371,17 @@ func NewControlPanelDeletedWaiter(client DescribeControlPanelAPIClient, optFns . // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ControlPanelDeletedWaiter) Wait(ctx context.Context, params *DescribeControlPanelInput, maxWaitDur time.Duration, optFns ...func(*ControlPanelDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ControlPanelDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ControlPanelDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeControlPanelInput, maxWaitDur time.Duration, optFns ...func(*ControlPanelDeletedWaiterOptions)) (*DescribeControlPanelOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -376,7 +394,7 @@ func (w *ControlPanelDeletedWaiter) Wait(ctx context.Context, params *DescribeCo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -404,10 +422,10 @@ func (w *ControlPanelDeletedWaiter) Wait(ctx context.Context, params *DescribeCo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -420,16 +438,16 @@ func (w *ControlPanelDeletedWaiter) Wait(ctx context.Context, params *DescribeCo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ControlPanelDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ControlPanelDeleted waiter") } func controlPanelDeletedStateRetryable(ctx context.Context, input *DescribeControlPanelInput, output *DescribeControlPanelOutput, err error) (bool, error) { diff --git a/service/route53recoverycontrolconfig/api_op_DescribeRoutingControl.go b/service/route53recoverycontrolconfig/api_op_DescribeRoutingControl.go index 38ba651b281..b22b2a32f8c 100644 --- a/service/route53recoverycontrolconfig/api_op_DescribeRoutingControl.go +++ b/service/route53recoverycontrolconfig/api_op_DescribeRoutingControl.go @@ -190,8 +190,17 @@ func NewRoutingControlCreatedWaiter(client DescribeRoutingControlAPIClient, optF // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *RoutingControlCreatedWaiter) Wait(ctx context.Context, params *DescribeRoutingControlInput, maxWaitDur time.Duration, optFns ...func(*RoutingControlCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for RoutingControlCreated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *RoutingControlCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeRoutingControlInput, maxWaitDur time.Duration, optFns ...func(*RoutingControlCreatedWaiterOptions)) (*DescribeRoutingControlOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *RoutingControlCreatedWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *RoutingControlCreatedWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *RoutingControlCreatedWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for RoutingControlCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for RoutingControlCreated waiter") } func routingControlCreatedStateRetryable(ctx context.Context, input *DescribeRoutingControlInput, output *DescribeRoutingControlOutput, err error) (bool, error) { @@ -366,8 +375,17 @@ func NewRoutingControlDeletedWaiter(client DescribeRoutingControlAPIClient, optF // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *RoutingControlDeletedWaiter) Wait(ctx context.Context, params *DescribeRoutingControlInput, maxWaitDur time.Duration, optFns ...func(*RoutingControlDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for RoutingControlDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *RoutingControlDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeRoutingControlInput, maxWaitDur time.Duration, optFns ...func(*RoutingControlDeletedWaiterOptions)) (*DescribeRoutingControlOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -380,7 +398,7 @@ func (w *RoutingControlDeletedWaiter) Wait(ctx context.Context, params *Describe } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -408,10 +426,10 @@ func (w *RoutingControlDeletedWaiter) Wait(ctx context.Context, params *Describe retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -424,16 +442,16 @@ func (w *RoutingControlDeletedWaiter) Wait(ctx context.Context, params *Describe attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for RoutingControlDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for RoutingControlDeleted waiter") } func routingControlDeletedStateRetryable(ctx context.Context, input *DescribeRoutingControlInput, output *DescribeRoutingControlOutput, err error) (bool, error) { diff --git a/service/s3/api_op_HeadBucket.go b/service/s3/api_op_HeadBucket.go index f11fcfc92ae..1623e3452f4 100644 --- a/service/s3/api_op_HeadBucket.go +++ b/service/s3/api_op_HeadBucket.go @@ -230,8 +230,16 @@ func NewBucketExistsWaiter(client HeadBucketAPIClient, optFns ...func(*BucketExi // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *BucketExistsWaiter) Wait(ctx context.Context, params *HeadBucketInput, maxWaitDur time.Duration, optFns ...func(*BucketExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BucketExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *BucketExistsWaiter) WaitForOutput(ctx context.Context, params *HeadBucketInput, maxWaitDur time.Duration, optFns ...func(*BucketExistsWaiterOptions)) (*HeadBucketOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -244,7 +252,7 @@ func (w *BucketExistsWaiter) Wait(ctx context.Context, params *HeadBucketInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -272,10 +280,10 @@ func (w *BucketExistsWaiter) Wait(ctx context.Context, params *HeadBucketInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -288,16 +296,16 @@ func (w *BucketExistsWaiter) Wait(ctx context.Context, params *HeadBucketInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BucketExists waiter") + return nil, fmt.Errorf("exceeded max wait time for BucketExists waiter") } func bucketExistsStateRetryable(ctx context.Context, input *HeadBucketInput, output *HeadBucketOutput, err error) (bool, error) { @@ -375,8 +383,17 @@ func NewBucketNotExistsWaiter(client HeadBucketAPIClient, optFns ...func(*Bucket // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *BucketNotExistsWaiter) Wait(ctx context.Context, params *HeadBucketInput, maxWaitDur time.Duration, optFns ...func(*BucketNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for BucketNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *BucketNotExistsWaiter) WaitForOutput(ctx context.Context, params *HeadBucketInput, maxWaitDur time.Duration, optFns ...func(*BucketNotExistsWaiterOptions)) (*HeadBucketOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -389,7 +406,7 @@ func (w *BucketNotExistsWaiter) Wait(ctx context.Context, params *HeadBucketInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -417,10 +434,10 @@ func (w *BucketNotExistsWaiter) Wait(ctx context.Context, params *HeadBucketInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -433,16 +450,16 @@ func (w *BucketNotExistsWaiter) Wait(ctx context.Context, params *HeadBucketInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for BucketNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for BucketNotExists waiter") } func bucketNotExistsStateRetryable(ctx context.Context, input *HeadBucketInput, output *HeadBucketOutput, err error) (bool, error) { diff --git a/service/s3/api_op_HeadObject.go b/service/s3/api_op_HeadObject.go index fd795d5fea1..875c5cc62a9 100644 --- a/service/s3/api_op_HeadObject.go +++ b/service/s3/api_op_HeadObject.go @@ -523,8 +523,16 @@ func NewObjectExistsWaiter(client HeadObjectAPIClient, optFns ...func(*ObjectExi // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ObjectExistsWaiter) Wait(ctx context.Context, params *HeadObjectInput, maxWaitDur time.Duration, optFns ...func(*ObjectExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ObjectExists waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ObjectExistsWaiter) WaitForOutput(ctx context.Context, params *HeadObjectInput, maxWaitDur time.Duration, optFns ...func(*ObjectExistsWaiterOptions)) (*HeadObjectOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -537,7 +545,7 @@ func (w *ObjectExistsWaiter) Wait(ctx context.Context, params *HeadObjectInput, } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -565,10 +573,10 @@ func (w *ObjectExistsWaiter) Wait(ctx context.Context, params *HeadObjectInput, retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -581,16 +589,16 @@ func (w *ObjectExistsWaiter) Wait(ctx context.Context, params *HeadObjectInput, attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ObjectExists waiter") + return nil, fmt.Errorf("exceeded max wait time for ObjectExists waiter") } func objectExistsStateRetryable(ctx context.Context, input *HeadObjectInput, output *HeadObjectOutput, err error) (bool, error) { @@ -673,8 +681,17 @@ func NewObjectNotExistsWaiter(client HeadObjectAPIClient, optFns ...func(*Object // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ObjectNotExistsWaiter) Wait(ctx context.Context, params *HeadObjectInput, maxWaitDur time.Duration, optFns ...func(*ObjectNotExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ObjectNotExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *ObjectNotExistsWaiter) WaitForOutput(ctx context.Context, params *HeadObjectInput, maxWaitDur time.Duration, optFns ...func(*ObjectNotExistsWaiterOptions)) (*HeadObjectOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -687,7 +704,7 @@ func (w *ObjectNotExistsWaiter) Wait(ctx context.Context, params *HeadObjectInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -715,10 +732,10 @@ func (w *ObjectNotExistsWaiter) Wait(ctx context.Context, params *HeadObjectInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -731,16 +748,16 @@ func (w *ObjectNotExistsWaiter) Wait(ctx context.Context, params *HeadObjectInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ObjectNotExists waiter") + return nil, fmt.Errorf("exceeded max wait time for ObjectNotExists waiter") } func objectNotExistsStateRetryable(ctx context.Context, input *HeadObjectInput, output *HeadObjectOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeEndpoint.go b/service/sagemaker/api_op_DescribeEndpoint.go index 953732e0679..24eb22d25bc 100644 --- a/service/sagemaker/api_op_DescribeEndpoint.go +++ b/service/sagemaker/api_op_DescribeEndpoint.go @@ -263,8 +263,17 @@ func NewEndpointDeletedWaiter(client DescribeEndpointAPIClient, optFns ...func(* // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpointInput, maxWaitDur time.Duration, optFns ...func(*EndpointDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EndpointDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *EndpointDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeEndpointInput, maxWaitDur time.Duration, optFns ...func(*EndpointDeletedWaiterOptions)) (*DescribeEndpointOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -277,7 +286,7 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -305,10 +314,10 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -321,16 +330,16 @@ func (w *EndpointDeletedWaiter) Wait(ctx context.Context, params *DescribeEndpoi attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EndpointDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for EndpointDeleted waiter") } func endpointDeletedStateRetryable(ctx context.Context, input *DescribeEndpointInput, output *DescribeEndpointOutput, err error) (bool, error) { @@ -426,8 +435,17 @@ func NewEndpointInServiceWaiter(client DescribeEndpointAPIClient, optFns ...func // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *EndpointInServiceWaiter) Wait(ctx context.Context, params *DescribeEndpointInput, maxWaitDur time.Duration, optFns ...func(*EndpointInServiceWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for EndpointInService waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *EndpointInServiceWaiter) WaitForOutput(ctx context.Context, params *DescribeEndpointInput, maxWaitDur time.Duration, optFns ...func(*EndpointInServiceWaiterOptions)) (*DescribeEndpointOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -440,7 +458,7 @@ func (w *EndpointInServiceWaiter) Wait(ctx context.Context, params *DescribeEndp } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -468,10 +486,10 @@ func (w *EndpointInServiceWaiter) Wait(ctx context.Context, params *DescribeEndp retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -484,16 +502,16 @@ func (w *EndpointInServiceWaiter) Wait(ctx context.Context, params *DescribeEndp attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for EndpointInService waiter") + return nil, fmt.Errorf("exceeded max wait time for EndpointInService waiter") } func endpointInServiceStateRetryable(ctx context.Context, input *DescribeEndpointInput, output *DescribeEndpointOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeImage.go b/service/sagemaker/api_op_DescribeImage.go index 9b0a745dd78..b669aae6b52 100644 --- a/service/sagemaker/api_op_DescribeImage.go +++ b/service/sagemaker/api_op_DescribeImage.go @@ -209,8 +209,16 @@ func NewImageCreatedWaiter(client DescribeImageAPIClient, optFns ...func(*ImageC // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ImageCreatedWaiter) Wait(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageCreated waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ImageCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageCreatedWaiterOptions)) (*DescribeImageOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -223,7 +231,7 @@ func (w *ImageCreatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -251,10 +259,10 @@ func (w *ImageCreatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -267,16 +275,16 @@ func (w *ImageCreatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageCreated waiter") } func imageCreatedStateRetryable(ctx context.Context, input *DescribeImageInput, output *DescribeImageOutput, err error) (bool, error) { @@ -389,8 +397,16 @@ func NewImageDeletedWaiter(client DescribeImageAPIClient, optFns ...func(*ImageD // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ImageDeletedWaiter) Wait(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageDeleted waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ImageDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageDeletedWaiterOptions)) (*DescribeImageOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -403,7 +419,7 @@ func (w *ImageDeletedWaiter) Wait(ctx context.Context, params *DescribeImageInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -431,10 +447,10 @@ func (w *ImageDeletedWaiter) Wait(ctx context.Context, params *DescribeImageInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -447,16 +463,16 @@ func (w *ImageDeletedWaiter) Wait(ctx context.Context, params *DescribeImageInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageDeleted waiter") } func imageDeletedStateRetryable(ctx context.Context, input *DescribeImageInput, output *DescribeImageOutput, err error) (bool, error) { @@ -564,8 +580,16 @@ func NewImageUpdatedWaiter(client DescribeImageAPIClient, optFns ...func(*ImageU // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *ImageUpdatedWaiter) Wait(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageUpdatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageUpdated waiter and returns the +// output of the successful operation. The maxWaitDur is the maximum wait duration +// the waiter will wait. The maxWaitDur is required and must be greater than zero. +func (w *ImageUpdatedWaiter) WaitForOutput(ctx context.Context, params *DescribeImageInput, maxWaitDur time.Duration, optFns ...func(*ImageUpdatedWaiterOptions)) (*DescribeImageOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -578,7 +602,7 @@ func (w *ImageUpdatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -606,10 +630,10 @@ func (w *ImageUpdatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -622,16 +646,16 @@ func (w *ImageUpdatedWaiter) Wait(ctx context.Context, params *DescribeImageInpu attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageUpdated waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageUpdated waiter") } func imageUpdatedStateRetryable(ctx context.Context, input *DescribeImageInput, output *DescribeImageOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeImageVersion.go b/service/sagemaker/api_op_DescribeImageVersion.go index 5f742a70ce9..08cf33feb03 100644 --- a/service/sagemaker/api_op_DescribeImageVersion.go +++ b/service/sagemaker/api_op_DescribeImageVersion.go @@ -213,8 +213,17 @@ func NewImageVersionCreatedWaiter(client DescribeImageVersionAPIClient, optFns . // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ImageVersionCreatedWaiter) Wait(ctx context.Context, params *DescribeImageVersionInput, maxWaitDur time.Duration, optFns ...func(*ImageVersionCreatedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageVersionCreated waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ImageVersionCreatedWaiter) WaitForOutput(ctx context.Context, params *DescribeImageVersionInput, maxWaitDur time.Duration, optFns ...func(*ImageVersionCreatedWaiterOptions)) (*DescribeImageVersionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -227,7 +236,7 @@ func (w *ImageVersionCreatedWaiter) Wait(ctx context.Context, params *DescribeIm } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -255,10 +264,10 @@ func (w *ImageVersionCreatedWaiter) Wait(ctx context.Context, params *DescribeIm retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -271,16 +280,16 @@ func (w *ImageVersionCreatedWaiter) Wait(ctx context.Context, params *DescribeIm attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageVersionCreated waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageVersionCreated waiter") } func imageVersionCreatedStateRetryable(ctx context.Context, input *DescribeImageVersionInput, output *DescribeImageVersionOutput, err error) (bool, error) { @@ -394,8 +403,17 @@ func NewImageVersionDeletedWaiter(client DescribeImageVersionAPIClient, optFns . // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *ImageVersionDeletedWaiter) Wait(ctx context.Context, params *DescribeImageVersionInput, maxWaitDur time.Duration, optFns ...func(*ImageVersionDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ImageVersionDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *ImageVersionDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeImageVersionInput, maxWaitDur time.Duration, optFns ...func(*ImageVersionDeletedWaiterOptions)) (*DescribeImageVersionOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -408,7 +426,7 @@ func (w *ImageVersionDeletedWaiter) Wait(ctx context.Context, params *DescribeIm } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -436,10 +454,10 @@ func (w *ImageVersionDeletedWaiter) Wait(ctx context.Context, params *DescribeIm retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -452,16 +470,16 @@ func (w *ImageVersionDeletedWaiter) Wait(ctx context.Context, params *DescribeIm attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ImageVersionDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for ImageVersionDeleted waiter") } func imageVersionDeletedStateRetryable(ctx context.Context, input *DescribeImageVersionInput, output *DescribeImageVersionOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeNotebookInstance.go b/service/sagemaker/api_op_DescribeNotebookInstance.go index 1c4671a7a2c..30b7281a511 100644 --- a/service/sagemaker/api_op_DescribeNotebookInstance.go +++ b/service/sagemaker/api_op_DescribeNotebookInstance.go @@ -281,8 +281,17 @@ func NewNotebookInstanceDeletedWaiter(client DescribeNotebookInstanceAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *NotebookInstanceDeletedWaiter) Wait(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NotebookInstanceDeleted waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *NotebookInstanceDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceDeletedWaiterOptions)) (*DescribeNotebookInstanceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -295,7 +304,7 @@ func (w *NotebookInstanceDeletedWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -323,10 +332,10 @@ func (w *NotebookInstanceDeletedWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -339,16 +348,16 @@ func (w *NotebookInstanceDeletedWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NotebookInstanceDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for NotebookInstanceDeleted waiter") } func notebookInstanceDeletedStateRetryable(ctx context.Context, input *DescribeNotebookInstanceInput, output *DescribeNotebookInstanceOutput, err error) (bool, error) { @@ -447,8 +456,17 @@ func NewNotebookInstanceInServiceWaiter(client DescribeNotebookInstanceAPIClient // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *NotebookInstanceInServiceWaiter) Wait(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceInServiceWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NotebookInstanceInService waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *NotebookInstanceInServiceWaiter) WaitForOutput(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceInServiceWaiterOptions)) (*DescribeNotebookInstanceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -461,7 +479,7 @@ func (w *NotebookInstanceInServiceWaiter) Wait(ctx context.Context, params *Desc } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -489,10 +507,10 @@ func (w *NotebookInstanceInServiceWaiter) Wait(ctx context.Context, params *Desc retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -505,16 +523,16 @@ func (w *NotebookInstanceInServiceWaiter) Wait(ctx context.Context, params *Desc attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NotebookInstanceInService waiter") + return nil, fmt.Errorf("exceeded max wait time for NotebookInstanceInService waiter") } func notebookInstanceInServiceStateRetryable(ctx context.Context, input *DescribeNotebookInstanceInput, output *DescribeNotebookInstanceOutput, err error) (bool, error) { @@ -617,8 +635,17 @@ func NewNotebookInstanceStoppedWaiter(client DescribeNotebookInstanceAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *NotebookInstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NotebookInstanceStopped waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *NotebookInstanceStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeNotebookInstanceInput, maxWaitDur time.Duration, optFns ...func(*NotebookInstanceStoppedWaiterOptions)) (*DescribeNotebookInstanceOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -631,7 +658,7 @@ func (w *NotebookInstanceStoppedWaiter) Wait(ctx context.Context, params *Descri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -659,10 +686,10 @@ func (w *NotebookInstanceStoppedWaiter) Wait(ctx context.Context, params *Descri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -675,16 +702,16 @@ func (w *NotebookInstanceStoppedWaiter) Wait(ctx context.Context, params *Descri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for NotebookInstanceStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for NotebookInstanceStopped waiter") } func notebookInstanceStoppedStateRetryable(ctx context.Context, input *DescribeNotebookInstanceInput, output *DescribeNotebookInstanceOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeProcessingJob.go b/service/sagemaker/api_op_DescribeProcessingJob.go index d48f10b6dee..27226d47434 100644 --- a/service/sagemaker/api_op_DescribeProcessingJob.go +++ b/service/sagemaker/api_op_DescribeProcessingJob.go @@ -270,8 +270,17 @@ func NewProcessingJobCompletedOrStoppedWaiter(client DescribeProcessingJobAPICli // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *ProcessingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params *DescribeProcessingJobInput, maxWaitDur time.Duration, optFns ...func(*ProcessingJobCompletedOrStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for ProcessingJobCompletedOrStopped +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *ProcessingJobCompletedOrStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeProcessingJobInput, maxWaitDur time.Duration, optFns ...func(*ProcessingJobCompletedOrStoppedWaiterOptions)) (*DescribeProcessingJobOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -284,7 +293,7 @@ func (w *ProcessingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -312,10 +321,10 @@ func (w *ProcessingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -328,16 +337,16 @@ func (w *ProcessingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for ProcessingJobCompletedOrStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for ProcessingJobCompletedOrStopped waiter") } func processingJobCompletedOrStoppedStateRetryable(ctx context.Context, input *DescribeProcessingJobInput, output *DescribeProcessingJobOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeTrainingJob.go b/service/sagemaker/api_op_DescribeTrainingJob.go index dcb168bcffe..ce552a125b7 100644 --- a/service/sagemaker/api_op_DescribeTrainingJob.go +++ b/service/sagemaker/api_op_DescribeTrainingJob.go @@ -460,8 +460,17 @@ func NewTrainingJobCompletedOrStoppedWaiter(client DescribeTrainingJobAPIClient, // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *TrainingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params *DescribeTrainingJobInput, maxWaitDur time.Duration, optFns ...func(*TrainingJobCompletedOrStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TrainingJobCompletedOrStopped waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *TrainingJobCompletedOrStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeTrainingJobInput, maxWaitDur time.Duration, optFns ...func(*TrainingJobCompletedOrStoppedWaiterOptions)) (*DescribeTrainingJobOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -474,7 +483,7 @@ func (w *TrainingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params * } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -502,10 +511,10 @@ func (w *TrainingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params * retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -518,16 +527,16 @@ func (w *TrainingJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params * attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TrainingJobCompletedOrStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for TrainingJobCompletedOrStopped waiter") } func trainingJobCompletedOrStoppedStateRetryable(ctx context.Context, input *DescribeTrainingJobInput, output *DescribeTrainingJobOutput, err error) (bool, error) { diff --git a/service/sagemaker/api_op_DescribeTransformJob.go b/service/sagemaker/api_op_DescribeTransformJob.go index 6dec981d636..6564d02f5e5 100644 --- a/service/sagemaker/api_op_DescribeTransformJob.go +++ b/service/sagemaker/api_op_DescribeTransformJob.go @@ -294,8 +294,17 @@ func NewTransformJobCompletedOrStoppedWaiter(client DescribeTransformJobAPIClien // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *TransformJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params *DescribeTransformJobInput, maxWaitDur time.Duration, optFns ...func(*TransformJobCompletedOrStoppedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for TransformJobCompletedOrStopped +// waiter and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *TransformJobCompletedOrStoppedWaiter) WaitForOutput(ctx context.Context, params *DescribeTransformJobInput, maxWaitDur time.Duration, optFns ...func(*TransformJobCompletedOrStoppedWaiterOptions)) (*DescribeTransformJobOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -308,7 +317,7 @@ func (w *TransformJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -336,10 +345,10 @@ func (w *TransformJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -352,16 +361,16 @@ func (w *TransformJobCompletedOrStoppedWaiter) Wait(ctx context.Context, params attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for TransformJobCompletedOrStopped waiter") + return nil, fmt.Errorf("exceeded max wait time for TransformJobCompletedOrStopped waiter") } func transformJobCompletedOrStoppedStateRetryable(ctx context.Context, input *DescribeTransformJobInput, output *DescribeTransformJobOutput, err error) (bool, error) { diff --git a/service/schemas/api_op_DescribeCodeBinding.go b/service/schemas/api_op_DescribeCodeBinding.go index 2dd814e650f..fe8702ed6a9 100644 --- a/service/schemas/api_op_DescribeCodeBinding.go +++ b/service/schemas/api_op_DescribeCodeBinding.go @@ -206,8 +206,17 @@ func NewCodeBindingExistsWaiter(client DescribeCodeBindingAPIClient, optFns ...f // the maximum wait duration the waiter will wait. The maxWaitDur is required and // must be greater than zero. func (w *CodeBindingExistsWaiter) Wait(ctx context.Context, params *DescribeCodeBindingInput, maxWaitDur time.Duration, optFns ...func(*CodeBindingExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CodeBindingExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *CodeBindingExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeCodeBindingInput, maxWaitDur time.Duration, optFns ...func(*CodeBindingExistsWaiterOptions)) (*DescribeCodeBindingOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -220,7 +229,7 @@ func (w *CodeBindingExistsWaiter) Wait(ctx context.Context, params *DescribeCode } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -248,10 +257,10 @@ func (w *CodeBindingExistsWaiter) Wait(ctx context.Context, params *DescribeCode retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -264,16 +273,16 @@ func (w *CodeBindingExistsWaiter) Wait(ctx context.Context, params *DescribeCode attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CodeBindingExists waiter") + return nil, fmt.Errorf("exceeded max wait time for CodeBindingExists waiter") } func codeBindingExistsStateRetryable(ctx context.Context, input *DescribeCodeBindingInput, output *DescribeCodeBindingOutput, err error) (bool, error) { diff --git a/service/ses/api_op_GetIdentityVerificationAttributes.go b/service/ses/api_op_GetIdentityVerificationAttributes.go index c00adedc4f8..d55cdde6e24 100644 --- a/service/ses/api_op_GetIdentityVerificationAttributes.go +++ b/service/ses/api_op_GetIdentityVerificationAttributes.go @@ -208,8 +208,17 @@ func NewIdentityExistsWaiter(client GetIdentityVerificationAttributesAPIClient, // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *IdentityExistsWaiter) Wait(ctx context.Context, params *GetIdentityVerificationAttributesInput, maxWaitDur time.Duration, optFns ...func(*IdentityExistsWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for IdentityExists waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *IdentityExistsWaiter) WaitForOutput(ctx context.Context, params *GetIdentityVerificationAttributesInput, maxWaitDur time.Duration, optFns ...func(*IdentityExistsWaiterOptions)) (*GetIdentityVerificationAttributesOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -222,7 +231,7 @@ func (w *IdentityExistsWaiter) Wait(ctx context.Context, params *GetIdentityVeri } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -250,10 +259,10 @@ func (w *IdentityExistsWaiter) Wait(ctx context.Context, params *GetIdentityVeri retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -266,16 +275,16 @@ func (w *IdentityExistsWaiter) Wait(ctx context.Context, params *GetIdentityVeri attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for IdentityExists waiter") + return nil, fmt.Errorf("exceeded max wait time for IdentityExists waiter") } func identityExistsStateRetryable(ctx context.Context, input *GetIdentityVerificationAttributesInput, output *GetIdentityVerificationAttributesOutput, err error) (bool, error) { diff --git a/service/signer/api_op_DescribeSigningJob.go b/service/signer/api_op_DescribeSigningJob.go index f5fc648027c..d798a786d7d 100644 --- a/service/signer/api_op_DescribeSigningJob.go +++ b/service/signer/api_op_DescribeSigningJob.go @@ -244,8 +244,17 @@ func NewSuccessfulSigningJobWaiter(client DescribeSigningJobAPIClient, optFns .. // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *SuccessfulSigningJobWaiter) Wait(ctx context.Context, params *DescribeSigningJobInput, maxWaitDur time.Duration, optFns ...func(*SuccessfulSigningJobWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for SuccessfulSigningJob waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *SuccessfulSigningJobWaiter) WaitForOutput(ctx context.Context, params *DescribeSigningJobInput, maxWaitDur time.Duration, optFns ...func(*SuccessfulSigningJobWaiterOptions)) (*DescribeSigningJobOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -258,7 +267,7 @@ func (w *SuccessfulSigningJobWaiter) Wait(ctx context.Context, params *DescribeS } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -286,10 +295,10 @@ func (w *SuccessfulSigningJobWaiter) Wait(ctx context.Context, params *DescribeS retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -302,16 +311,16 @@ func (w *SuccessfulSigningJobWaiter) Wait(ctx context.Context, params *DescribeS attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for SuccessfulSigningJob waiter") + return nil, fmt.Errorf("exceeded max wait time for SuccessfulSigningJob waiter") } func successfulSigningJobStateRetryable(ctx context.Context, input *DescribeSigningJobInput, output *DescribeSigningJobOutput, err error) (bool, error) { diff --git a/service/ssm/api_op_GetCommandInvocation.go b/service/ssm/api_op_GetCommandInvocation.go index 45284b8d236..cf071692a56 100644 --- a/service/ssm/api_op_GetCommandInvocation.go +++ b/service/ssm/api_op_GetCommandInvocation.go @@ -328,8 +328,17 @@ func NewCommandExecutedWaiter(client GetCommandInvocationAPIClient, optFns ...fu // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *CommandExecutedWaiter) Wait(ctx context.Context, params *GetCommandInvocationInput, maxWaitDur time.Duration, optFns ...func(*CommandExecutedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for CommandExecuted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *CommandExecutedWaiter) WaitForOutput(ctx context.Context, params *GetCommandInvocationInput, maxWaitDur time.Duration, optFns ...func(*CommandExecutedWaiterOptions)) (*GetCommandInvocationOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -342,7 +351,7 @@ func (w *CommandExecutedWaiter) Wait(ctx context.Context, params *GetCommandInvo } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -370,10 +379,10 @@ func (w *CommandExecutedWaiter) Wait(ctx context.Context, params *GetCommandInvo retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -386,16 +395,16 @@ func (w *CommandExecutedWaiter) Wait(ctx context.Context, params *GetCommandInvo attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for CommandExecuted waiter") + return nil, fmt.Errorf("exceeded max wait time for CommandExecuted waiter") } func commandExecutedStateRetryable(ctx context.Context, input *GetCommandInvocationInput, output *GetCommandInvocationOutput, err error) (bool, error) { diff --git a/service/ssmincidents/api_op_GetReplicationSet.go b/service/ssmincidents/api_op_GetReplicationSet.go index 724e6542c2e..a968b8b013f 100644 --- a/service/ssmincidents/api_op_GetReplicationSet.go +++ b/service/ssmincidents/api_op_GetReplicationSet.go @@ -190,8 +190,17 @@ func NewWaitForReplicationSetActiveWaiter(client GetReplicationSetAPIClient, opt // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *WaitForReplicationSetActiveWaiter) Wait(ctx context.Context, params *GetReplicationSetInput, maxWaitDur time.Duration, optFns ...func(*WaitForReplicationSetActiveWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for WaitForReplicationSetActive waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *WaitForReplicationSetActiveWaiter) WaitForOutput(ctx context.Context, params *GetReplicationSetInput, maxWaitDur time.Duration, optFns ...func(*WaitForReplicationSetActiveWaiterOptions)) (*GetReplicationSetOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -204,7 +213,7 @@ func (w *WaitForReplicationSetActiveWaiter) Wait(ctx context.Context, params *Ge } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -232,10 +241,10 @@ func (w *WaitForReplicationSetActiveWaiter) Wait(ctx context.Context, params *Ge retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -248,16 +257,16 @@ func (w *WaitForReplicationSetActiveWaiter) Wait(ctx context.Context, params *Ge attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for WaitForReplicationSetActive waiter") + return nil, fmt.Errorf("exceeded max wait time for WaitForReplicationSetActive waiter") } func waitForReplicationSetActiveStateRetryable(ctx context.Context, input *GetReplicationSetInput, output *GetReplicationSetOutput, err error) (bool, error) { @@ -396,8 +405,17 @@ func NewWaitForReplicationSetDeletedWaiter(client GetReplicationSetAPIClient, op // maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is // required and must be greater than zero. func (w *WaitForReplicationSetDeletedWaiter) Wait(ctx context.Context, params *GetReplicationSetInput, maxWaitDur time.Duration, optFns ...func(*WaitForReplicationSetDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for WaitForReplicationSetDeleted waiter +// and returns the output of the successful operation. The maxWaitDur is the +// maximum wait duration the waiter will wait. The maxWaitDur is required and must +// be greater than zero. +func (w *WaitForReplicationSetDeletedWaiter) WaitForOutput(ctx context.Context, params *GetReplicationSetInput, maxWaitDur time.Duration, optFns ...func(*WaitForReplicationSetDeletedWaiterOptions)) (*GetReplicationSetOutput, error) { if maxWaitDur <= 0 { - return fmt.Errorf("maximum wait time for waiter must be greater than zero") + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options @@ -410,7 +428,7 @@ func (w *WaitForReplicationSetDeletedWaiter) Wait(ctx context.Context, params *G } if options.MinDelay > options.MaxDelay { - return fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) @@ -438,10 +456,10 @@ func (w *WaitForReplicationSetDeletedWaiter) Wait(ctx context.Context, params *G retryable, err := options.Retryable(ctx, params, out, err) if err != nil { - return err + return nil, err } if !retryable { - return nil + return out, nil } remainingTime -= time.Since(start) @@ -454,16 +472,16 @@ func (w *WaitForReplicationSetDeletedWaiter) Wait(ctx context.Context, params *G attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { - return fmt.Errorf("error computing waiter delay, %w", err) + return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { - return fmt.Errorf("request cancelled while waiting, %w", err) + return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } - return fmt.Errorf("exceeded max wait time for WaitForReplicationSetDeleted waiter") + return nil, fmt.Errorf("exceeded max wait time for WaitForReplicationSetDeleted waiter") } func waitForReplicationSetDeletedStateRetryable(ctx context.Context, input *GetReplicationSetInput, output *GetReplicationSetOutput, err error) (bool, error) {