1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package cloudformation
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// WaitUntilChangeSetCreateComplete uses the AWS CloudFormation API operation
13// DescribeChangeSet 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 *CloudFormation) WaitUntilChangeSetCreateComplete(input *DescribeChangeSetInput) error {
17	return c.WaitUntilChangeSetCreateCompleteWithContext(aws.BackgroundContext(), input)
18}
19
20// WaitUntilChangeSetCreateCompleteWithContext is an extended version of WaitUntilChangeSetCreateComplete.
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 *CloudFormation) WaitUntilChangeSetCreateCompleteWithContext(ctx aws.Context, input *DescribeChangeSetInput, opts ...request.WaiterOption) error {
29	w := request.Waiter{
30		Name:        "WaitUntilChangeSetCreateComplete",
31		MaxAttempts: 120,
32		Delay:       request.ConstantWaiterDelay(30 * time.Second),
33		Acceptors: []request.WaiterAcceptor{
34			{
35				State:   request.SuccessWaiterState,
36				Matcher: request.PathWaiterMatch, Argument: "Status",
37				Expected: "CREATE_COMPLETE",
38			},
39			{
40				State:   request.FailureWaiterState,
41				Matcher: request.PathWaiterMatch, Argument: "Status",
42				Expected: "FAILED",
43			},
44			{
45				State:    request.FailureWaiterState,
46				Matcher:  request.ErrorWaiterMatch,
47				Expected: "ValidationError",
48			},
49		},
50		Logger: c.Config.Logger,
51		NewRequest: func(opts []request.Option) (*request.Request, error) {
52			var inCpy *DescribeChangeSetInput
53			if input != nil {
54				tmp := *input
55				inCpy = &tmp
56			}
57			req, _ := c.DescribeChangeSetRequest(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// WaitUntilStackCreateComplete uses the AWS CloudFormation API operation
69// DescribeStacks 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.
72func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error {
73	return c.WaitUntilStackCreateCompleteWithContext(aws.BackgroundContext(), input)
74}
75
76// WaitUntilStackCreateCompleteWithContext is an extended version of WaitUntilStackCreateComplete.
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.
84func (c *CloudFormation) WaitUntilStackCreateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
85	w := request.Waiter{
86		Name:        "WaitUntilStackCreateComplete",
87		MaxAttempts: 120,
88		Delay:       request.ConstantWaiterDelay(30 * time.Second),
89		Acceptors: []request.WaiterAcceptor{
90			{
91				State:   request.SuccessWaiterState,
92				Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
93				Expected: "CREATE_COMPLETE",
94			},
95			{
96				State:   request.FailureWaiterState,
97				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
98				Expected: "CREATE_FAILED",
99			},
100			{
101				State:   request.FailureWaiterState,
102				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
103				Expected: "DELETE_COMPLETE",
104			},
105			{
106				State:   request.FailureWaiterState,
107				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
108				Expected: "DELETE_FAILED",
109			},
110			{
111				State:   request.FailureWaiterState,
112				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
113				Expected: "ROLLBACK_FAILED",
114			},
115			{
116				State:   request.FailureWaiterState,
117				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
118				Expected: "ROLLBACK_COMPLETE",
119			},
120			{
121				State:    request.FailureWaiterState,
122				Matcher:  request.ErrorWaiterMatch,
123				Expected: "ValidationError",
124			},
125		},
126		Logger: c.Config.Logger,
127		NewRequest: func(opts []request.Option) (*request.Request, error) {
128			var inCpy *DescribeStacksInput
129			if input != nil {
130				tmp := *input
131				inCpy = &tmp
132			}
133			req, _ := c.DescribeStacksRequest(inCpy)
134			req.SetContext(ctx)
135			req.ApplyOptions(opts...)
136			return req, nil
137		},
138	}
139	w.ApplyOptions(opts...)
140
141	return w.WaitWithContext(ctx)
142}
143
144// WaitUntilStackDeleteComplete uses the AWS CloudFormation API operation
145// DescribeStacks to wait for a condition to be met before returning.
146// If the condition is not met within the max attempt window, an error will
147// be returned.
148func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error {
149	return c.WaitUntilStackDeleteCompleteWithContext(aws.BackgroundContext(), input)
150}
151
152// WaitUntilStackDeleteCompleteWithContext is an extended version of WaitUntilStackDeleteComplete.
153// With the support for passing in a context and options to configure the
154// Waiter and the underlying request options.
155//
156// The context must be non-nil and will be used for request cancellation. If
157// the context is nil a panic will occur. In the future the SDK may create
158// sub-contexts for http.Requests. See https://golang.org/pkg/context/
159// for more information on using Contexts.
160func (c *CloudFormation) WaitUntilStackDeleteCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
161	w := request.Waiter{
162		Name:        "WaitUntilStackDeleteComplete",
163		MaxAttempts: 120,
164		Delay:       request.ConstantWaiterDelay(30 * time.Second),
165		Acceptors: []request.WaiterAcceptor{
166			{
167				State:   request.SuccessWaiterState,
168				Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
169				Expected: "DELETE_COMPLETE",
170			},
171			{
172				State:    request.SuccessWaiterState,
173				Matcher:  request.ErrorWaiterMatch,
174				Expected: "ValidationError",
175			},
176			{
177				State:   request.FailureWaiterState,
178				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
179				Expected: "DELETE_FAILED",
180			},
181			{
182				State:   request.FailureWaiterState,
183				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
184				Expected: "CREATE_FAILED",
185			},
186			{
187				State:   request.FailureWaiterState,
188				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
189				Expected: "ROLLBACK_FAILED",
190			},
191			{
192				State:   request.FailureWaiterState,
193				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
194				Expected: "UPDATE_ROLLBACK_FAILED",
195			},
196			{
197				State:   request.FailureWaiterState,
198				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
199				Expected: "UPDATE_ROLLBACK_IN_PROGRESS",
200			},
201		},
202		Logger: c.Config.Logger,
203		NewRequest: func(opts []request.Option) (*request.Request, error) {
204			var inCpy *DescribeStacksInput
205			if input != nil {
206				tmp := *input
207				inCpy = &tmp
208			}
209			req, _ := c.DescribeStacksRequest(inCpy)
210			req.SetContext(ctx)
211			req.ApplyOptions(opts...)
212			return req, nil
213		},
214	}
215	w.ApplyOptions(opts...)
216
217	return w.WaitWithContext(ctx)
218}
219
220// WaitUntilStackExists uses the AWS CloudFormation API operation
221// DescribeStacks to wait for a condition to be met before returning.
222// If the condition is not met within the max attempt window, an error will
223// be returned.
224func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error {
225	return c.WaitUntilStackExistsWithContext(aws.BackgroundContext(), input)
226}
227
228// WaitUntilStackExistsWithContext is an extended version of WaitUntilStackExists.
229// With the support for passing in a context and options to configure the
230// Waiter and the underlying request options.
231//
232// The context must be non-nil and will be used for request cancellation. If
233// the context is nil a panic will occur. In the future the SDK may create
234// sub-contexts for http.Requests. See https://golang.org/pkg/context/
235// for more information on using Contexts.
236func (c *CloudFormation) WaitUntilStackExistsWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
237	w := request.Waiter{
238		Name:        "WaitUntilStackExists",
239		MaxAttempts: 20,
240		Delay:       request.ConstantWaiterDelay(5 * time.Second),
241		Acceptors: []request.WaiterAcceptor{
242			{
243				State:    request.SuccessWaiterState,
244				Matcher:  request.StatusWaiterMatch,
245				Expected: 200,
246			},
247			{
248				State:    request.RetryWaiterState,
249				Matcher:  request.ErrorWaiterMatch,
250				Expected: "ValidationError",
251			},
252		},
253		Logger: c.Config.Logger,
254		NewRequest: func(opts []request.Option) (*request.Request, error) {
255			var inCpy *DescribeStacksInput
256			if input != nil {
257				tmp := *input
258				inCpy = &tmp
259			}
260			req, _ := c.DescribeStacksRequest(inCpy)
261			req.SetContext(ctx)
262			req.ApplyOptions(opts...)
263			return req, nil
264		},
265	}
266	w.ApplyOptions(opts...)
267
268	return w.WaitWithContext(ctx)
269}
270
271// WaitUntilStackUpdateComplete uses the AWS CloudFormation API operation
272// DescribeStacks to wait for a condition to be met before returning.
273// If the condition is not met within the max attempt window, an error will
274// be returned.
275func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput) error {
276	return c.WaitUntilStackUpdateCompleteWithContext(aws.BackgroundContext(), input)
277}
278
279// WaitUntilStackUpdateCompleteWithContext is an extended version of WaitUntilStackUpdateComplete.
280// With the support for passing in a context and options to configure the
281// Waiter and the underlying request options.
282//
283// The context must be non-nil and will be used for request cancellation. If
284// the context is nil a panic will occur. In the future the SDK may create
285// sub-contexts for http.Requests. See https://golang.org/pkg/context/
286// for more information on using Contexts.
287func (c *CloudFormation) WaitUntilStackUpdateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error {
288	w := request.Waiter{
289		Name:        "WaitUntilStackUpdateComplete",
290		MaxAttempts: 120,
291		Delay:       request.ConstantWaiterDelay(30 * time.Second),
292		Acceptors: []request.WaiterAcceptor{
293			{
294				State:   request.SuccessWaiterState,
295				Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus",
296				Expected: "UPDATE_COMPLETE",
297			},
298			{
299				State:   request.FailureWaiterState,
300				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
301				Expected: "UPDATE_FAILED",
302			},
303			{
304				State:   request.FailureWaiterState,
305				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
306				Expected: "UPDATE_ROLLBACK_FAILED",
307			},
308			{
309				State:   request.FailureWaiterState,
310				Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus",
311				Expected: "UPDATE_ROLLBACK_COMPLETE",
312			},
313			{
314				State:    request.FailureWaiterState,
315				Matcher:  request.ErrorWaiterMatch,
316				Expected: "ValidationError",
317			},
318		},
319		Logger: c.Config.Logger,
320		NewRequest: func(opts []request.Option) (*request.Request, error) {
321			var inCpy *DescribeStacksInput
322			if input != nil {
323				tmp := *input
324				inCpy = &tmp
325			}
326			req, _ := c.DescribeStacksRequest(inCpy)
327			req.SetContext(ctx)
328			req.ApplyOptions(opts...)
329			return req, nil
330		},
331	}
332	w.ApplyOptions(opts...)
333
334	return w.WaitWithContext(ctx)
335}
336