github.com/aavshr/aws-sdk-go@v1.41.3/service/lambda/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package lambda 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 // WaitUntilFunctionActive uses the AWS Lambda API operation 13 // GetFunctionConfiguration 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 *Lambda) WaitUntilFunctionActive(input *GetFunctionConfigurationInput) error { 17 return c.WaitUntilFunctionActiveWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilFunctionActiveWithContext is an extended version of WaitUntilFunctionActive. 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 *Lambda) WaitUntilFunctionActiveWithContext(ctx aws.Context, input *GetFunctionConfigurationInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilFunctionActive", 31 MaxAttempts: 60, 32 Delay: request.ConstantWaiterDelay(5 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "State", 37 Expected: "Active", 38 }, 39 { 40 State: request.FailureWaiterState, 41 Matcher: request.PathWaiterMatch, Argument: "State", 42 Expected: "Failed", 43 }, 44 { 45 State: request.RetryWaiterState, 46 Matcher: request.PathWaiterMatch, Argument: "State", 47 Expected: "Pending", 48 }, 49 }, 50 Logger: c.Config.Logger, 51 NewRequest: func(opts []request.Option) (*request.Request, error) { 52 var inCpy *GetFunctionConfigurationInput 53 if input != nil { 54 tmp := *input 55 inCpy = &tmp 56 } 57 req, _ := c.GetFunctionConfigurationRequest(inCpy) 58 req.SetContext(ctx) 59 req.ApplyOptions(opts...) 60 return req, nil 61 }, 62 } 63 w.ApplyOptions(opts...) 64 65 return w.WaitWithContext(ctx) 66 } 67 68 // WaitUntilFunctionExists uses the AWS Lambda API operation 69 // GetFunction to wait for a condition to be met before returning. 70 // If the condition is not met within the max attempt window, an error will 71 // be returned. 72 func (c *Lambda) WaitUntilFunctionExists(input *GetFunctionInput) error { 73 return c.WaitUntilFunctionExistsWithContext(aws.BackgroundContext(), input) 74 } 75 76 // WaitUntilFunctionExistsWithContext is an extended version of WaitUntilFunctionExists. 77 // With the support for passing in a context and options to configure the 78 // Waiter and the underlying request options. 79 // 80 // The context must be non-nil and will be used for request cancellation. If 81 // the context is nil a panic will occur. In the future the SDK may create 82 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 83 // for more information on using Contexts. 84 func (c *Lambda) WaitUntilFunctionExistsWithContext(ctx aws.Context, input *GetFunctionInput, opts ...request.WaiterOption) error { 85 w := request.Waiter{ 86 Name: "WaitUntilFunctionExists", 87 MaxAttempts: 20, 88 Delay: request.ConstantWaiterDelay(1 * time.Second), 89 Acceptors: []request.WaiterAcceptor{ 90 { 91 State: request.SuccessWaiterState, 92 Matcher: request.StatusWaiterMatch, 93 Expected: 200, 94 }, 95 { 96 State: request.RetryWaiterState, 97 Matcher: request.ErrorWaiterMatch, 98 Expected: "ResourceNotFoundException", 99 }, 100 }, 101 Logger: c.Config.Logger, 102 NewRequest: func(opts []request.Option) (*request.Request, error) { 103 var inCpy *GetFunctionInput 104 if input != nil { 105 tmp := *input 106 inCpy = &tmp 107 } 108 req, _ := c.GetFunctionRequest(inCpy) 109 req.SetContext(ctx) 110 req.ApplyOptions(opts...) 111 return req, nil 112 }, 113 } 114 w.ApplyOptions(opts...) 115 116 return w.WaitWithContext(ctx) 117 } 118 119 // WaitUntilFunctionUpdated uses the AWS Lambda API operation 120 // GetFunctionConfiguration to wait for a condition to be met before returning. 121 // If the condition is not met within the max attempt window, an error will 122 // be returned. 123 func (c *Lambda) WaitUntilFunctionUpdated(input *GetFunctionConfigurationInput) error { 124 return c.WaitUntilFunctionUpdatedWithContext(aws.BackgroundContext(), input) 125 } 126 127 // WaitUntilFunctionUpdatedWithContext is an extended version of WaitUntilFunctionUpdated. 128 // With the support for passing in a context and options to configure the 129 // Waiter and the underlying request options. 130 // 131 // The context must be non-nil and will be used for request cancellation. If 132 // the context is nil a panic will occur. In the future the SDK may create 133 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 134 // for more information on using Contexts. 135 func (c *Lambda) WaitUntilFunctionUpdatedWithContext(ctx aws.Context, input *GetFunctionConfigurationInput, opts ...request.WaiterOption) error { 136 w := request.Waiter{ 137 Name: "WaitUntilFunctionUpdated", 138 MaxAttempts: 60, 139 Delay: request.ConstantWaiterDelay(5 * time.Second), 140 Acceptors: []request.WaiterAcceptor{ 141 { 142 State: request.SuccessWaiterState, 143 Matcher: request.PathWaiterMatch, Argument: "LastUpdateStatus", 144 Expected: "Successful", 145 }, 146 { 147 State: request.FailureWaiterState, 148 Matcher: request.PathWaiterMatch, Argument: "LastUpdateStatus", 149 Expected: "Failed", 150 }, 151 { 152 State: request.RetryWaiterState, 153 Matcher: request.PathWaiterMatch, Argument: "LastUpdateStatus", 154 Expected: "InProgress", 155 }, 156 }, 157 Logger: c.Config.Logger, 158 NewRequest: func(opts []request.Option) (*request.Request, error) { 159 var inCpy *GetFunctionConfigurationInput 160 if input != nil { 161 tmp := *input 162 inCpy = &tmp 163 } 164 req, _ := c.GetFunctionConfigurationRequest(inCpy) 165 req.SetContext(ctx) 166 req.ApplyOptions(opts...) 167 return req, nil 168 }, 169 } 170 w.ApplyOptions(opts...) 171 172 return w.WaitWithContext(ctx) 173 }