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