1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package medialive
4
5import (
6	"time"
7
8	"github.com/aws/aws-sdk-go/aws"
9	"github.com/aws/aws-sdk-go/aws/request"
10)
11
12// WaitUntilChannelCreated uses the MediaLive API operation
13// DescribeChannel 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.
16func (c *MediaLive) WaitUntilChannelCreated(input *DescribeChannelInput) error {
17	return c.WaitUntilChannelCreatedWithContext(aws.BackgroundContext(), input)
18}
19
20// WaitUntilChannelCreatedWithContext is an extended version of WaitUntilChannelCreated.
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.
28func (c *MediaLive) WaitUntilChannelCreatedWithContext(ctx aws.Context, input *DescribeChannelInput, opts ...request.WaiterOption) error {
29	w := request.Waiter{
30		Name:        "WaitUntilChannelCreated",
31		MaxAttempts: 5,
32		Delay:       request.ConstantWaiterDelay(3 * time.Second),
33		Acceptors: []request.WaiterAcceptor{
34			{
35				State:   request.SuccessWaiterState,
36				Matcher: request.PathWaiterMatch, Argument: "State",
37				Expected: "IDLE",
38			},
39			{
40				State:   request.RetryWaiterState,
41				Matcher: request.PathWaiterMatch, Argument: "State",
42				Expected: "CREATING",
43			},
44			{
45				State:    request.RetryWaiterState,
46				Matcher:  request.StatusWaiterMatch,
47				Expected: 500,
48			},
49			{
50				State:   request.FailureWaiterState,
51				Matcher: request.PathWaiterMatch, Argument: "State",
52				Expected: "CREATE_FAILED",
53			},
54		},
55		Logger: c.Config.Logger,
56		NewRequest: func(opts []request.Option) (*request.Request, error) {
57			var inCpy *DescribeChannelInput
58			if input != nil {
59				tmp := *input
60				inCpy = &tmp
61			}
62			req, _ := c.DescribeChannelRequest(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}
72
73// WaitUntilChannelDeleted uses the MediaLive API operation
74// DescribeChannel to wait for a condition to be met before returning.
75// If the condition is not met within the max attempt window, an error will
76// be returned.
77func (c *MediaLive) WaitUntilChannelDeleted(input *DescribeChannelInput) error {
78	return c.WaitUntilChannelDeletedWithContext(aws.BackgroundContext(), input)
79}
80
81// WaitUntilChannelDeletedWithContext is an extended version of WaitUntilChannelDeleted.
82// With the support for passing in a context and options to configure the
83// Waiter and the underlying request options.
84//
85// The context must be non-nil and will be used for request cancellation. If
86// the context is nil a panic will occur. In the future the SDK may create
87// sub-contexts for http.Requests. See https://golang.org/pkg/context/
88// for more information on using Contexts.
89func (c *MediaLive) WaitUntilChannelDeletedWithContext(ctx aws.Context, input *DescribeChannelInput, opts ...request.WaiterOption) error {
90	w := request.Waiter{
91		Name:        "WaitUntilChannelDeleted",
92		MaxAttempts: 20,
93		Delay:       request.ConstantWaiterDelay(5 * time.Second),
94		Acceptors: []request.WaiterAcceptor{
95			{
96				State:   request.SuccessWaiterState,
97				Matcher: request.PathWaiterMatch, Argument: "State",
98				Expected: "DELETED",
99			},
100			{
101				State:   request.RetryWaiterState,
102				Matcher: request.PathWaiterMatch, Argument: "State",
103				Expected: "DELETING",
104			},
105			{
106				State:    request.RetryWaiterState,
107				Matcher:  request.StatusWaiterMatch,
108				Expected: 500,
109			},
110		},
111		Logger: c.Config.Logger,
112		NewRequest: func(opts []request.Option) (*request.Request, error) {
113			var inCpy *DescribeChannelInput
114			if input != nil {
115				tmp := *input
116				inCpy = &tmp
117			}
118			req, _ := c.DescribeChannelRequest(inCpy)
119			req.SetContext(ctx)
120			req.ApplyOptions(opts...)
121			return req, nil
122		},
123	}
124	w.ApplyOptions(opts...)
125
126	return w.WaitWithContext(ctx)
127}
128
129// WaitUntilChannelRunning uses the MediaLive API operation
130// DescribeChannel to wait for a condition to be met before returning.
131// If the condition is not met within the max attempt window, an error will
132// be returned.
133func (c *MediaLive) WaitUntilChannelRunning(input *DescribeChannelInput) error {
134	return c.WaitUntilChannelRunningWithContext(aws.BackgroundContext(), input)
135}
136
137// WaitUntilChannelRunningWithContext is an extended version of WaitUntilChannelRunning.
138// With the support for passing in a context and options to configure the
139// Waiter and the underlying request options.
140//
141// The context must be non-nil and will be used for request cancellation. If
142// the context is nil a panic will occur. In the future the SDK may create
143// sub-contexts for http.Requests. See https://golang.org/pkg/context/
144// for more information on using Contexts.
145func (c *MediaLive) WaitUntilChannelRunningWithContext(ctx aws.Context, input *DescribeChannelInput, opts ...request.WaiterOption) error {
146	w := request.Waiter{
147		Name:        "WaitUntilChannelRunning",
148		MaxAttempts: 120,
149		Delay:       request.ConstantWaiterDelay(5 * time.Second),
150		Acceptors: []request.WaiterAcceptor{
151			{
152				State:   request.SuccessWaiterState,
153				Matcher: request.PathWaiterMatch, Argument: "State",
154				Expected: "RUNNING",
155			},
156			{
157				State:   request.RetryWaiterState,
158				Matcher: request.PathWaiterMatch, Argument: "State",
159				Expected: "STARTING",
160			},
161			{
162				State:    request.RetryWaiterState,
163				Matcher:  request.StatusWaiterMatch,
164				Expected: 500,
165			},
166		},
167		Logger: c.Config.Logger,
168		NewRequest: func(opts []request.Option) (*request.Request, error) {
169			var inCpy *DescribeChannelInput
170			if input != nil {
171				tmp := *input
172				inCpy = &tmp
173			}
174			req, _ := c.DescribeChannelRequest(inCpy)
175			req.SetContext(ctx)
176			req.ApplyOptions(opts...)
177			return req, nil
178		},
179	}
180	w.ApplyOptions(opts...)
181
182	return w.WaitWithContext(ctx)
183}
184
185// WaitUntilChannelStopped uses the MediaLive API operation
186// DescribeChannel to wait for a condition to be met before returning.
187// If the condition is not met within the max attempt window, an error will
188// be returned.
189func (c *MediaLive) WaitUntilChannelStopped(input *DescribeChannelInput) error {
190	return c.WaitUntilChannelStoppedWithContext(aws.BackgroundContext(), input)
191}
192
193// WaitUntilChannelStoppedWithContext is an extended version of WaitUntilChannelStopped.
194// With the support for passing in a context and options to configure the
195// Waiter and the underlying request options.
196//
197// The context must be non-nil and will be used for request cancellation. If
198// the context is nil a panic will occur. In the future the SDK may create
199// sub-contexts for http.Requests. See https://golang.org/pkg/context/
200// for more information on using Contexts.
201func (c *MediaLive) WaitUntilChannelStoppedWithContext(ctx aws.Context, input *DescribeChannelInput, opts ...request.WaiterOption) error {
202	w := request.Waiter{
203		Name:        "WaitUntilChannelStopped",
204		MaxAttempts: 28,
205		Delay:       request.ConstantWaiterDelay(5 * time.Second),
206		Acceptors: []request.WaiterAcceptor{
207			{
208				State:   request.SuccessWaiterState,
209				Matcher: request.PathWaiterMatch, Argument: "State",
210				Expected: "IDLE",
211			},
212			{
213				State:   request.RetryWaiterState,
214				Matcher: request.PathWaiterMatch, Argument: "State",
215				Expected: "STOPPING",
216			},
217			{
218				State:    request.RetryWaiterState,
219				Matcher:  request.StatusWaiterMatch,
220				Expected: 500,
221			},
222		},
223		Logger: c.Config.Logger,
224		NewRequest: func(opts []request.Option) (*request.Request, error) {
225			var inCpy *DescribeChannelInput
226			if input != nil {
227				tmp := *input
228				inCpy = &tmp
229			}
230			req, _ := c.DescribeChannelRequest(inCpy)
231			req.SetContext(ctx)
232			req.ApplyOptions(opts...)
233			return req, nil
234		},
235	}
236	w.ApplyOptions(opts...)
237
238	return w.WaitWithContext(ctx)
239}
240
241// WaitUntilMultiplexCreated uses the MediaLive API operation
242// DescribeMultiplex to wait for a condition to be met before returning.
243// If the condition is not met within the max attempt window, an error will
244// be returned.
245func (c *MediaLive) WaitUntilMultiplexCreated(input *DescribeMultiplexInput) error {
246	return c.WaitUntilMultiplexCreatedWithContext(aws.BackgroundContext(), input)
247}
248
249// WaitUntilMultiplexCreatedWithContext is an extended version of WaitUntilMultiplexCreated.
250// With the support for passing in a context and options to configure the
251// Waiter and the underlying request options.
252//
253// The context must be non-nil and will be used for request cancellation. If
254// the context is nil a panic will occur. In the future the SDK may create
255// sub-contexts for http.Requests. See https://golang.org/pkg/context/
256// for more information on using Contexts.
257func (c *MediaLive) WaitUntilMultiplexCreatedWithContext(ctx aws.Context, input *DescribeMultiplexInput, opts ...request.WaiterOption) error {
258	w := request.Waiter{
259		Name:        "WaitUntilMultiplexCreated",
260		MaxAttempts: 5,
261		Delay:       request.ConstantWaiterDelay(3 * time.Second),
262		Acceptors: []request.WaiterAcceptor{
263			{
264				State:   request.SuccessWaiterState,
265				Matcher: request.PathWaiterMatch, Argument: "State",
266				Expected: "IDLE",
267			},
268			{
269				State:   request.RetryWaiterState,
270				Matcher: request.PathWaiterMatch, Argument: "State",
271				Expected: "CREATING",
272			},
273			{
274				State:    request.RetryWaiterState,
275				Matcher:  request.StatusWaiterMatch,
276				Expected: 500,
277			},
278			{
279				State:   request.FailureWaiterState,
280				Matcher: request.PathWaiterMatch, Argument: "State",
281				Expected: "CREATE_FAILED",
282			},
283		},
284		Logger: c.Config.Logger,
285		NewRequest: func(opts []request.Option) (*request.Request, error) {
286			var inCpy *DescribeMultiplexInput
287			if input != nil {
288				tmp := *input
289				inCpy = &tmp
290			}
291			req, _ := c.DescribeMultiplexRequest(inCpy)
292			req.SetContext(ctx)
293			req.ApplyOptions(opts...)
294			return req, nil
295		},
296	}
297	w.ApplyOptions(opts...)
298
299	return w.WaitWithContext(ctx)
300}
301
302// WaitUntilMultiplexDeleted uses the MediaLive API operation
303// DescribeMultiplex to wait for a condition to be met before returning.
304// If the condition is not met within the max attempt window, an error will
305// be returned.
306func (c *MediaLive) WaitUntilMultiplexDeleted(input *DescribeMultiplexInput) error {
307	return c.WaitUntilMultiplexDeletedWithContext(aws.BackgroundContext(), input)
308}
309
310// WaitUntilMultiplexDeletedWithContext is an extended version of WaitUntilMultiplexDeleted.
311// With the support for passing in a context and options to configure the
312// Waiter and the underlying request options.
313//
314// The context must be non-nil and will be used for request cancellation. If
315// the context is nil a panic will occur. In the future the SDK may create
316// sub-contexts for http.Requests. See https://golang.org/pkg/context/
317// for more information on using Contexts.
318func (c *MediaLive) WaitUntilMultiplexDeletedWithContext(ctx aws.Context, input *DescribeMultiplexInput, opts ...request.WaiterOption) error {
319	w := request.Waiter{
320		Name:        "WaitUntilMultiplexDeleted",
321		MaxAttempts: 20,
322		Delay:       request.ConstantWaiterDelay(5 * time.Second),
323		Acceptors: []request.WaiterAcceptor{
324			{
325				State:   request.SuccessWaiterState,
326				Matcher: request.PathWaiterMatch, Argument: "State",
327				Expected: "DELETED",
328			},
329			{
330				State:   request.RetryWaiterState,
331				Matcher: request.PathWaiterMatch, Argument: "State",
332				Expected: "DELETING",
333			},
334			{
335				State:    request.RetryWaiterState,
336				Matcher:  request.StatusWaiterMatch,
337				Expected: 500,
338			},
339		},
340		Logger: c.Config.Logger,
341		NewRequest: func(opts []request.Option) (*request.Request, error) {
342			var inCpy *DescribeMultiplexInput
343			if input != nil {
344				tmp := *input
345				inCpy = &tmp
346			}
347			req, _ := c.DescribeMultiplexRequest(inCpy)
348			req.SetContext(ctx)
349			req.ApplyOptions(opts...)
350			return req, nil
351		},
352	}
353	w.ApplyOptions(opts...)
354
355	return w.WaitWithContext(ctx)
356}
357
358// WaitUntilMultiplexRunning uses the MediaLive API operation
359// DescribeMultiplex to wait for a condition to be met before returning.
360// If the condition is not met within the max attempt window, an error will
361// be returned.
362func (c *MediaLive) WaitUntilMultiplexRunning(input *DescribeMultiplexInput) error {
363	return c.WaitUntilMultiplexRunningWithContext(aws.BackgroundContext(), input)
364}
365
366// WaitUntilMultiplexRunningWithContext is an extended version of WaitUntilMultiplexRunning.
367// With the support for passing in a context and options to configure the
368// Waiter and the underlying request options.
369//
370// The context must be non-nil and will be used for request cancellation. If
371// the context is nil a panic will occur. In the future the SDK may create
372// sub-contexts for http.Requests. See https://golang.org/pkg/context/
373// for more information on using Contexts.
374func (c *MediaLive) WaitUntilMultiplexRunningWithContext(ctx aws.Context, input *DescribeMultiplexInput, opts ...request.WaiterOption) error {
375	w := request.Waiter{
376		Name:        "WaitUntilMultiplexRunning",
377		MaxAttempts: 120,
378		Delay:       request.ConstantWaiterDelay(5 * time.Second),
379		Acceptors: []request.WaiterAcceptor{
380			{
381				State:   request.SuccessWaiterState,
382				Matcher: request.PathWaiterMatch, Argument: "State",
383				Expected: "RUNNING",
384			},
385			{
386				State:   request.RetryWaiterState,
387				Matcher: request.PathWaiterMatch, Argument: "State",
388				Expected: "STARTING",
389			},
390			{
391				State:    request.RetryWaiterState,
392				Matcher:  request.StatusWaiterMatch,
393				Expected: 500,
394			},
395		},
396		Logger: c.Config.Logger,
397		NewRequest: func(opts []request.Option) (*request.Request, error) {
398			var inCpy *DescribeMultiplexInput
399			if input != nil {
400				tmp := *input
401				inCpy = &tmp
402			}
403			req, _ := c.DescribeMultiplexRequest(inCpy)
404			req.SetContext(ctx)
405			req.ApplyOptions(opts...)
406			return req, nil
407		},
408	}
409	w.ApplyOptions(opts...)
410
411	return w.WaitWithContext(ctx)
412}
413
414// WaitUntilMultiplexStopped uses the MediaLive API operation
415// DescribeMultiplex to wait for a condition to be met before returning.
416// If the condition is not met within the max attempt window, an error will
417// be returned.
418func (c *MediaLive) WaitUntilMultiplexStopped(input *DescribeMultiplexInput) error {
419	return c.WaitUntilMultiplexStoppedWithContext(aws.BackgroundContext(), input)
420}
421
422// WaitUntilMultiplexStoppedWithContext is an extended version of WaitUntilMultiplexStopped.
423// With the support for passing in a context and options to configure the
424// Waiter and the underlying request options.
425//
426// The context must be non-nil and will be used for request cancellation. If
427// the context is nil a panic will occur. In the future the SDK may create
428// sub-contexts for http.Requests. See https://golang.org/pkg/context/
429// for more information on using Contexts.
430func (c *MediaLive) WaitUntilMultiplexStoppedWithContext(ctx aws.Context, input *DescribeMultiplexInput, opts ...request.WaiterOption) error {
431	w := request.Waiter{
432		Name:        "WaitUntilMultiplexStopped",
433		MaxAttempts: 28,
434		Delay:       request.ConstantWaiterDelay(5 * time.Second),
435		Acceptors: []request.WaiterAcceptor{
436			{
437				State:   request.SuccessWaiterState,
438				Matcher: request.PathWaiterMatch, Argument: "State",
439				Expected: "IDLE",
440			},
441			{
442				State:   request.RetryWaiterState,
443				Matcher: request.PathWaiterMatch, Argument: "State",
444				Expected: "STOPPING",
445			},
446			{
447				State:    request.RetryWaiterState,
448				Matcher:  request.StatusWaiterMatch,
449				Expected: 500,
450			},
451		},
452		Logger: c.Config.Logger,
453		NewRequest: func(opts []request.Option) (*request.Request, error) {
454			var inCpy *DescribeMultiplexInput
455			if input != nil {
456				tmp := *input
457				inCpy = &tmp
458			}
459			req, _ := c.DescribeMultiplexRequest(inCpy)
460			req.SetContext(ctx)
461			req.ApplyOptions(opts...)
462			return req, nil
463		},
464	}
465	w.ApplyOptions(opts...)
466
467	return w.WaitWithContext(ctx)
468}
469