2017-04-05 09:45:27 +02:00
|
|
|
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
2016-05-05 12:34:18 +02:00
|
|
|
|
|
|
|
package emr
|
|
|
|
|
|
|
|
import (
|
2017-04-05 09:45:27 +02:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/request"
|
2016-05-05 12:34:18 +02:00
|
|
|
)
|
|
|
|
|
2016-10-17 23:21:08 +02:00
|
|
|
// WaitUntilClusterRunning uses the Amazon EMR API operation
|
|
|
|
// DescribeCluster to wait for a condition to be met before returning.
|
|
|
|
// If the condition is not meet within the max attempt window an error will
|
|
|
|
// be returned.
|
2016-05-05 12:34:18 +02:00
|
|
|
func (c *EMR) WaitUntilClusterRunning(input *DescribeClusterInput) error {
|
2017-04-05 09:45:27 +02:00
|
|
|
return c.WaitUntilClusterRunningWithContext(aws.BackgroundContext(), input)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WaitUntilClusterRunningWithContext is an extended version of WaitUntilClusterRunning.
|
|
|
|
// With the support for passing in a context and options to configure the
|
|
|
|
// Waiter and the underlying request options.
|
|
|
|
//
|
|
|
|
// The context must be non-nil and will be used for request cancellation. If
|
|
|
|
// the context is nil a panic will occur. In the future the SDK may create
|
|
|
|
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
|
|
|
// for more information on using Contexts.
|
|
|
|
func (c *EMR) WaitUntilClusterRunningWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
|
|
|
|
w := request.Waiter{
|
|
|
|
Name: "WaitUntilClusterRunning",
|
2016-05-05 12:34:18 +02:00
|
|
|
MaxAttempts: 60,
|
2017-04-05 09:45:27 +02:00
|
|
|
Delay: request.ConstantWaiterDelay(30 * time.Second),
|
|
|
|
Acceptors: []request.WaiterAcceptor{
|
2016-05-05 12:34:18 +02:00
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.SuccessWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "RUNNING",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.SuccessWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "WAITING",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "TERMINATING",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "TERMINATED",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "TERMINATED_WITH_ERRORS",
|
2017-03-14 16:13:44 +01:00
|
|
|
},
|
|
|
|
},
|
2017-04-05 09:45:27 +02:00
|
|
|
Logger: c.Config.Logger,
|
|
|
|
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
|
|
|
var inCpy *DescribeClusterInput
|
|
|
|
if input != nil {
|
|
|
|
tmp := *input
|
|
|
|
inCpy = &tmp
|
|
|
|
}
|
|
|
|
req, _ := c.DescribeClusterRequest(inCpy)
|
|
|
|
req.SetContext(ctx)
|
|
|
|
req.ApplyOptions(opts...)
|
|
|
|
return req, nil
|
|
|
|
},
|
2017-03-14 16:13:44 +01:00
|
|
|
}
|
2017-04-05 09:45:27 +02:00
|
|
|
w.ApplyOptions(opts...)
|
2017-03-14 16:13:44 +01:00
|
|
|
|
2017-04-05 09:45:27 +02:00
|
|
|
return w.WaitWithContext(ctx)
|
2017-03-14 16:13:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// WaitUntilClusterTerminated uses the Amazon EMR API operation
|
|
|
|
// DescribeCluster to wait for a condition to be met before returning.
|
|
|
|
// If the condition is not meet within the max attempt window an error will
|
|
|
|
// be returned.
|
|
|
|
func (c *EMR) WaitUntilClusterTerminated(input *DescribeClusterInput) error {
|
2017-04-05 09:45:27 +02:00
|
|
|
return c.WaitUntilClusterTerminatedWithContext(aws.BackgroundContext(), input)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WaitUntilClusterTerminatedWithContext is an extended version of WaitUntilClusterTerminated.
|
|
|
|
// With the support for passing in a context and options to configure the
|
|
|
|
// Waiter and the underlying request options.
|
|
|
|
//
|
|
|
|
// The context must be non-nil and will be used for request cancellation. If
|
|
|
|
// the context is nil a panic will occur. In the future the SDK may create
|
|
|
|
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
|
|
|
// for more information on using Contexts.
|
|
|
|
func (c *EMR) WaitUntilClusterTerminatedWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
|
|
|
|
w := request.Waiter{
|
|
|
|
Name: "WaitUntilClusterTerminated",
|
2017-03-14 16:13:44 +01:00
|
|
|
MaxAttempts: 60,
|
2017-04-05 09:45:27 +02:00
|
|
|
Delay: request.ConstantWaiterDelay(30 * time.Second),
|
|
|
|
Acceptors: []request.WaiterAcceptor{
|
2017-03-14 16:13:44 +01:00
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.SuccessWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2017-03-14 16:13:44 +01:00
|
|
|
Expected: "TERMINATED",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State",
|
2017-03-14 16:13:44 +01:00
|
|
|
Expected: "TERMINATED_WITH_ERRORS",
|
2016-05-05 12:34:18 +02:00
|
|
|
},
|
|
|
|
},
|
2017-04-05 09:45:27 +02:00
|
|
|
Logger: c.Config.Logger,
|
|
|
|
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
|
|
|
var inCpy *DescribeClusterInput
|
|
|
|
if input != nil {
|
|
|
|
tmp := *input
|
|
|
|
inCpy = &tmp
|
|
|
|
}
|
|
|
|
req, _ := c.DescribeClusterRequest(inCpy)
|
|
|
|
req.SetContext(ctx)
|
|
|
|
req.ApplyOptions(opts...)
|
|
|
|
return req, nil
|
|
|
|
},
|
2016-05-05 12:34:18 +02:00
|
|
|
}
|
2017-04-05 09:45:27 +02:00
|
|
|
w.ApplyOptions(opts...)
|
2016-05-05 12:34:18 +02:00
|
|
|
|
2017-04-05 09:45:27 +02:00
|
|
|
return w.WaitWithContext(ctx)
|
2016-05-05 12:34:18 +02:00
|
|
|
}
|
|
|
|
|
2016-10-17 23:21:08 +02:00
|
|
|
// WaitUntilStepComplete uses the Amazon EMR API operation
|
|
|
|
// DescribeStep to wait for a condition to be met before returning.
|
|
|
|
// If the condition is not meet within the max attempt window an error will
|
|
|
|
// be returned.
|
2016-05-05 12:34:18 +02:00
|
|
|
func (c *EMR) WaitUntilStepComplete(input *DescribeStepInput) error {
|
2017-04-05 09:45:27 +02:00
|
|
|
return c.WaitUntilStepCompleteWithContext(aws.BackgroundContext(), input)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WaitUntilStepCompleteWithContext is an extended version of WaitUntilStepComplete.
|
|
|
|
// With the support for passing in a context and options to configure the
|
|
|
|
// Waiter and the underlying request options.
|
|
|
|
//
|
|
|
|
// The context must be non-nil and will be used for request cancellation. If
|
|
|
|
// the context is nil a panic will occur. In the future the SDK may create
|
|
|
|
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
|
|
|
// for more information on using Contexts.
|
|
|
|
func (c *EMR) WaitUntilStepCompleteWithContext(ctx aws.Context, input *DescribeStepInput, opts ...request.WaiterOption) error {
|
|
|
|
w := request.Waiter{
|
|
|
|
Name: "WaitUntilStepComplete",
|
2016-05-05 12:34:18 +02:00
|
|
|
MaxAttempts: 60,
|
2017-04-05 09:45:27 +02:00
|
|
|
Delay: request.ConstantWaiterDelay(30 * time.Second),
|
|
|
|
Acceptors: []request.WaiterAcceptor{
|
2016-05-05 12:34:18 +02:00
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.SuccessWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Step.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "COMPLETED",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Step.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "FAILED",
|
|
|
|
},
|
|
|
|
{
|
2017-04-05 09:45:27 +02:00
|
|
|
State: request.FailureWaiterState,
|
|
|
|
Matcher: request.PathWaiterMatch, Argument: "Step.Status.State",
|
2016-05-05 12:34:18 +02:00
|
|
|
Expected: "CANCELLED",
|
|
|
|
},
|
|
|
|
},
|
2017-04-05 09:45:27 +02:00
|
|
|
Logger: c.Config.Logger,
|
|
|
|
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
|
|
|
var inCpy *DescribeStepInput
|
|
|
|
if input != nil {
|
|
|
|
tmp := *input
|
|
|
|
inCpy = &tmp
|
|
|
|
}
|
|
|
|
req, _ := c.DescribeStepRequest(inCpy)
|
|
|
|
req.SetContext(ctx)
|
|
|
|
req.ApplyOptions(opts...)
|
|
|
|
return req, nil
|
|
|
|
},
|
2016-05-05 12:34:18 +02:00
|
|
|
}
|
2017-04-05 09:45:27 +02:00
|
|
|
w.ApplyOptions(opts...)
|
2016-05-05 12:34:18 +02:00
|
|
|
|
2017-04-05 09:45:27 +02:00
|
|
|
return w.WaitWithContext(ctx)
|
2016-05-05 12:34:18 +02:00
|
|
|
}
|