1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package s3
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// WaitUntilBucketExists uses the Amazon S3 API operation
13// HeadBucket 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 *S3) WaitUntilBucketExists(input *HeadBucketInput) error {
17	return c.WaitUntilBucketExistsWithContext(aws.BackgroundContext(), input)
18}
19
20// WaitUntilBucketExistsWithContext is an extended version of WaitUntilBucketExists.
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 *S3) WaitUntilBucketExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error {
29	w := request.Waiter{
30		Name:        "WaitUntilBucketExists",
31		MaxAttempts: 20,
32		Delay:       request.ConstantWaiterDelay(5 * time.Second),
33		Acceptors: []request.WaiterAcceptor{
34			{
35				State:    request.SuccessWaiterState,
36				Matcher:  request.StatusWaiterMatch,
37				Expected: 200,
38			},
39			{
40				State:    request.SuccessWaiterState,
41				Matcher:  request.StatusWaiterMatch,
42				Expected: 301,
43			},
44			{
45				State:    request.SuccessWaiterState,
46				Matcher:  request.StatusWaiterMatch,
47				Expected: 403,
48			},
49			{
50				State:    request.RetryWaiterState,
51				Matcher:  request.StatusWaiterMatch,
52				Expected: 404,
53			},
54		},
55		Logger: c.Config.Logger,
56		NewRequest: func(opts []request.Option) (*request.Request, error) {
57			var inCpy *HeadBucketInput
58			if input != nil {
59				tmp := *input
60				inCpy = &tmp
61			}
62			req, _ := c.HeadBucketRequest(inCpy)
63			req.SetContext(ctx)
64			req.ApplyOptions(opts...)
65			return req, nil
66		},
67	}
68	w.ApplyOptions(opts...)
69
70	return w.WaitWithContext(ctx)
71}
72
73// WaitUntilBucketNotExists uses the Amazon S3 API operation
74// HeadBucket to wait for a condition to be met before returning.
75// If the condition is not met within the max attempt window, an error will
76// be returned.
77func (c *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error {
78	return c.WaitUntilBucketNotExistsWithContext(aws.BackgroundContext(), input)
79}
80
81// WaitUntilBucketNotExistsWithContext is an extended version of WaitUntilBucketNotExists.
82// With the support for passing in a context and options to configure the
83// Waiter and the underlying request options.
84//
85// The context must be non-nil and will be used for request cancellation. If
86// the context is nil a panic will occur. In the future the SDK may create
87// sub-contexts for http.Requests. See https://golang.org/pkg/context/
88// for more information on using Contexts.
89func (c *S3) WaitUntilBucketNotExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error {
90	w := request.Waiter{
91		Name:        "WaitUntilBucketNotExists",
92		MaxAttempts: 20,
93		Delay:       request.ConstantWaiterDelay(5 * time.Second),
94		Acceptors: []request.WaiterAcceptor{
95			{
96				State:    request.SuccessWaiterState,
97				Matcher:  request.StatusWaiterMatch,
98				Expected: 404,
99			},
100		},
101		Logger: c.Config.Logger,
102		NewRequest: func(opts []request.Option) (*request.Request, error) {
103			var inCpy *HeadBucketInput
104			if input != nil {
105				tmp := *input
106				inCpy = &tmp
107			}
108			req, _ := c.HeadBucketRequest(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// WaitUntilObjectExists uses the Amazon S3 API operation
120// HeadObject 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 *S3) WaitUntilObjectExists(input *HeadObjectInput) error {
124	return c.WaitUntilObjectExistsWithContext(aws.BackgroundContext(), input)
125}
126
127// WaitUntilObjectExistsWithContext is an extended version of WaitUntilObjectExists.
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 *S3) WaitUntilObjectExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error {
136	w := request.Waiter{
137		Name:        "WaitUntilObjectExists",
138		MaxAttempts: 20,
139		Delay:       request.ConstantWaiterDelay(5 * time.Second),
140		Acceptors: []request.WaiterAcceptor{
141			{
142				State:    request.SuccessWaiterState,
143				Matcher:  request.StatusWaiterMatch,
144				Expected: 200,
145			},
146			{
147				State:    request.RetryWaiterState,
148				Matcher:  request.StatusWaiterMatch,
149				Expected: 404,
150			},
151		},
152		Logger: c.Config.Logger,
153		NewRequest: func(opts []request.Option) (*request.Request, error) {
154			var inCpy *HeadObjectInput
155			if input != nil {
156				tmp := *input
157				inCpy = &tmp
158			}
159			req, _ := c.HeadObjectRequest(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// WaitUntilObjectNotExists uses the Amazon S3 API operation
171// HeadObject 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 *S3) WaitUntilObjectNotExists(input *HeadObjectInput) error {
175	return c.WaitUntilObjectNotExistsWithContext(aws.BackgroundContext(), input)
176}
177
178// WaitUntilObjectNotExistsWithContext is an extended version of WaitUntilObjectNotExists.
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 *S3) WaitUntilObjectNotExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error {
187	w := request.Waiter{
188		Name:        "WaitUntilObjectNotExists",
189		MaxAttempts: 20,
190		Delay:       request.ConstantWaiterDelay(5 * time.Second),
191		Acceptors: []request.WaiterAcceptor{
192			{
193				State:    request.SuccessWaiterState,
194				Matcher:  request.StatusWaiterMatch,
195				Expected: 404,
196			},
197		},
198		Logger: c.Config.Logger,
199		NewRequest: func(opts []request.Option) (*request.Request, error) {
200			var inCpy *HeadObjectInput
201			if input != nil {
202				tmp := *input
203				inCpy = &tmp
204			}
205			req, _ := c.HeadObjectRequest(inCpy)
206			req.SetContext(ctx)
207			req.ApplyOptions(opts...)
208			return req, nil
209		},
210	}
211	w.ApplyOptions(opts...)
212
213	return w.WaitWithContext(ctx)
214}
215