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// WaitUntilImageCreated uses the SageMaker API operation
120// DescribeImage 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) WaitUntilImageCreated(input *DescribeImageInput) error {
124	return c.WaitUntilImageCreatedWithContext(aws.BackgroundContext(), input)
125}
126
127// WaitUntilImageCreatedWithContext is an extended version of WaitUntilImageCreated.
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) WaitUntilImageCreatedWithContext(ctx aws.Context, input *DescribeImageInput, opts ...request.WaiterOption) error {
136	w := request.Waiter{
137		Name:        "WaitUntilImageCreated",
138		MaxAttempts: 60,
139		Delay:       request.ConstantWaiterDelay(60 * time.Second),
140		Acceptors: []request.WaiterAcceptor{
141			{
142				State:   request.SuccessWaiterState,
143				Matcher: request.PathWaiterMatch, Argument: "ImageStatus",
144				Expected: "CREATED",
145			},
146			{
147				State:   request.FailureWaiterState,
148				Matcher: request.PathWaiterMatch, Argument: "ImageStatus",
149				Expected: "CREATE_FAILED",
150			},
151			{
152				State:    request.FailureWaiterState,
153				Matcher:  request.ErrorWaiterMatch,
154				Expected: "ValidationException",
155			},
156		},
157		Logger: c.Config.Logger,
158		NewRequest: func(opts []request.Option) (*request.Request, error) {
159			var inCpy *DescribeImageInput
160			if input != nil {
161				tmp := *input
162				inCpy = &tmp
163			}
164			req, _ := c.DescribeImageRequest(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// WaitUntilImageDeleted uses the SageMaker API operation
176// DescribeImage 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 *SageMaker) WaitUntilImageDeleted(input *DescribeImageInput) error {
180	return c.WaitUntilImageDeletedWithContext(aws.BackgroundContext(), input)
181}
182
183// WaitUntilImageDeletedWithContext is an extended version of WaitUntilImageDeleted.
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 *SageMaker) WaitUntilImageDeletedWithContext(ctx aws.Context, input *DescribeImageInput, opts ...request.WaiterOption) error {
192	w := request.Waiter{
193		Name:        "WaitUntilImageDeleted",
194		MaxAttempts: 60,
195		Delay:       request.ConstantWaiterDelay(60 * time.Second),
196		Acceptors: []request.WaiterAcceptor{
197			{
198				State:    request.SuccessWaiterState,
199				Matcher:  request.ErrorWaiterMatch,
200				Expected: "ResourceNotFoundException",
201			},
202			{
203				State:   request.FailureWaiterState,
204				Matcher: request.PathWaiterMatch, Argument: "ImageStatus",
205				Expected: "DELETE_FAILED",
206			},
207			{
208				State:    request.FailureWaiterState,
209				Matcher:  request.ErrorWaiterMatch,
210				Expected: "ValidationException",
211			},
212		},
213		Logger: c.Config.Logger,
214		NewRequest: func(opts []request.Option) (*request.Request, error) {
215			var inCpy *DescribeImageInput
216			if input != nil {
217				tmp := *input
218				inCpy = &tmp
219			}
220			req, _ := c.DescribeImageRequest(inCpy)
221			req.SetContext(ctx)
222			req.ApplyOptions(opts...)
223			return req, nil
224		},
225	}
226	w.ApplyOptions(opts...)
227
228	return w.WaitWithContext(ctx)
229}
230
231// WaitUntilImageUpdated uses the SageMaker API operation
232// DescribeImage to wait for a condition to be met before returning.
233// If the condition is not met within the max attempt window, an error will
234// be returned.
235func (c *SageMaker) WaitUntilImageUpdated(input *DescribeImageInput) error {
236	return c.WaitUntilImageUpdatedWithContext(aws.BackgroundContext(), input)
237}
238
239// WaitUntilImageUpdatedWithContext is an extended version of WaitUntilImageUpdated.
240// With the support for passing in a context and options to configure the
241// Waiter and the underlying request options.
242//
243// The context must be non-nil and will be used for request cancellation. If
244// the context is nil a panic will occur. In the future the SDK may create
245// sub-contexts for http.Requests. See https://golang.org/pkg/context/
246// for more information on using Contexts.
247func (c *SageMaker) WaitUntilImageUpdatedWithContext(ctx aws.Context, input *DescribeImageInput, opts ...request.WaiterOption) error {
248	w := request.Waiter{
249		Name:        "WaitUntilImageUpdated",
250		MaxAttempts: 60,
251		Delay:       request.ConstantWaiterDelay(60 * time.Second),
252		Acceptors: []request.WaiterAcceptor{
253			{
254				State:   request.SuccessWaiterState,
255				Matcher: request.PathWaiterMatch, Argument: "ImageStatus",
256				Expected: "CREATED",
257			},
258			{
259				State:   request.FailureWaiterState,
260				Matcher: request.PathWaiterMatch, Argument: "ImageStatus",
261				Expected: "UPDATE_FAILED",
262			},
263			{
264				State:    request.FailureWaiterState,
265				Matcher:  request.ErrorWaiterMatch,
266				Expected: "ValidationException",
267			},
268		},
269		Logger: c.Config.Logger,
270		NewRequest: func(opts []request.Option) (*request.Request, error) {
271			var inCpy *DescribeImageInput
272			if input != nil {
273				tmp := *input
274				inCpy = &tmp
275			}
276			req, _ := c.DescribeImageRequest(inCpy)
277			req.SetContext(ctx)
278			req.ApplyOptions(opts...)
279			return req, nil
280		},
281	}
282	w.ApplyOptions(opts...)
283
284	return w.WaitWithContext(ctx)
285}
286
287// WaitUntilImageVersionCreated uses the SageMaker API operation
288// DescribeImageVersion to wait for a condition to be met before returning.
289// If the condition is not met within the max attempt window, an error will
290// be returned.
291func (c *SageMaker) WaitUntilImageVersionCreated(input *DescribeImageVersionInput) error {
292	return c.WaitUntilImageVersionCreatedWithContext(aws.BackgroundContext(), input)
293}
294
295// WaitUntilImageVersionCreatedWithContext is an extended version of WaitUntilImageVersionCreated.
296// With the support for passing in a context and options to configure the
297// Waiter and the underlying request options.
298//
299// The context must be non-nil and will be used for request cancellation. If
300// the context is nil a panic will occur. In the future the SDK may create
301// sub-contexts for http.Requests. See https://golang.org/pkg/context/
302// for more information on using Contexts.
303func (c *SageMaker) WaitUntilImageVersionCreatedWithContext(ctx aws.Context, input *DescribeImageVersionInput, opts ...request.WaiterOption) error {
304	w := request.Waiter{
305		Name:        "WaitUntilImageVersionCreated",
306		MaxAttempts: 60,
307		Delay:       request.ConstantWaiterDelay(60 * time.Second),
308		Acceptors: []request.WaiterAcceptor{
309			{
310				State:   request.SuccessWaiterState,
311				Matcher: request.PathWaiterMatch, Argument: "ImageVersionStatus",
312				Expected: "CREATED",
313			},
314			{
315				State:   request.FailureWaiterState,
316				Matcher: request.PathWaiterMatch, Argument: "ImageVersionStatus",
317				Expected: "CREATE_FAILED",
318			},
319			{
320				State:    request.FailureWaiterState,
321				Matcher:  request.ErrorWaiterMatch,
322				Expected: "ValidationException",
323			},
324		},
325		Logger: c.Config.Logger,
326		NewRequest: func(opts []request.Option) (*request.Request, error) {
327			var inCpy *DescribeImageVersionInput
328			if input != nil {
329				tmp := *input
330				inCpy = &tmp
331			}
332			req, _ := c.DescribeImageVersionRequest(inCpy)
333			req.SetContext(ctx)
334			req.ApplyOptions(opts...)
335			return req, nil
336		},
337	}
338	w.ApplyOptions(opts...)
339
340	return w.WaitWithContext(ctx)
341}
342
343// WaitUntilImageVersionDeleted uses the SageMaker API operation
344// DescribeImageVersion to wait for a condition to be met before returning.
345// If the condition is not met within the max attempt window, an error will
346// be returned.
347func (c *SageMaker) WaitUntilImageVersionDeleted(input *DescribeImageVersionInput) error {
348	return c.WaitUntilImageVersionDeletedWithContext(aws.BackgroundContext(), input)
349}
350
351// WaitUntilImageVersionDeletedWithContext is an extended version of WaitUntilImageVersionDeleted.
352// With the support for passing in a context and options to configure the
353// Waiter and the underlying request options.
354//
355// The context must be non-nil and will be used for request cancellation. If
356// the context is nil a panic will occur. In the future the SDK may create
357// sub-contexts for http.Requests. See https://golang.org/pkg/context/
358// for more information on using Contexts.
359func (c *SageMaker) WaitUntilImageVersionDeletedWithContext(ctx aws.Context, input *DescribeImageVersionInput, opts ...request.WaiterOption) error {
360	w := request.Waiter{
361		Name:        "WaitUntilImageVersionDeleted",
362		MaxAttempts: 60,
363		Delay:       request.ConstantWaiterDelay(60 * time.Second),
364		Acceptors: []request.WaiterAcceptor{
365			{
366				State:    request.SuccessWaiterState,
367				Matcher:  request.ErrorWaiterMatch,
368				Expected: "ResourceNotFoundException",
369			},
370			{
371				State:   request.FailureWaiterState,
372				Matcher: request.PathWaiterMatch, Argument: "ImageVersionStatus",
373				Expected: "DELETE_FAILED",
374			},
375			{
376				State:    request.FailureWaiterState,
377				Matcher:  request.ErrorWaiterMatch,
378				Expected: "ValidationException",
379			},
380		},
381		Logger: c.Config.Logger,
382		NewRequest: func(opts []request.Option) (*request.Request, error) {
383			var inCpy *DescribeImageVersionInput
384			if input != nil {
385				tmp := *input
386				inCpy = &tmp
387			}
388			req, _ := c.DescribeImageVersionRequest(inCpy)
389			req.SetContext(ctx)
390			req.ApplyOptions(opts...)
391			return req, nil
392		},
393	}
394	w.ApplyOptions(opts...)
395
396	return w.WaitWithContext(ctx)
397}
398
399// WaitUntilNotebookInstanceDeleted uses the SageMaker API operation
400// DescribeNotebookInstance to wait for a condition to be met before returning.
401// If the condition is not met within the max attempt window, an error will
402// be returned.
403func (c *SageMaker) WaitUntilNotebookInstanceDeleted(input *DescribeNotebookInstanceInput) error {
404	return c.WaitUntilNotebookInstanceDeletedWithContext(aws.BackgroundContext(), input)
405}
406
407// WaitUntilNotebookInstanceDeletedWithContext is an extended version of WaitUntilNotebookInstanceDeleted.
408// With the support for passing in a context and options to configure the
409// Waiter and the underlying request options.
410//
411// The context must be non-nil and will be used for request cancellation. If
412// the context is nil a panic will occur. In the future the SDK may create
413// sub-contexts for http.Requests. See https://golang.org/pkg/context/
414// for more information on using Contexts.
415func (c *SageMaker) WaitUntilNotebookInstanceDeletedWithContext(ctx aws.Context, input *DescribeNotebookInstanceInput, opts ...request.WaiterOption) error {
416	w := request.Waiter{
417		Name:        "WaitUntilNotebookInstanceDeleted",
418		MaxAttempts: 60,
419		Delay:       request.ConstantWaiterDelay(30 * time.Second),
420		Acceptors: []request.WaiterAcceptor{
421			{
422				State:    request.SuccessWaiterState,
423				Matcher:  request.ErrorWaiterMatch,
424				Expected: "ValidationException",
425			},
426			{
427				State:   request.FailureWaiterState,
428				Matcher: request.PathWaiterMatch, Argument: "NotebookInstanceStatus",
429				Expected: "Failed",
430			},
431		},
432		Logger: c.Config.Logger,
433		NewRequest: func(opts []request.Option) (*request.Request, error) {
434			var inCpy *DescribeNotebookInstanceInput
435			if input != nil {
436				tmp := *input
437				inCpy = &tmp
438			}
439			req, _ := c.DescribeNotebookInstanceRequest(inCpy)
440			req.SetContext(ctx)
441			req.ApplyOptions(opts...)
442			return req, nil
443		},
444	}
445	w.ApplyOptions(opts...)
446
447	return w.WaitWithContext(ctx)
448}
449
450// WaitUntilNotebookInstanceInService uses the SageMaker API operation
451// DescribeNotebookInstance to wait for a condition to be met before returning.
452// If the condition is not met within the max attempt window, an error will
453// be returned.
454func (c *SageMaker) WaitUntilNotebookInstanceInService(input *DescribeNotebookInstanceInput) error {
455	return c.WaitUntilNotebookInstanceInServiceWithContext(aws.BackgroundContext(), input)
456}
457
458// WaitUntilNotebookInstanceInServiceWithContext is an extended version of WaitUntilNotebookInstanceInService.
459// With the support for passing in a context and options to configure the
460// Waiter and the underlying request options.
461//
462// The context must be non-nil and will be used for request cancellation. If
463// the context is nil a panic will occur. In the future the SDK may create
464// sub-contexts for http.Requests. See https://golang.org/pkg/context/
465// for more information on using Contexts.
466func (c *SageMaker) WaitUntilNotebookInstanceInServiceWithContext(ctx aws.Context, input *DescribeNotebookInstanceInput, opts ...request.WaiterOption) error {
467	w := request.Waiter{
468		Name:        "WaitUntilNotebookInstanceInService",
469		MaxAttempts: 60,
470		Delay:       request.ConstantWaiterDelay(30 * time.Second),
471		Acceptors: []request.WaiterAcceptor{
472			{
473				State:   request.SuccessWaiterState,
474				Matcher: request.PathWaiterMatch, Argument: "NotebookInstanceStatus",
475				Expected: "InService",
476			},
477			{
478				State:   request.FailureWaiterState,
479				Matcher: request.PathWaiterMatch, Argument: "NotebookInstanceStatus",
480				Expected: "Failed",
481			},
482		},
483		Logger: c.Config.Logger,
484		NewRequest: func(opts []request.Option) (*request.Request, error) {
485			var inCpy *DescribeNotebookInstanceInput
486			if input != nil {
487				tmp := *input
488				inCpy = &tmp
489			}
490			req, _ := c.DescribeNotebookInstanceRequest(inCpy)
491			req.SetContext(ctx)
492			req.ApplyOptions(opts...)
493			return req, nil
494		},
495	}
496	w.ApplyOptions(opts...)
497
498	return w.WaitWithContext(ctx)
499}
500
501// WaitUntilNotebookInstanceStopped uses the SageMaker API operation
502// DescribeNotebookInstance to wait for a condition to be met before returning.
503// If the condition is not met within the max attempt window, an error will
504// be returned.
505func (c *SageMaker) WaitUntilNotebookInstanceStopped(input *DescribeNotebookInstanceInput) error {
506	return c.WaitUntilNotebookInstanceStoppedWithContext(aws.BackgroundContext(), input)
507}
508
509// WaitUntilNotebookInstanceStoppedWithContext is an extended version of WaitUntilNotebookInstanceStopped.
510// With the support for passing in a context and options to configure the
511// Waiter and the underlying request options.
512//
513// The context must be non-nil and will be used for request cancellation. If
514// the context is nil a panic will occur. In the future the SDK may create
515// sub-contexts for http.Requests. See https://golang.org/pkg/context/
516// for more information on using Contexts.
517func (c *SageMaker) WaitUntilNotebookInstanceStoppedWithContext(ctx aws.Context, input *DescribeNotebookInstanceInput, opts ...request.WaiterOption) error {
518	w := request.Waiter{
519		Name:        "WaitUntilNotebookInstanceStopped",
520		MaxAttempts: 60,
521		Delay:       request.ConstantWaiterDelay(30 * time.Second),
522		Acceptors: []request.WaiterAcceptor{
523			{
524				State:   request.SuccessWaiterState,
525				Matcher: request.PathWaiterMatch, Argument: "NotebookInstanceStatus",
526				Expected: "Stopped",
527			},
528			{
529				State:   request.FailureWaiterState,
530				Matcher: request.PathWaiterMatch, Argument: "NotebookInstanceStatus",
531				Expected: "Failed",
532			},
533		},
534		Logger: c.Config.Logger,
535		NewRequest: func(opts []request.Option) (*request.Request, error) {
536			var inCpy *DescribeNotebookInstanceInput
537			if input != nil {
538				tmp := *input
539				inCpy = &tmp
540			}
541			req, _ := c.DescribeNotebookInstanceRequest(inCpy)
542			req.SetContext(ctx)
543			req.ApplyOptions(opts...)
544			return req, nil
545		},
546	}
547	w.ApplyOptions(opts...)
548
549	return w.WaitWithContext(ctx)
550}
551
552// WaitUntilProcessingJobCompletedOrStopped uses the SageMaker API operation
553// DescribeProcessingJob to wait for a condition to be met before returning.
554// If the condition is not met within the max attempt window, an error will
555// be returned.
556func (c *SageMaker) WaitUntilProcessingJobCompletedOrStopped(input *DescribeProcessingJobInput) error {
557	return c.WaitUntilProcessingJobCompletedOrStoppedWithContext(aws.BackgroundContext(), input)
558}
559
560// WaitUntilProcessingJobCompletedOrStoppedWithContext is an extended version of WaitUntilProcessingJobCompletedOrStopped.
561// With the support for passing in a context and options to configure the
562// Waiter and the underlying request options.
563//
564// The context must be non-nil and will be used for request cancellation. If
565// the context is nil a panic will occur. In the future the SDK may create
566// sub-contexts for http.Requests. See https://golang.org/pkg/context/
567// for more information on using Contexts.
568func (c *SageMaker) WaitUntilProcessingJobCompletedOrStoppedWithContext(ctx aws.Context, input *DescribeProcessingJobInput, opts ...request.WaiterOption) error {
569	w := request.Waiter{
570		Name:        "WaitUntilProcessingJobCompletedOrStopped",
571		MaxAttempts: 60,
572		Delay:       request.ConstantWaiterDelay(60 * time.Second),
573		Acceptors: []request.WaiterAcceptor{
574			{
575				State:   request.SuccessWaiterState,
576				Matcher: request.PathWaiterMatch, Argument: "ProcessingJobStatus",
577				Expected: "Completed",
578			},
579			{
580				State:   request.SuccessWaiterState,
581				Matcher: request.PathWaiterMatch, Argument: "ProcessingJobStatus",
582				Expected: "Stopped",
583			},
584			{
585				State:   request.FailureWaiterState,
586				Matcher: request.PathWaiterMatch, Argument: "ProcessingJobStatus",
587				Expected: "Failed",
588			},
589			{
590				State:    request.FailureWaiterState,
591				Matcher:  request.ErrorWaiterMatch,
592				Expected: "ValidationException",
593			},
594		},
595		Logger: c.Config.Logger,
596		NewRequest: func(opts []request.Option) (*request.Request, error) {
597			var inCpy *DescribeProcessingJobInput
598			if input != nil {
599				tmp := *input
600				inCpy = &tmp
601			}
602			req, _ := c.DescribeProcessingJobRequest(inCpy)
603			req.SetContext(ctx)
604			req.ApplyOptions(opts...)
605			return req, nil
606		},
607	}
608	w.ApplyOptions(opts...)
609
610	return w.WaitWithContext(ctx)
611}
612
613// WaitUntilTrainingJobCompletedOrStopped uses the SageMaker API operation
614// DescribeTrainingJob to wait for a condition to be met before returning.
615// If the condition is not met within the max attempt window, an error will
616// be returned.
617func (c *SageMaker) WaitUntilTrainingJobCompletedOrStopped(input *DescribeTrainingJobInput) error {
618	return c.WaitUntilTrainingJobCompletedOrStoppedWithContext(aws.BackgroundContext(), input)
619}
620
621// WaitUntilTrainingJobCompletedOrStoppedWithContext is an extended version of WaitUntilTrainingJobCompletedOrStopped.
622// With the support for passing in a context and options to configure the
623// Waiter and the underlying request options.
624//
625// The context must be non-nil and will be used for request cancellation. If
626// the context is nil a panic will occur. In the future the SDK may create
627// sub-contexts for http.Requests. See https://golang.org/pkg/context/
628// for more information on using Contexts.
629func (c *SageMaker) WaitUntilTrainingJobCompletedOrStoppedWithContext(ctx aws.Context, input *DescribeTrainingJobInput, opts ...request.WaiterOption) error {
630	w := request.Waiter{
631		Name:        "WaitUntilTrainingJobCompletedOrStopped",
632		MaxAttempts: 180,
633		Delay:       request.ConstantWaiterDelay(120 * time.Second),
634		Acceptors: []request.WaiterAcceptor{
635			{
636				State:   request.SuccessWaiterState,
637				Matcher: request.PathWaiterMatch, Argument: "TrainingJobStatus",
638				Expected: "Completed",
639			},
640			{
641				State:   request.SuccessWaiterState,
642				Matcher: request.PathWaiterMatch, Argument: "TrainingJobStatus",
643				Expected: "Stopped",
644			},
645			{
646				State:   request.FailureWaiterState,
647				Matcher: request.PathWaiterMatch, Argument: "TrainingJobStatus",
648				Expected: "Failed",
649			},
650			{
651				State:    request.FailureWaiterState,
652				Matcher:  request.ErrorWaiterMatch,
653				Expected: "ValidationException",
654			},
655		},
656		Logger: c.Config.Logger,
657		NewRequest: func(opts []request.Option) (*request.Request, error) {
658			var inCpy *DescribeTrainingJobInput
659			if input != nil {
660				tmp := *input
661				inCpy = &tmp
662			}
663			req, _ := c.DescribeTrainingJobRequest(inCpy)
664			req.SetContext(ctx)
665			req.ApplyOptions(opts...)
666			return req, nil
667		},
668	}
669	w.ApplyOptions(opts...)
670
671	return w.WaitWithContext(ctx)
672}
673
674// WaitUntilTransformJobCompletedOrStopped uses the SageMaker API operation
675// DescribeTransformJob to wait for a condition to be met before returning.
676// If the condition is not met within the max attempt window, an error will
677// be returned.
678func (c *SageMaker) WaitUntilTransformJobCompletedOrStopped(input *DescribeTransformJobInput) error {
679	return c.WaitUntilTransformJobCompletedOrStoppedWithContext(aws.BackgroundContext(), input)
680}
681
682// WaitUntilTransformJobCompletedOrStoppedWithContext is an extended version of WaitUntilTransformJobCompletedOrStopped.
683// With the support for passing in a context and options to configure the
684// Waiter and the underlying request options.
685//
686// The context must be non-nil and will be used for request cancellation. If
687// the context is nil a panic will occur. In the future the SDK may create
688// sub-contexts for http.Requests. See https://golang.org/pkg/context/
689// for more information on using Contexts.
690func (c *SageMaker) WaitUntilTransformJobCompletedOrStoppedWithContext(ctx aws.Context, input *DescribeTransformJobInput, opts ...request.WaiterOption) error {
691	w := request.Waiter{
692		Name:        "WaitUntilTransformJobCompletedOrStopped",
693		MaxAttempts: 60,
694		Delay:       request.ConstantWaiterDelay(60 * time.Second),
695		Acceptors: []request.WaiterAcceptor{
696			{
697				State:   request.SuccessWaiterState,
698				Matcher: request.PathWaiterMatch, Argument: "TransformJobStatus",
699				Expected: "Completed",
700			},
701			{
702				State:   request.SuccessWaiterState,
703				Matcher: request.PathWaiterMatch, Argument: "TransformJobStatus",
704				Expected: "Stopped",
705			},
706			{
707				State:   request.FailureWaiterState,
708				Matcher: request.PathWaiterMatch, Argument: "TransformJobStatus",
709				Expected: "Failed",
710			},
711			{
712				State:    request.FailureWaiterState,
713				Matcher:  request.ErrorWaiterMatch,
714				Expected: "ValidationException",
715			},
716		},
717		Logger: c.Config.Logger,
718		NewRequest: func(opts []request.Option) (*request.Request, error) {
719			var inCpy *DescribeTransformJobInput
720			if input != nil {
721				tmp := *input
722				inCpy = &tmp
723			}
724			req, _ := c.DescribeTransformJobRequest(inCpy)
725			req.SetContext(ctx)
726			req.ApplyOptions(opts...)
727			return req, nil
728		},
729	}
730	w.ApplyOptions(opts...)
731
732	return w.WaitWithContext(ctx)
733}
734