github.com/aavshr/aws-sdk-go@v1.41.3/service/kinesis/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package kinesis 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 // WaitUntilStreamExists uses the Kinesis API operation 13 // DescribeStream 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 *Kinesis) WaitUntilStreamExists(input *DescribeStreamInput) error { 17 return c.WaitUntilStreamExistsWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilStreamExistsWithContext is an extended version of WaitUntilStreamExists. 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 *Kinesis) WaitUntilStreamExistsWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilStreamExists", 31 MaxAttempts: 18, 32 Delay: request.ConstantWaiterDelay(10 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "StreamDescription.StreamStatus", 37 Expected: "ACTIVE", 38 }, 39 }, 40 Logger: c.Config.Logger, 41 NewRequest: func(opts []request.Option) (*request.Request, error) { 42 var inCpy *DescribeStreamInput 43 if input != nil { 44 tmp := *input 45 inCpy = &tmp 46 } 47 req, _ := c.DescribeStreamRequest(inCpy) 48 req.SetContext(ctx) 49 req.ApplyOptions(opts...) 50 return req, nil 51 }, 52 } 53 w.ApplyOptions(opts...) 54 55 return w.WaitWithContext(ctx) 56 } 57 58 // WaitUntilStreamNotExists uses the Kinesis API operation 59 // DescribeStream to wait for a condition to be met before returning. 60 // If the condition is not met within the max attempt window, an error will 61 // be returned. 62 func (c *Kinesis) WaitUntilStreamNotExists(input *DescribeStreamInput) error { 63 return c.WaitUntilStreamNotExistsWithContext(aws.BackgroundContext(), input) 64 } 65 66 // WaitUntilStreamNotExistsWithContext is an extended version of WaitUntilStreamNotExists. 67 // With the support for passing in a context and options to configure the 68 // Waiter and the underlying request options. 69 // 70 // The context must be non-nil and will be used for request cancellation. If 71 // the context is nil a panic will occur. In the future the SDK may create 72 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 73 // for more information on using Contexts. 74 func (c *Kinesis) WaitUntilStreamNotExistsWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.WaiterOption) error { 75 w := request.Waiter{ 76 Name: "WaitUntilStreamNotExists", 77 MaxAttempts: 18, 78 Delay: request.ConstantWaiterDelay(10 * time.Second), 79 Acceptors: []request.WaiterAcceptor{ 80 { 81 State: request.SuccessWaiterState, 82 Matcher: request.ErrorWaiterMatch, 83 Expected: "ResourceNotFoundException", 84 }, 85 }, 86 Logger: c.Config.Logger, 87 NewRequest: func(opts []request.Option) (*request.Request, error) { 88 var inCpy *DescribeStreamInput 89 if input != nil { 90 tmp := *input 91 inCpy = &tmp 92 } 93 req, _ := c.DescribeStreamRequest(inCpy) 94 req.SetContext(ctx) 95 req.ApplyOptions(opts...) 96 return req, nil 97 }, 98 } 99 w.ApplyOptions(opts...) 100 101 return w.WaitWithContext(ctx) 102 }