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