github.com/aavshr/aws-sdk-go@v1.41.3/service/schemas/waiters.go (about)

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package schemas
     4  
     5  import (
     6  	"time"
     7  
     8  	"github.com/aavshr/aws-sdk-go/aws"
     9  	"github.com/aavshr/aws-sdk-go/aws/request"
    10  )
    11  
    12  // WaitUntilCodeBindingExists uses the Schemas API operation
    13  // DescribeCodeBinding to wait for a condition to be met before returning.
    14  // If the condition is not met within the max attempt window, an error will
    15  // be returned.
    16  func (c *Schemas) WaitUntilCodeBindingExists(input *DescribeCodeBindingInput) error {
    17  	return c.WaitUntilCodeBindingExistsWithContext(aws.BackgroundContext(), input)
    18  }
    19  
    20  // WaitUntilCodeBindingExistsWithContext is an extended version of WaitUntilCodeBindingExists.
    21  // With the support for passing in a context and options to configure the
    22  // Waiter and the underlying request options.
    23  //
    24  // The context must be non-nil and will be used for request cancellation. If
    25  // the context is nil a panic will occur. In the future the SDK may create
    26  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
    27  // for more information on using Contexts.
    28  func (c *Schemas) WaitUntilCodeBindingExistsWithContext(ctx aws.Context, input *DescribeCodeBindingInput, opts ...request.WaiterOption) error {
    29  	w := request.Waiter{
    30  		Name:        "WaitUntilCodeBindingExists",
    31  		MaxAttempts: 30,
    32  		Delay:       request.ConstantWaiterDelay(2 * time.Second),
    33  		Acceptors: []request.WaiterAcceptor{
    34  			{
    35  				State:   request.SuccessWaiterState,
    36  				Matcher: request.PathWaiterMatch, Argument: "Status",
    37  				Expected: "CREATE_COMPLETE",
    38  			},
    39  			{
    40  				State:   request.RetryWaiterState,
    41  				Matcher: request.PathWaiterMatch, Argument: "Status",
    42  				Expected: "CREATE_IN_PROGRESS",
    43  			},
    44  			{
    45  				State:   request.FailureWaiterState,
    46  				Matcher: request.PathWaiterMatch, Argument: "Status",
    47  				Expected: "CREATE_FAILED",
    48  			},
    49  			{
    50  				State:    request.FailureWaiterState,
    51  				Matcher:  request.ErrorWaiterMatch,
    52  				Expected: "NotFoundException",
    53  			},
    54  		},
    55  		Logger: c.Config.Logger,
    56  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    57  			var inCpy *DescribeCodeBindingInput
    58  			if input != nil {
    59  				tmp := *input
    60  				inCpy = &tmp
    61  			}
    62  			req, _ := c.DescribeCodeBindingRequest(inCpy)
    63  			req.SetContext(ctx)
    64  			req.ApplyOptions(opts...)
    65  			return req, nil
    66  		},
    67  	}
    68  	w.ApplyOptions(opts...)
    69  
    70  	return w.WaitWithContext(ctx)
    71  }