1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package eks
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// WaitUntilClusterActive uses the Amazon EKS API operation
13// DescribeCluster 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 *EKS) WaitUntilClusterActive(input *DescribeClusterInput) error {
17	return c.WaitUntilClusterActiveWithContext(aws.BackgroundContext(), input)
18}
19
20// WaitUntilClusterActiveWithContext is an extended version of WaitUntilClusterActive.
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 *EKS) WaitUntilClusterActiveWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
29	w := request.Waiter{
30		Name:        "WaitUntilClusterActive",
31		MaxAttempts: 40,
32		Delay:       request.ConstantWaiterDelay(30 * time.Second),
33		Acceptors: []request.WaiterAcceptor{
34			{
35				State:   request.FailureWaiterState,
36				Matcher: request.PathWaiterMatch, Argument: "cluster.status",
37				Expected: "DELETING",
38			},
39			{
40				State:   request.FailureWaiterState,
41				Matcher: request.PathWaiterMatch, Argument: "cluster.status",
42				Expected: "FAILED",
43			},
44			{
45				State:   request.SuccessWaiterState,
46				Matcher: request.PathWaiterMatch, Argument: "cluster.status",
47				Expected: "ACTIVE",
48			},
49		},
50		Logger: c.Config.Logger,
51		NewRequest: func(opts []request.Option) (*request.Request, error) {
52			var inCpy *DescribeClusterInput
53			if input != nil {
54				tmp := *input
55				inCpy = &tmp
56			}
57			req, _ := c.DescribeClusterRequest(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// WaitUntilClusterDeleted uses the Amazon EKS API operation
69// DescribeCluster 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 *EKS) WaitUntilClusterDeleted(input *DescribeClusterInput) error {
73	return c.WaitUntilClusterDeletedWithContext(aws.BackgroundContext(), input)
74}
75
76// WaitUntilClusterDeletedWithContext is an extended version of WaitUntilClusterDeleted.
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 *EKS) WaitUntilClusterDeletedWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
85	w := request.Waiter{
86		Name:        "WaitUntilClusterDeleted",
87		MaxAttempts: 40,
88		Delay:       request.ConstantWaiterDelay(30 * time.Second),
89		Acceptors: []request.WaiterAcceptor{
90			{
91				State:   request.FailureWaiterState,
92				Matcher: request.PathWaiterMatch, Argument: "cluster.status",
93				Expected: "ACTIVE",
94			},
95			{
96				State:   request.FailureWaiterState,
97				Matcher: request.PathWaiterMatch, Argument: "cluster.status",
98				Expected: "CREATING",
99			},
100			{
101				State:    request.SuccessWaiterState,
102				Matcher:  request.ErrorWaiterMatch,
103				Expected: "ResourceNotFoundException",
104			},
105		},
106		Logger: c.Config.Logger,
107		NewRequest: func(opts []request.Option) (*request.Request, error) {
108			var inCpy *DescribeClusterInput
109			if input != nil {
110				tmp := *input
111				inCpy = &tmp
112			}
113			req, _ := c.DescribeClusterRequest(inCpy)
114			req.SetContext(ctx)
115			req.ApplyOptions(opts...)
116			return req, nil
117		},
118	}
119	w.ApplyOptions(opts...)
120
121	return w.WaitWithContext(ctx)
122}
123
124// WaitUntilNodegroupActive uses the Amazon EKS API operation
125// DescribeNodegroup to wait for a condition to be met before returning.
126// If the condition is not met within the max attempt window, an error will
127// be returned.
128func (c *EKS) WaitUntilNodegroupActive(input *DescribeNodegroupInput) error {
129	return c.WaitUntilNodegroupActiveWithContext(aws.BackgroundContext(), input)
130}
131
132// WaitUntilNodegroupActiveWithContext is an extended version of WaitUntilNodegroupActive.
133// With the support for passing in a context and options to configure the
134// Waiter and the underlying request options.
135//
136// The context must be non-nil and will be used for request cancellation. If
137// the context is nil a panic will occur. In the future the SDK may create
138// sub-contexts for http.Requests. See https://golang.org/pkg/context/
139// for more information on using Contexts.
140func (c *EKS) WaitUntilNodegroupActiveWithContext(ctx aws.Context, input *DescribeNodegroupInput, opts ...request.WaiterOption) error {
141	w := request.Waiter{
142		Name:        "WaitUntilNodegroupActive",
143		MaxAttempts: 80,
144		Delay:       request.ConstantWaiterDelay(30 * time.Second),
145		Acceptors: []request.WaiterAcceptor{
146			{
147				State:   request.FailureWaiterState,
148				Matcher: request.PathWaiterMatch, Argument: "nodegroup.status",
149				Expected: "CREATE_FAILED",
150			},
151			{
152				State:   request.SuccessWaiterState,
153				Matcher: request.PathWaiterMatch, Argument: "nodegroup.status",
154				Expected: "ACTIVE",
155			},
156		},
157		Logger: c.Config.Logger,
158		NewRequest: func(opts []request.Option) (*request.Request, error) {
159			var inCpy *DescribeNodegroupInput
160			if input != nil {
161				tmp := *input
162				inCpy = &tmp
163			}
164			req, _ := c.DescribeNodegroupRequest(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}
174
175// WaitUntilNodegroupDeleted uses the Amazon EKS API operation
176// DescribeNodegroup to wait for a condition to be met before returning.
177// If the condition is not met within the max attempt window, an error will
178// be returned.
179func (c *EKS) WaitUntilNodegroupDeleted(input *DescribeNodegroupInput) error {
180	return c.WaitUntilNodegroupDeletedWithContext(aws.BackgroundContext(), input)
181}
182
183// WaitUntilNodegroupDeletedWithContext is an extended version of WaitUntilNodegroupDeleted.
184// With the support for passing in a context and options to configure the
185// Waiter and the underlying request options.
186//
187// The context must be non-nil and will be used for request cancellation. If
188// the context is nil a panic will occur. In the future the SDK may create
189// sub-contexts for http.Requests. See https://golang.org/pkg/context/
190// for more information on using Contexts.
191func (c *EKS) WaitUntilNodegroupDeletedWithContext(ctx aws.Context, input *DescribeNodegroupInput, opts ...request.WaiterOption) error {
192	w := request.Waiter{
193		Name:        "WaitUntilNodegroupDeleted",
194		MaxAttempts: 40,
195		Delay:       request.ConstantWaiterDelay(30 * time.Second),
196		Acceptors: []request.WaiterAcceptor{
197			{
198				State:   request.FailureWaiterState,
199				Matcher: request.PathWaiterMatch, Argument: "nodegroup.status",
200				Expected: "DELETE_FAILED",
201			},
202			{
203				State:    request.SuccessWaiterState,
204				Matcher:  request.ErrorWaiterMatch,
205				Expected: "ResourceNotFoundException",
206			},
207		},
208		Logger: c.Config.Logger,
209		NewRequest: func(opts []request.Option) (*request.Request, error) {
210			var inCpy *DescribeNodegroupInput
211			if input != nil {
212				tmp := *input
213				inCpy = &tmp
214			}
215			req, _ := c.DescribeNodegroupRequest(inCpy)
216			req.SetContext(ctx)
217			req.ApplyOptions(opts...)
218			return req, nil
219		},
220	}
221	w.ApplyOptions(opts...)
222
223	return w.WaitWithContext(ctx)
224}
225