github.com/aavshr/aws-sdk-go@v1.41.3/service/mediaconnect/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package mediaconnect 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 // WaitUntilFlowActive uses the AWS MediaConnect API operation 13 // DescribeFlow 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 *MediaConnect) WaitUntilFlowActive(input *DescribeFlowInput) error { 17 return c.WaitUntilFlowActiveWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilFlowActiveWithContext is an extended version of WaitUntilFlowActive. 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 *MediaConnect) WaitUntilFlowActiveWithContext(ctx aws.Context, input *DescribeFlowInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilFlowActive", 31 MaxAttempts: 40, 32 Delay: request.ConstantWaiterDelay(3 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 37 Expected: "ACTIVE", 38 }, 39 { 40 State: request.RetryWaiterState, 41 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 42 Expected: "STARTING", 43 }, 44 { 45 State: request.RetryWaiterState, 46 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 47 Expected: "UPDATING", 48 }, 49 { 50 State: request.RetryWaiterState, 51 Matcher: request.StatusWaiterMatch, 52 Expected: 500, 53 }, 54 { 55 State: request.RetryWaiterState, 56 Matcher: request.StatusWaiterMatch, 57 Expected: 503, 58 }, 59 { 60 State: request.FailureWaiterState, 61 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 62 Expected: "ERROR", 63 }, 64 }, 65 Logger: c.Config.Logger, 66 NewRequest: func(opts []request.Option) (*request.Request, error) { 67 var inCpy *DescribeFlowInput 68 if input != nil { 69 tmp := *input 70 inCpy = &tmp 71 } 72 req, _ := c.DescribeFlowRequest(inCpy) 73 req.SetContext(ctx) 74 req.ApplyOptions(opts...) 75 return req, nil 76 }, 77 } 78 w.ApplyOptions(opts...) 79 80 return w.WaitWithContext(ctx) 81 } 82 83 // WaitUntilFlowDeleted uses the AWS MediaConnect API operation 84 // DescribeFlow to wait for a condition to be met before returning. 85 // If the condition is not met within the max attempt window, an error will 86 // be returned. 87 func (c *MediaConnect) WaitUntilFlowDeleted(input *DescribeFlowInput) error { 88 return c.WaitUntilFlowDeletedWithContext(aws.BackgroundContext(), input) 89 } 90 91 // WaitUntilFlowDeletedWithContext is an extended version of WaitUntilFlowDeleted. 92 // With the support for passing in a context and options to configure the 93 // Waiter and the underlying request options. 94 // 95 // The context must be non-nil and will be used for request cancellation. If 96 // the context is nil a panic will occur. In the future the SDK may create 97 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 98 // for more information on using Contexts. 99 func (c *MediaConnect) WaitUntilFlowDeletedWithContext(ctx aws.Context, input *DescribeFlowInput, opts ...request.WaiterOption) error { 100 w := request.Waiter{ 101 Name: "WaitUntilFlowDeleted", 102 MaxAttempts: 40, 103 Delay: request.ConstantWaiterDelay(3 * time.Second), 104 Acceptors: []request.WaiterAcceptor{ 105 { 106 State: request.SuccessWaiterState, 107 Matcher: request.StatusWaiterMatch, 108 Expected: 404, 109 }, 110 { 111 State: request.RetryWaiterState, 112 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 113 Expected: "DELETING", 114 }, 115 { 116 State: request.RetryWaiterState, 117 Matcher: request.StatusWaiterMatch, 118 Expected: 500, 119 }, 120 { 121 State: request.RetryWaiterState, 122 Matcher: request.StatusWaiterMatch, 123 Expected: 503, 124 }, 125 { 126 State: request.FailureWaiterState, 127 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 128 Expected: "ERROR", 129 }, 130 }, 131 Logger: c.Config.Logger, 132 NewRequest: func(opts []request.Option) (*request.Request, error) { 133 var inCpy *DescribeFlowInput 134 if input != nil { 135 tmp := *input 136 inCpy = &tmp 137 } 138 req, _ := c.DescribeFlowRequest(inCpy) 139 req.SetContext(ctx) 140 req.ApplyOptions(opts...) 141 return req, nil 142 }, 143 } 144 w.ApplyOptions(opts...) 145 146 return w.WaitWithContext(ctx) 147 } 148 149 // WaitUntilFlowStandby uses the AWS MediaConnect API operation 150 // DescribeFlow to wait for a condition to be met before returning. 151 // If the condition is not met within the max attempt window, an error will 152 // be returned. 153 func (c *MediaConnect) WaitUntilFlowStandby(input *DescribeFlowInput) error { 154 return c.WaitUntilFlowStandbyWithContext(aws.BackgroundContext(), input) 155 } 156 157 // WaitUntilFlowStandbyWithContext is an extended version of WaitUntilFlowStandby. 158 // With the support for passing in a context and options to configure the 159 // Waiter and the underlying request options. 160 // 161 // The context must be non-nil and will be used for request cancellation. If 162 // the context is nil a panic will occur. In the future the SDK may create 163 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 164 // for more information on using Contexts. 165 func (c *MediaConnect) WaitUntilFlowStandbyWithContext(ctx aws.Context, input *DescribeFlowInput, opts ...request.WaiterOption) error { 166 w := request.Waiter{ 167 Name: "WaitUntilFlowStandby", 168 MaxAttempts: 40, 169 Delay: request.ConstantWaiterDelay(3 * time.Second), 170 Acceptors: []request.WaiterAcceptor{ 171 { 172 State: request.SuccessWaiterState, 173 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 174 Expected: "STANDBY", 175 }, 176 { 177 State: request.RetryWaiterState, 178 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 179 Expected: "STOPPING", 180 }, 181 { 182 State: request.RetryWaiterState, 183 Matcher: request.StatusWaiterMatch, 184 Expected: 500, 185 }, 186 { 187 State: request.RetryWaiterState, 188 Matcher: request.StatusWaiterMatch, 189 Expected: 503, 190 }, 191 { 192 State: request.FailureWaiterState, 193 Matcher: request.PathWaiterMatch, Argument: "Flow.Status", 194 Expected: "ERROR", 195 }, 196 }, 197 Logger: c.Config.Logger, 198 NewRequest: func(opts []request.Option) (*request.Request, error) { 199 var inCpy *DescribeFlowInput 200 if input != nil { 201 tmp := *input 202 inCpy = &tmp 203 } 204 req, _ := c.DescribeFlowRequest(inCpy) 205 req.SetContext(ctx) 206 req.ApplyOptions(opts...) 207 return req, nil 208 }, 209 } 210 w.ApplyOptions(opts...) 211 212 return w.WaitWithContext(ctx) 213 }