1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package elb
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// WaitUntilAnyInstanceInService uses the Elastic Load Balancing API operation
13// DescribeInstanceHealth 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 *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) error {
17	return c.WaitUntilAnyInstanceInServiceWithContext(aws.BackgroundContext(), input)
18}
19
20// WaitUntilAnyInstanceInServiceWithContext is an extended version of WaitUntilAnyInstanceInService.
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 *ELB) WaitUntilAnyInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
29	w := request.Waiter{
30		Name:        "WaitUntilAnyInstanceInService",
31		MaxAttempts: 40,
32		Delay:       request.ConstantWaiterDelay(15 * time.Second),
33		Acceptors: []request.WaiterAcceptor{
34			{
35				State:   request.SuccessWaiterState,
36				Matcher: request.PathAnyWaiterMatch, Argument: "InstanceStates[].State",
37				Expected: "InService",
38			},
39		},
40		Logger: c.Config.Logger,
41		NewRequest: func(opts []request.Option) (*request.Request, error) {
42			var inCpy *DescribeInstanceHealthInput
43			if input != nil {
44				tmp := *input
45				inCpy = &tmp
46			}
47			req, _ := c.DescribeInstanceHealthRequest(inCpy)
48			req.SetContext(ctx)
49			req.ApplyOptions(opts...)
50			return req, nil
51		},
52	}
53	w.ApplyOptions(opts...)
54
55	return w.WaitWithContext(ctx)
56}
57
58// WaitUntilInstanceDeregistered uses the Elastic Load Balancing API operation
59// DescribeInstanceHealth to wait for a condition to be met before returning.
60// If the condition is not met within the max attempt window, an error will
61// be returned.
62func (c *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error {
63	return c.WaitUntilInstanceDeregisteredWithContext(aws.BackgroundContext(), input)
64}
65
66// WaitUntilInstanceDeregisteredWithContext is an extended version of WaitUntilInstanceDeregistered.
67// With the support for passing in a context and options to configure the
68// Waiter and the underlying request options.
69//
70// The context must be non-nil and will be used for request cancellation. If
71// the context is nil a panic will occur. In the future the SDK may create
72// sub-contexts for http.Requests. See https://golang.org/pkg/context/
73// for more information on using Contexts.
74func (c *ELB) WaitUntilInstanceDeregisteredWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
75	w := request.Waiter{
76		Name:        "WaitUntilInstanceDeregistered",
77		MaxAttempts: 40,
78		Delay:       request.ConstantWaiterDelay(15 * time.Second),
79		Acceptors: []request.WaiterAcceptor{
80			{
81				State:   request.SuccessWaiterState,
82				Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State",
83				Expected: "OutOfService",
84			},
85			{
86				State:    request.SuccessWaiterState,
87				Matcher:  request.ErrorWaiterMatch,
88				Expected: "InvalidInstance",
89			},
90		},
91		Logger: c.Config.Logger,
92		NewRequest: func(opts []request.Option) (*request.Request, error) {
93			var inCpy *DescribeInstanceHealthInput
94			if input != nil {
95				tmp := *input
96				inCpy = &tmp
97			}
98			req, _ := c.DescribeInstanceHealthRequest(inCpy)
99			req.SetContext(ctx)
100			req.ApplyOptions(opts...)
101			return req, nil
102		},
103	}
104	w.ApplyOptions(opts...)
105
106	return w.WaitWithContext(ctx)
107}
108
109// WaitUntilInstanceInService uses the Elastic Load Balancing API operation
110// DescribeInstanceHealth to wait for a condition to be met before returning.
111// If the condition is not met within the max attempt window, an error will
112// be returned.
113func (c *ELB) WaitUntilInstanceInService(input *DescribeInstanceHealthInput) error {
114	return c.WaitUntilInstanceInServiceWithContext(aws.BackgroundContext(), input)
115}
116
117// WaitUntilInstanceInServiceWithContext is an extended version of WaitUntilInstanceInService.
118// With the support for passing in a context and options to configure the
119// Waiter and the underlying request options.
120//
121// The context must be non-nil and will be used for request cancellation. If
122// the context is nil a panic will occur. In the future the SDK may create
123// sub-contexts for http.Requests. See https://golang.org/pkg/context/
124// for more information on using Contexts.
125func (c *ELB) WaitUntilInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
126	w := request.Waiter{
127		Name:        "WaitUntilInstanceInService",
128		MaxAttempts: 40,
129		Delay:       request.ConstantWaiterDelay(15 * time.Second),
130		Acceptors: []request.WaiterAcceptor{
131			{
132				State:   request.SuccessWaiterState,
133				Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State",
134				Expected: "InService",
135			},
136			{
137				State:    request.RetryWaiterState,
138				Matcher:  request.ErrorWaiterMatch,
139				Expected: "InvalidInstance",
140			},
141		},
142		Logger: c.Config.Logger,
143		NewRequest: func(opts []request.Option) (*request.Request, error) {
144			var inCpy *DescribeInstanceHealthInput
145			if input != nil {
146				tmp := *input
147				inCpy = &tmp
148			}
149			req, _ := c.DescribeInstanceHealthRequest(inCpy)
150			req.SetContext(ctx)
151			req.ApplyOptions(opts...)
152			return req, nil
153		},
154	}
155	w.ApplyOptions(opts...)
156
157	return w.WaitWithContext(ctx)
158}
159