diff --git a/service/acm/api_op_DescribeCertificate.go b/service/acm/api_op_DescribeCertificate.go index a18bad2a338..babaa63873c 100644 --- a/service/acm/api_op_DescribeCertificate.go +++ b/service/acm/api_op_DescribeCertificate.go @@ -185,8 +185,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 @@ -199,7 +208,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) @@ -227,10 +236,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) @@ -243,16 +252,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 743686ed142..198dd3f25b9 100644 --- a/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go +++ b/service/acmpca/api_op_DescribeCertificateAuthorityAuditReport.go @@ -205,8 +205,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 @@ -219,7 +228,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) @@ -247,10 +256,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) @@ -263,16 +272,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 6cc61cda48c..4e4a9e0163c 100644 --- a/service/acmpca/api_op_GetCertificate.go +++ b/service/acmpca/api_op_GetCertificate.go @@ -204,8 +204,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 @@ -218,7 +227,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) @@ -246,10 +255,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) @@ -262,16 +271,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 1afb3a92409..b5252a4b666 100644 --- a/service/acmpca/api_op_GetCertificateAuthorityCsr.go +++ b/service/acmpca/api_op_GetCertificateAuthorityCsr.go @@ -196,8 +196,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 @@ -210,7 +219,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) @@ -238,10 +247,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) @@ -254,16 +263,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/appstream/api_op_DescribeFleets.go b/service/appstream/api_op_DescribeFleets.go index 10e9f048851..68990ea95db 100644 --- a/service/appstream/api_op_DescribeFleets.go +++ b/service/appstream/api_op_DescribeFleets.go @@ -183,8 +183,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 @@ -197,7 +205,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) @@ -225,10 +233,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) @@ -241,16 +249,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) { @@ -397,8 +405,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 @@ -411,7 +427,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) @@ -439,10 +455,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) @@ -455,16 +471,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 bab4feedb8c..d1336a29eee 100644 --- a/service/autoscaling/api_op_DescribeAutoScalingGroups.go +++ b/service/autoscaling/api_op_DescribeAutoScalingGroups.go @@ -277,8 +277,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 @@ -291,7 +299,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) @@ -319,10 +327,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) @@ -335,16 +343,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) { @@ -453,8 +461,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 @@ -467,7 +484,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) @@ -495,10 +512,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) @@ -511,16 +528,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) { @@ -629,8 +646,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 @@ -643,7 +669,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) @@ -671,10 +697,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) @@ -687,16 +713,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/cloudformation/api_op_DescribeTypeRegistration.go b/service/cloudformation/api_op_DescribeTypeRegistration.go index ea8cd200f1b..735acc70421 100644 --- a/service/cloudformation/api_op_DescribeTypeRegistration.go +++ b/service/cloudformation/api_op_DescribeTypeRegistration.go @@ -200,8 +200,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 @@ -214,7 +223,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) @@ -242,10 +251,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) @@ -258,16 +267,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 088f1a9ae97..ad102ad41b8 100644 --- a/service/cloudfront/api_op_GetDistribution.go +++ b/service/cloudfront/api_op_GetDistribution.go @@ -187,8 +187,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 @@ -201,7 +210,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) @@ -229,10 +238,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) @@ -245,16 +254,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 c19c7008582..3500e7bcc59 100644 --- a/service/cloudfront/api_op_GetInvalidation.go +++ b/service/cloudfront/api_op_GetInvalidation.go @@ -189,8 +189,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 @@ -203,7 +212,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) @@ -231,10 +240,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) @@ -247,16 +256,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 1273f0351fa..1ae17eb15fc 100644 --- a/service/cloudfront/api_op_GetStreamingDistribution.go +++ b/service/cloudfront/api_op_GetStreamingDistribution.go @@ -191,8 +191,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 @@ -205,7 +214,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) @@ -233,10 +242,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) @@ -249,16 +258,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 4d2a275ba42..a827e2d99cb 100644 --- a/service/cloudwatch/api_op_DescribeAlarms.go +++ b/service/cloudwatch/api_op_DescribeAlarms.go @@ -313,8 +313,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 @@ -327,7 +335,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) @@ -355,10 +363,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) @@ -371,16 +379,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) { @@ -469,8 +477,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 @@ -483,7 +500,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) @@ -511,10 +528,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) @@ -527,16 +544,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 ae9161c548a..d5ee174c885 100644 --- a/service/codedeploy/api_op_GetDeployment.go +++ b/service/codedeploy/api_op_GetDeployment.go @@ -184,8 +184,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 @@ -198,7 +207,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) @@ -226,10 +235,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) @@ -242,16 +251,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 c1ca9b5eff3..a8b54ec6d81 100644 --- a/service/codegurureviewer/api_op_DescribeCodeReview.go +++ b/service/codegurureviewer/api_op_DescribeCodeReview.go @@ -182,8 +182,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 @@ -196,7 +205,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) @@ -224,10 +233,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) @@ -240,16 +249,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 5b3fe8f011f..531d15ae983 100644 --- a/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go +++ b/service/codegurureviewer/api_op_DescribeRepositoryAssociation.go @@ -201,8 +201,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 @@ -215,7 +224,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) @@ -243,10 +252,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) @@ -259,16 +268,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 5be80b2a35f..14af6af6cb0 100644 --- a/service/databasemigrationservice/api_op_DescribeConnections.go +++ b/service/databasemigrationservice/api_op_DescribeConnections.go @@ -281,8 +281,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 @@ -295,7 +304,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) @@ -323,10 +332,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) @@ -339,16 +348,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 925872529a0..9425f385c10 100644 --- a/service/databasemigrationservice/api_op_DescribeEndpoints.go +++ b/service/databasemigrationservice/api_op_DescribeEndpoints.go @@ -278,8 +278,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 @@ -292,7 +301,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) @@ -320,10 +329,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) @@ -336,16 +345,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 75c32cc84e2..fe7971f6b31 100644 --- a/service/databasemigrationservice/api_op_DescribeReplicationInstances.go +++ b/service/databasemigrationservice/api_op_DescribeReplicationInstances.go @@ -287,8 +287,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 @@ -301,7 +310,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) @@ -329,10 +338,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) @@ -345,16 +354,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) { @@ -553,8 +562,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 @@ -567,7 +585,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) @@ -595,10 +613,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) @@ -611,16 +629,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 4972990d9d1..76c0398deb2 100644 --- a/service/databasemigrationservice/api_op_DescribeReplicationTasks.go +++ b/service/databasemigrationservice/api_op_DescribeReplicationTasks.go @@ -287,8 +287,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 @@ -301,7 +310,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) @@ -329,10 +338,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) @@ -345,16 +354,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) { @@ -549,8 +558,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 @@ -563,7 +581,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) @@ -591,10 +609,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) @@ -607,16 +625,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) { @@ -908,8 +926,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 @@ -922,7 +949,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) @@ -950,10 +977,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) @@ -966,16 +993,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) { @@ -1267,8 +1294,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 @@ -1281,7 +1317,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) @@ -1309,10 +1345,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) @@ -1325,16 +1361,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 0e52a44e57d..198695493fd 100644 --- a/service/docdb/api_op_DescribeDBInstances.go +++ b/service/docdb/api_op_DescribeDBInstances.go @@ -297,8 +297,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 @@ -311,7 +320,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) @@ -339,10 +348,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) @@ -355,16 +364,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 29619d962af..492de21146c 100644 --- a/service/dynamodb/api_op_DescribeTable.go +++ b/service/dynamodb/api_op_DescribeTable.go @@ -237,8 +237,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 @@ -251,7 +259,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) @@ -279,10 +287,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) @@ -295,16 +303,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) { @@ -395,8 +403,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 @@ -409,7 +426,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) @@ -437,10 +454,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) @@ -453,16 +470,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 c3038a2046b..fcf9bac51dd 100644 --- a/service/ec2/api_op_DescribeBundleTasks.go +++ b/service/ec2/api_op_DescribeBundleTasks.go @@ -215,8 +215,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 @@ -229,7 +238,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) @@ -257,10 +266,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) @@ -273,16 +282,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 860bb776e5a..64141c47c97 100644 --- a/service/ec2/api_op_DescribeConversionTasks.go +++ b/service/ec2/api_op_DescribeConversionTasks.go @@ -186,8 +186,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 @@ -200,7 +209,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) @@ -228,10 +237,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) @@ -244,16 +253,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) { @@ -354,8 +363,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 @@ -368,7 +386,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) @@ -396,10 +414,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) @@ -412,16 +430,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) { @@ -569,8 +587,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 @@ -583,7 +610,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) @@ -611,10 +638,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) @@ -627,16 +654,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 2e0773dbc16..8f7e2341bb0 100644 --- a/service/ec2/api_op_DescribeCustomerGateways.go +++ b/service/ec2/api_op_DescribeCustomerGateways.go @@ -215,8 +215,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 @@ -229,7 +238,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) @@ -257,10 +266,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) @@ -273,16 +282,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 8cc5389f9f9..fe657d3c4d6 100644 --- a/service/ec2/api_op_DescribeExportTasks.go +++ b/service/ec2/api_op_DescribeExportTasks.go @@ -179,8 +179,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 @@ -193,7 +202,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) @@ -221,10 +230,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) @@ -237,16 +246,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) { @@ -346,8 +355,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 @@ -360,7 +378,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) @@ -388,10 +406,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) @@ -404,16 +422,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 793ef76c085..6cac44ef020 100644 --- a/service/ec2/api_op_DescribeImages.go +++ b/service/ec2/api_op_DescribeImages.go @@ -309,8 +309,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 @@ -323,7 +332,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) @@ -351,10 +360,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) @@ -367,16 +376,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) { @@ -499,8 +508,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 @@ -513,7 +530,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) @@ -541,10 +558,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) @@ -557,16 +574,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 8fca4084f58..5cce63e5e5d 100644 --- a/service/ec2/api_op_DescribeInstanceStatus.go +++ b/service/ec2/api_op_DescribeInstanceStatus.go @@ -357,8 +357,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 @@ -371,7 +380,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) @@ -399,10 +408,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) @@ -415,16 +424,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) { @@ -535,8 +544,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 @@ -549,7 +567,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) @@ -577,10 +595,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) @@ -593,16 +611,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 bc7ec208004..1143e4cca19 100644 --- a/service/ec2/api_op_DescribeInstances.go +++ b/service/ec2/api_op_DescribeInstances.go @@ -597,8 +597,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 @@ -611,7 +620,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) @@ -639,10 +648,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) @@ -655,16 +664,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) { @@ -764,8 +773,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 @@ -778,7 +796,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) @@ -806,10 +824,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) @@ -822,16 +840,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) { @@ -1014,8 +1032,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 @@ -1028,7 +1055,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) @@ -1056,10 +1083,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) @@ -1072,16 +1099,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) { @@ -1228,8 +1255,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 @@ -1242,7 +1278,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) @@ -1270,10 +1306,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) @@ -1286,16 +1322,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 8a17f2364d5..1028cd57223 100644 --- a/service/ec2/api_op_DescribeKeyPairs.go +++ b/service/ec2/api_op_DescribeKeyPairs.go @@ -209,8 +209,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 @@ -223,7 +231,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) @@ -251,10 +259,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) @@ -267,16 +275,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 603aedb6d15..0ca06aef6a0 100644 --- a/service/ec2/api_op_DescribeNatGateways.go +++ b/service/ec2/api_op_DescribeNatGateways.go @@ -298,8 +298,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 @@ -312,7 +321,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) @@ -340,10 +349,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) @@ -356,16 +365,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 de5706deef2..693b952b23e 100644 --- a/service/ec2/api_op_DescribeNetworkInterfaces.go +++ b/service/ec2/api_op_DescribeNetworkInterfaces.go @@ -404,8 +404,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 @@ -418,7 +427,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) @@ -446,10 +455,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) @@ -462,16 +471,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 5bdeb967371..23441a4a268 100644 --- a/service/ec2/api_op_DescribeSecurityGroups.go +++ b/service/ec2/api_op_DescribeSecurityGroups.go @@ -385,8 +385,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 @@ -399,7 +408,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) @@ -427,10 +436,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) @@ -443,16 +452,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 fac9e151884..d13524dfd90 100644 --- a/service/ec2/api_op_DescribeSnapshots.go +++ b/service/ec2/api_op_DescribeSnapshots.go @@ -381,8 +381,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 @@ -395,7 +404,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) @@ -423,10 +432,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) @@ -439,16 +448,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 6f4bec2e10b..6e0ad173a0a 100644 --- a/service/ec2/api_op_DescribeSpotInstanceRequests.go +++ b/service/ec2/api_op_DescribeSpotInstanceRequests.go @@ -428,8 +428,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 @@ -442,7 +451,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) @@ -470,10 +479,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) @@ -486,16 +495,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 bf8236f4760..3d8cb808bf0 100644 --- a/service/ec2/api_op_DescribeSubnets.go +++ b/service/ec2/api_op_DescribeSubnets.go @@ -330,8 +330,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 @@ -344,7 +353,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) @@ -372,10 +381,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) @@ -388,16 +397,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 d7dc365470b..a519d3a2641 100644 --- a/service/ec2/api_op_DescribeVolumes.go +++ b/service/ec2/api_op_DescribeVolumes.go @@ -355,8 +355,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 @@ -369,7 +378,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) @@ -397,10 +406,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) @@ -413,16 +422,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) { @@ -545,8 +554,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 @@ -559,7 +576,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) @@ -587,10 +604,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) @@ -603,16 +620,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) { @@ -723,8 +740,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 @@ -737,7 +762,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) @@ -765,10 +790,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) @@ -781,16 +806,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 e7613faa170..36a032977db 100644 --- a/service/ec2/api_op_DescribeVpcPeeringConnections.go +++ b/service/ec2/api_op_DescribeVpcPeeringConnections.go @@ -324,8 +324,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 @@ -338,7 +347,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) @@ -366,10 +375,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) @@ -382,16 +391,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) { @@ -506,8 +515,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 @@ -520,7 +538,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) @@ -548,10 +566,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) @@ -564,16 +582,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 7dd9d8ffb60..f7e7c85e6f0 100644 --- a/service/ec2/api_op_DescribeVpcs.go +++ b/service/ec2/api_op_DescribeVpcs.go @@ -326,8 +326,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 @@ -340,7 +348,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) @@ -368,10 +376,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) @@ -384,16 +392,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) { @@ -492,8 +500,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 @@ -506,7 +522,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) @@ -534,10 +550,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) @@ -550,16 +566,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 86f1bb66da0..3b616ac46a5 100644 --- a/service/ec2/api_op_DescribeVpnConnections.go +++ b/service/ec2/api_op_DescribeVpnConnections.go @@ -230,8 +230,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 @@ -244,7 +253,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) @@ -272,10 +281,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) @@ -288,16 +297,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) { @@ -445,8 +454,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 @@ -459,7 +477,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) @@ -487,10 +505,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) @@ -503,16 +521,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 c0f3151671e..7c205e14815 100644 --- a/service/ec2/api_op_GetPasswordData.go +++ b/service/ec2/api_op_GetPasswordData.go @@ -207,8 +207,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 @@ -221,7 +230,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) @@ -249,10 +258,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) @@ -265,16 +274,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 b61036c4d8e..361ba2955c0 100644 --- a/service/ecr/api_op_DescribeImageScanFindings.go +++ b/service/ecr/api_op_DescribeImageScanFindings.go @@ -311,8 +311,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 @@ -325,7 +334,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) @@ -353,10 +362,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) @@ -369,16 +378,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 77cf7a7c53f..9b036035233 100644 --- a/service/ecr/api_op_GetLifecyclePolicyPreview.go +++ b/service/ecr/api_op_GetLifecyclePolicyPreview.go @@ -326,8 +326,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 @@ -340,7 +349,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) @@ -368,10 +377,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) @@ -384,16 +393,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 adc2ce28839..29560dd3984 100644 --- a/service/ecs/api_op_DescribeServices.go +++ b/service/ecs/api_op_DescribeServices.go @@ -194,8 +194,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 @@ -208,7 +217,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) @@ -236,10 +245,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) @@ -252,16 +261,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 99d112b3321..5daa7f4eed5 100644 --- a/service/ecs/api_op_DescribeTasks.go +++ b/service/ecs/api_op_DescribeTasks.go @@ -192,8 +192,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 @@ -206,7 +214,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) @@ -234,10 +242,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) @@ -250,16 +258,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) { @@ -406,8 +414,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 @@ -420,7 +436,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) @@ -448,10 +464,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) @@ -464,16 +480,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 e81b4a3d2a8..94e975b0e4a 100644 --- a/service/eks/api_op_DescribeAddon.go +++ b/service/eks/api_op_DescribeAddon.go @@ -186,8 +186,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 @@ -200,7 +208,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) @@ -228,10 +236,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) @@ -244,16 +252,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) { @@ -371,8 +379,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 @@ -385,7 +401,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) @@ -413,10 +429,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) @@ -429,16 +445,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 53988dddd7d..d9068e86a16 100644 --- a/service/eks/api_op_DescribeCluster.go +++ b/service/eks/api_op_DescribeCluster.go @@ -186,8 +186,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 @@ -200,7 +208,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) @@ -228,10 +236,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) @@ -244,16 +252,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) { @@ -371,8 +379,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 @@ -385,7 +402,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) @@ -413,10 +430,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) @@ -429,16 +446,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 f3f3186b756..37c0b629b30 100644 --- a/service/eks/api_op_DescribeFargateProfile.go +++ b/service/eks/api_op_DescribeFargateProfile.go @@ -186,8 +186,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 @@ -200,7 +209,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) @@ -228,10 +237,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) @@ -244,16 +253,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) { @@ -355,8 +364,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 @@ -369,7 +387,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) @@ -397,10 +415,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) @@ -413,16 +431,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 ff84b9cd647..3db717b6b9d 100644 --- a/service/eks/api_op_DescribeNodegroup.go +++ b/service/eks/api_op_DescribeNodegroup.go @@ -185,8 +185,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 @@ -199,7 +208,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) @@ -227,10 +236,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) @@ -243,16 +252,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) { @@ -353,8 +362,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 @@ -367,7 +385,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) @@ -395,10 +413,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) @@ -411,16 +429,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 3f680696e5d..c0dd30008ad 100644 --- a/service/elasticache/api_op_DescribeCacheClusters.go +++ b/service/elasticache/api_op_DescribeCacheClusters.go @@ -299,8 +299,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 @@ -313,7 +322,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) @@ -341,10 +350,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) @@ -357,16 +366,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) { diff --git a/service/elasticache/api_op_DescribeReplicationGroups.go b/service/elasticache/api_op_DescribeReplicationGroups.go index e40f5c2b976..834d9963f5e 100644 --- a/service/elasticache/api_op_DescribeReplicationGroups.go +++ b/service/elasticache/api_op_DescribeReplicationGroups.go @@ -283,8 +283,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 @@ -297,7 +306,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) @@ -325,10 +334,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) @@ -341,16 +350,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) { @@ -475,8 +484,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 @@ -489,7 +507,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) @@ -517,10 +535,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) @@ -533,16 +551,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 4bbfae1d590..6cc824b8a9e 100644 --- a/service/elasticbeanstalk/api_op_DescribeEnvironments.go +++ b/service/elasticbeanstalk/api_op_DescribeEnvironments.go @@ -213,8 +213,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 @@ -227,7 +236,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) @@ -255,10 +264,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) @@ -271,16 +280,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) { @@ -412,8 +421,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 @@ -426,7 +444,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) @@ -454,10 +472,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) @@ -470,16 +488,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) { @@ -610,8 +628,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 @@ -624,7 +651,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) @@ -652,10 +679,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) @@ -668,16 +695,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 86e12b44749..303af2ca995 100644 --- a/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go +++ b/service/elasticloadbalancing/api_op_DescribeInstanceHealth.go @@ -189,8 +189,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 @@ -203,7 +212,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) @@ -231,10 +240,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) @@ -247,16 +256,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/elastictranscoder/api_op_ReadJob.go b/service/elastictranscoder/api_op_ReadJob.go index 17bbb857e89..adc249b34df 100644 --- a/service/elastictranscoder/api_op_ReadJob.go +++ b/service/elastictranscoder/api_op_ReadJob.go @@ -180,8 +180,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 @@ -194,7 +202,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) @@ -222,10 +230,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) @@ -238,16 +246,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 ce2d49b5676..8c52c3760f7 100644 --- a/service/emr/api_op_DescribeCluster.go +++ b/service/emr/api_op_DescribeCluster.go @@ -182,8 +182,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 @@ -196,7 +205,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) @@ -224,10 +233,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) @@ -240,16 +249,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) { @@ -401,8 +410,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 @@ -415,7 +433,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) @@ -443,10 +461,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) @@ -459,16 +477,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 87f3de02a33..6526e991e05 100644 --- a/service/emr/api_op_DescribeStep.go +++ b/service/emr/api_op_DescribeStep.go @@ -185,8 +185,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 @@ -199,7 +207,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) @@ -227,10 +235,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) @@ -243,16 +251,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 0859a47cbaa..74d2290e761 100644 --- a/service/glacier/api_op_DescribeVault.go +++ b/service/glacier/api_op_DescribeVault.go @@ -243,8 +243,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 @@ -257,7 +265,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) @@ -285,10 +293,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) @@ -301,16 +309,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) { @@ -388,8 +396,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 @@ -402,7 +419,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) @@ -430,10 +447,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) @@ -446,16 +463,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 9e23a8497de..79cf58e5721 100644 --- a/service/iam/api_op_GetInstanceProfile.go +++ b/service/iam/api_op_GetInstanceProfile.go @@ -190,8 +190,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 @@ -204,7 +213,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) @@ -232,10 +241,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) @@ -248,16 +257,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 92fd11da1e9..ab915b5d1cd 100644 --- a/service/iam/api_op_GetPolicy.go +++ b/service/iam/api_op_GetPolicy.go @@ -194,8 +194,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 @@ -208,7 +216,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) @@ -236,10 +244,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) @@ -252,16 +260,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 bc3b3f3fe5f..3a68488b12f 100644 --- a/service/iam/api_op_GetRole.go +++ b/service/iam/api_op_GetRole.go @@ -193,8 +193,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 @@ -207,7 +215,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) @@ -235,10 +243,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) @@ -251,16 +259,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 4a11b91b92a..958a1b1ef39 100644 --- a/service/iam/api_op_GetUser.go +++ b/service/iam/api_op_GetUser.go @@ -200,8 +200,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 @@ -214,7 +222,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) @@ -242,10 +250,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) @@ -258,16 +266,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 e0d8d212e4b..9d54c85ba39 100644 --- a/service/iotsitewise/api_op_DescribeAsset.go +++ b/service/iotsitewise/api_op_DescribeAsset.go @@ -260,8 +260,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 @@ -274,7 +282,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) @@ -302,10 +310,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) @@ -318,16 +326,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) { @@ -428,8 +436,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 @@ -442,7 +459,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) @@ -470,10 +487,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) @@ -486,16 +503,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 552b525cfb1..76b3bae37d8 100644 --- a/service/iotsitewise/api_op_DescribeAssetModel.go +++ b/service/iotsitewise/api_op_DescribeAssetModel.go @@ -263,8 +263,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 @@ -277,7 +286,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) @@ -305,10 +314,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) @@ -321,16 +330,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) { @@ -432,8 +441,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 @@ -446,7 +464,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) @@ -474,10 +492,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) @@ -490,16 +508,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 70c1d4f7e16..b7c2c111a95 100644 --- a/service/iotsitewise/api_op_DescribePortal.go +++ b/service/iotsitewise/api_op_DescribePortal.go @@ -285,8 +285,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 @@ -299,7 +307,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) @@ -327,10 +335,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) @@ -343,16 +351,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) { @@ -436,8 +444,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 @@ -450,7 +467,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) @@ -478,10 +495,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) @@ -494,16 +511,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 42773fab056..86fb0cb2e03 100644 --- a/service/kinesis/api_op_DescribeStream.go +++ b/service/kinesis/api_op_DescribeStream.go @@ -207,8 +207,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 @@ -221,7 +229,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) @@ -249,10 +257,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) @@ -265,16 +273,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) { @@ -358,8 +366,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 @@ -372,7 +389,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) @@ -400,10 +417,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) @@ -416,16 +433,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 178e7e281b8..548d0956dfc 100644 --- a/service/lambda/api_op_GetFunction.go +++ b/service/lambda/api_op_GetFunction.go @@ -207,8 +207,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 @@ -221,7 +230,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) @@ -249,10 +258,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) @@ -265,16 +274,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 7587d91dc3f..9a2a53fc6f2 100644 --- a/service/lambda/api_op_GetFunctionConfiguration.go +++ b/service/lambda/api_op_GetFunctionConfiguration.go @@ -300,8 +300,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 @@ -314,7 +323,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) @@ -342,10 +351,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) @@ -358,16 +367,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) { @@ -485,8 +494,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 @@ -499,7 +517,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) @@ -527,10 +545,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) @@ -543,16 +561,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/machinelearning/api_op_DescribeBatchPredictions.go b/service/machinelearning/api_op_DescribeBatchPredictions.go index 6fe46c60097..d98cd528463 100644 --- a/service/machinelearning/api_op_DescribeBatchPredictions.go +++ b/service/machinelearning/api_op_DescribeBatchPredictions.go @@ -345,8 +345,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 @@ -359,7 +368,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) @@ -387,10 +396,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) @@ -403,16 +412,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 5a931e7cbec..e9a450d2dcd 100644 --- a/service/machinelearning/api_op_DescribeDataSources.go +++ b/service/machinelearning/api_op_DescribeDataSources.go @@ -333,8 +333,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 @@ -347,7 +356,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) @@ -375,10 +384,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) @@ -391,16 +400,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 ab2a322dd48..440e94bb0e4 100644 --- a/service/machinelearning/api_op_DescribeEvaluations.go +++ b/service/machinelearning/api_op_DescribeEvaluations.go @@ -340,8 +340,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 @@ -354,7 +363,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) @@ -382,10 +391,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) @@ -398,16 +407,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 13a002b0c16..18b36f11c5c 100644 --- a/service/machinelearning/api_op_DescribeMLModels.go +++ b/service/machinelearning/api_op_DescribeMLModels.go @@ -344,8 +344,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 @@ -358,7 +367,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) @@ -386,10 +395,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) @@ -402,16 +411,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 a7a25c84f98..3f42aab0ebe 100644 --- a/service/mediaconnect/api_op_DescribeFlow.go +++ b/service/mediaconnect/api_op_DescribeFlow.go @@ -184,8 +184,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 @@ -198,7 +206,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) @@ -226,10 +234,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) @@ -242,16 +250,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) { @@ -400,8 +408,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 @@ -414,7 +430,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) @@ -442,10 +458,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) @@ -458,16 +474,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) { @@ -589,8 +605,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 @@ -603,7 +627,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) @@ -631,10 +655,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) @@ -647,16 +671,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 8b6ee85226a..19f6584885e 100644 --- a/service/medialive/api_op_DescribeChannel.go +++ b/service/medialive/api_op_DescribeChannel.go @@ -233,8 +233,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 @@ -247,7 +256,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) @@ -275,10 +284,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) @@ -291,16 +300,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) { @@ -425,8 +434,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 @@ -439,7 +457,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) @@ -467,10 +485,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) @@ -483,16 +501,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) { @@ -600,8 +618,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 @@ -614,7 +641,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) @@ -642,10 +669,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) @@ -658,16 +685,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) { @@ -775,8 +802,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 @@ -789,7 +825,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) @@ -817,10 +853,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) @@ -833,16 +869,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 fff51617398..bd1c6dc9dc5 100644 --- a/service/medialive/api_op_DescribeInput.go +++ b/service/medialive/api_op_DescribeInput.go @@ -236,8 +236,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 @@ -250,7 +258,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) @@ -278,10 +286,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) @@ -294,16 +302,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) { @@ -411,8 +419,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 @@ -425,7 +441,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) @@ -453,10 +469,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) @@ -469,16 +485,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) { @@ -586,8 +602,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 @@ -600,7 +624,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) @@ -628,10 +652,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) @@ -644,16 +668,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 3c7b18c1b68..d00a4f01e95 100644 --- a/service/medialive/api_op_DescribeMultiplex.go +++ b/service/medialive/api_op_DescribeMultiplex.go @@ -209,8 +209,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 @@ -223,7 +232,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) @@ -251,10 +260,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) @@ -267,16 +276,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) { @@ -401,8 +410,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 @@ -415,7 +433,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) @@ -443,10 +461,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) @@ -459,16 +477,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) { @@ -576,8 +594,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 @@ -590,7 +617,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) @@ -618,10 +645,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) @@ -634,16 +661,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) { @@ -751,8 +778,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 @@ -765,7 +801,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) @@ -793,10 +829,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) @@ -809,16 +845,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 1dade5a6a0f..b02f8800d78 100644 --- a/service/neptune/api_op_DescribeDBInstances.go +++ b/service/neptune/api_op_DescribeDBInstances.go @@ -299,8 +299,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 @@ -313,7 +322,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) @@ -341,10 +350,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) @@ -357,16 +366,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/opsworks/api_op_DescribeApps.go b/service/opsworks/api_op_DescribeApps.go index 4e6b1684ce4..47e8ed7eeb7 100644 --- a/service/opsworks/api_op_DescribeApps.go +++ b/service/opsworks/api_op_DescribeApps.go @@ -184,8 +184,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 @@ -198,7 +206,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) @@ -226,10 +234,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) @@ -242,16 +250,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 17ef924c4b7..53d087eaa21 100644 --- a/service/opsworks/api_op_DescribeDeployments.go +++ b/service/opsworks/api_op_DescribeDeployments.go @@ -191,8 +191,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 @@ -205,7 +214,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) @@ -233,10 +242,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) @@ -249,16 +258,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 4b321483218..f744803cec6 100644 --- a/service/opsworks/api_op_DescribeInstances.go +++ b/service/opsworks/api_op_DescribeInstances.go @@ -191,8 +191,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 @@ -205,7 +214,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) @@ -233,10 +242,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) @@ -249,16 +258,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) { @@ -549,8 +558,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 @@ -563,7 +581,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) @@ -591,10 +609,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) @@ -607,16 +625,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) { @@ -883,8 +901,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 @@ -897,7 +924,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) @@ -925,10 +952,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) @@ -941,16 +968,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) { @@ -1241,8 +1268,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 @@ -1255,7 +1291,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) @@ -1283,10 +1319,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) @@ -1299,16 +1335,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 d7078cb23a4..635024bcd0f 100644 --- a/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go +++ b/service/opsworkscm/api_op_DescribeNodeAssociationStatus.go @@ -202,8 +202,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 @@ -216,7 +225,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) @@ -244,10 +253,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) @@ -260,16 +269,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 a38030b984f..8ad527a9be5 100644 --- a/service/proton/api_op_GetEnvironment.go +++ b/service/proton/api_op_GetEnvironment.go @@ -182,8 +182,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 @@ -196,7 +205,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) @@ -224,10 +233,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) @@ -240,16 +249,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 0a85a67c664..2122ab0c541 100644 --- a/service/proton/api_op_GetEnvironmentTemplateVersion.go +++ b/service/proton/api_op_GetEnvironmentTemplateVersion.go @@ -196,8 +196,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 @@ -210,7 +219,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) @@ -238,10 +247,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) @@ -254,16 +263,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 625db866f17..c12293e6a79 100644 --- a/service/proton/api_op_GetService.go +++ b/service/proton/api_op_GetService.go @@ -179,8 +179,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 @@ -193,7 +202,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) @@ -221,10 +230,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) @@ -237,16 +246,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) { @@ -381,8 +390,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 @@ -395,7 +413,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) @@ -423,10 +441,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) @@ -439,16 +457,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) { @@ -600,8 +618,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 @@ -614,7 +641,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) @@ -642,10 +669,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) @@ -658,16 +685,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) { @@ -760,8 +787,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 @@ -774,7 +810,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) @@ -802,10 +838,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) @@ -818,16 +854,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 88b490932d8..d74b178acf6 100644 --- a/service/proton/api_op_GetServiceInstance.go +++ b/service/proton/api_op_GetServiceInstance.go @@ -189,8 +189,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 @@ -203,7 +212,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) @@ -231,10 +240,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) @@ -247,16 +256,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 8a8c8c4f1b4..52a26e80cf6 100644 --- a/service/proton/api_op_GetServiceTemplateVersion.go +++ b/service/proton/api_op_GetServiceTemplateVersion.go @@ -196,8 +196,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 @@ -210,7 +219,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) @@ -238,10 +247,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) @@ -254,16 +263,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 f2a75784ea0..b9ec49a497d 100644 --- a/service/rds/api_op_DescribeDBClusterSnapshots.go +++ b/service/rds/api_op_DescribeDBClusterSnapshots.go @@ -362,8 +362,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 @@ -376,7 +385,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) @@ -404,10 +413,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) @@ -420,16 +429,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) { @@ -650,8 +659,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 @@ -664,7 +682,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) @@ -692,10 +710,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) @@ -708,16 +726,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 f3ddab61d3e..0f2d71c7ed4 100644 --- a/service/rds/api_op_DescribeDBInstances.go +++ b/service/rds/api_op_DescribeDBInstances.go @@ -311,8 +311,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 @@ -325,7 +334,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) @@ -353,10 +362,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) @@ -369,16 +378,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/rds/api_op_DescribeDBSnapshots.go b/service/rds/api_op_DescribeDBSnapshots.go index 0b8572acdd5..598adfed74e 100644 --- a/service/rds/api_op_DescribeDBSnapshots.go +++ b/service/rds/api_op_DescribeDBSnapshots.go @@ -363,8 +363,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 @@ -377,7 +386,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) @@ -405,10 +414,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) @@ -421,16 +430,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) { diff --git a/service/redshift/api_op_DescribeClusterSnapshots.go b/service/redshift/api_op_DescribeClusterSnapshots.go index bc4a4f946c1..898fd3165cd 100644 --- a/service/redshift/api_op_DescribeClusterSnapshots.go +++ b/service/redshift/api_op_DescribeClusterSnapshots.go @@ -359,8 +359,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 @@ -373,7 +382,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) @@ -401,10 +410,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) @@ -417,16 +426,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 a508a38faa8..a91fdd7499d 100644 --- a/service/redshift/api_op_DescribeClusters.go +++ b/service/redshift/api_op_DescribeClusters.go @@ -311,8 +311,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 @@ -325,7 +334,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) @@ -353,10 +362,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) @@ -369,16 +378,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) { @@ -513,8 +522,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 @@ -527,7 +545,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) @@ -555,10 +573,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) @@ -571,16 +589,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) { @@ -707,8 +725,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 @@ -721,7 +748,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) @@ -749,10 +776,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) @@ -765,16 +792,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 9188c8ea986..e16baf51103 100644 --- a/service/rekognition/api_op_DescribeProjectVersions.go +++ b/service/rekognition/api_op_DescribeProjectVersions.go @@ -290,8 +290,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 @@ -304,7 +313,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) @@ -332,10 +341,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) @@ -348,16 +357,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) { @@ -485,8 +494,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 @@ -499,7 +517,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) @@ -527,10 +545,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) @@ -543,16 +561,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 7caff639546..5a1f084a099 100644 --- a/service/route53/api_op_GetChange.go +++ b/service/route53/api_op_GetChange.go @@ -198,8 +198,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 @@ -212,7 +221,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) @@ -240,10 +249,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) @@ -256,16 +265,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/s3/api_op_HeadBucket.go b/service/s3/api_op_HeadBucket.go index 65d098b633e..a83a8b8aa39 100644 --- a/service/s3/api_op_HeadBucket.go +++ b/service/s3/api_op_HeadBucket.go @@ -215,8 +215,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 @@ -229,7 +237,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) @@ -257,10 +265,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) @@ -273,16 +281,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) { @@ -360,8 +368,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 @@ -374,7 +391,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) @@ -402,10 +419,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) @@ -418,16 +435,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 c38d520b6c9..e9b95ea913c 100644 --- a/service/s3/api_op_HeadObject.go +++ b/service/s3/api_op_HeadObject.go @@ -516,8 +516,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 @@ -530,7 +538,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) @@ -558,10 +566,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) @@ -574,16 +582,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) { @@ -666,8 +674,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 @@ -680,7 +697,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) @@ -708,10 +725,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) @@ -724,16 +741,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 729d9a2b3db..0de4de20331 100644 --- a/service/sagemaker/api_op_DescribeEndpoint.go +++ b/service/sagemaker/api_op_DescribeEndpoint.go @@ -253,8 +253,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 @@ -267,7 +276,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) @@ -295,10 +304,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) @@ -311,16 +320,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) { @@ -416,8 +425,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 @@ -430,7 +448,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) @@ -458,10 +476,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) @@ -474,16 +492,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_DescribeNotebookInstance.go b/service/sagemaker/api_op_DescribeNotebookInstance.go index 62f9ec4c51e..bb44999e93e 100644 --- a/service/sagemaker/api_op_DescribeNotebookInstance.go +++ b/service/sagemaker/api_op_DescribeNotebookInstance.go @@ -274,8 +274,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 @@ -288,7 +297,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) @@ -316,10 +325,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) @@ -332,16 +341,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) { @@ -440,8 +449,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 @@ -454,7 +472,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) @@ -482,10 +500,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) @@ -498,16 +516,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) { @@ -610,8 +628,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 @@ -624,7 +651,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) @@ -652,10 +679,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) @@ -668,16 +695,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 66b8978426d..cebbf442e3e 100644 --- a/service/sagemaker/api_op_DescribeProcessingJob.go +++ b/service/sagemaker/api_op_DescribeProcessingJob.go @@ -266,8 +266,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 @@ -280,7 +289,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) @@ -308,10 +317,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) @@ -324,16 +333,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 6c03e32b1f0..dce10a64f4c 100644 --- a/service/sagemaker/api_op_DescribeTrainingJob.go +++ b/service/sagemaker/api_op_DescribeTrainingJob.go @@ -456,8 +456,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 @@ -470,7 +479,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) @@ -498,10 +507,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) @@ -514,16 +523,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 4950f121e2e..c8ac78c3962 100644 --- a/service/sagemaker/api_op_DescribeTransformJob.go +++ b/service/sagemaker/api_op_DescribeTransformJob.go @@ -290,8 +290,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 @@ -304,7 +313,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) @@ -332,10 +341,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) @@ -348,16 +357,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 b30afc29a9d..07899fd1bc8 100644 --- a/service/schemas/api_op_DescribeCodeBinding.go +++ b/service/schemas/api_op_DescribeCodeBinding.go @@ -202,8 +202,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 @@ -216,7 +225,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) @@ -244,10 +253,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) @@ -260,16 +269,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 26b24446997..f32928b7a88 100644 --- a/service/ses/api_op_GetIdentityVerificationAttributes.go +++ b/service/ses/api_op_GetIdentityVerificationAttributes.go @@ -204,8 +204,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 @@ -218,7 +227,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) @@ -246,10 +255,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) @@ -262,16 +271,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 18c33dc7553..b56f2fb383b 100644 --- a/service/signer/api_op_DescribeSigningJob.go +++ b/service/signer/api_op_DescribeSigningJob.go @@ -240,8 +240,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 @@ -254,7 +263,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) @@ -282,10 +291,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) @@ -298,16 +307,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 7908a6f3a39..66a3a9beaf7 100644 --- a/service/ssm/api_op_GetCommandInvocation.go +++ b/service/ssm/api_op_GetCommandInvocation.go @@ -323,8 +323,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 @@ -337,7 +346,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) @@ -365,10 +374,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) @@ -381,16 +390,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 0a283a96189..f1f443becf5 100644 --- a/service/ssmincidents/api_op_GetReplicationSet.go +++ b/service/ssmincidents/api_op_GetReplicationSet.go @@ -186,8 +186,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 @@ -200,7 +209,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) @@ -228,10 +237,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) @@ -244,16 +253,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) { @@ -392,8 +401,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 @@ -406,7 +424,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) @@ -434,10 +452,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) @@ -450,16 +468,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) {