forked from aws/aws-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetBucketVersioningConfigurationRequest.java
More file actions
300 lines (282 loc) · 11.6 KB
/
SetBucketVersioningConfigurationRequest.java
File metadata and controls
300 lines (282 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.s3.model;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.services.s3.internal.Constants;
/**
* <p>
* Contains options for setting the versioning configuration for a bucket.
* </p>
* <p>
* A bucket's versioning configuration can be in one of three possible states:
* <ul>
* <li>{@link BucketVersioningConfiguration#OFF}
* <li>{@link BucketVersioningConfiguration#ENABLED}
* <li>{@link BucketVersioningConfiguration#SUSPENDED}
* </ul>
* </p>
* <p>
* By default, new buckets are created in the
* {@link BucketVersioningConfiguration#OFF} state. Once versioning is
* enabled for a bucket, its status can never be reverted to
* {@link BucketVersioningConfiguration#OFF off}.
* </p>
* <p>
* Objects created before versioning is enabled or while versioning is suspended
* will be given the default <code>null</code> version ID (see
* {@link Constants#NULL_VERSION_ID}). Note that the
* <code>null</code> version ID is a valid version ID and is not the same
* as having no version ID.
* </p>
* <p>
* The versioning configuration of a bucket has different implications for each
* operation performed on that bucket or for objects within that bucket. When
* versioning is enabled, a <code>PutObject</code> operation creates a unique
* object version ID for the object being uploaded. The <code>PutObject</code> operation
* guarantees that if versioning is enabled for a bucket at the time of the request, the
* new object can only be permanently deleted by calling the <code>DeleteVersion</code> operation
* and can never be overwritten.
* </p>
* <p>
* Additionally, the <code>PutObject</code> operation guarantees that if
* versioning is enabled for a bucket at the time of the request, no other object will be
* overwritten by that request. Refer to the documentation sections for individual APIs
* for information on how versioning status affects the semantics of that
* particular API.
* </p>
* <p>
* Amazon S3 is eventually consistent. It may take time for the versioning status of a
* bucket to be propagated throughout the system.
* </p>
*
* @see SetBucketVersioningConfigurationRequest#SetBucketVersioningConfigurationRequest(String, BucketVersioningConfiguration)
* @see SetBucketVersioningConfigurationRequest#SetBucketVersioningConfigurationRequest(String, BucketVersioningConfiguration, MultiFactorAuthentication)
*/
public class SetBucketVersioningConfigurationRequest extends AmazonWebServiceRequest {
/**
* The bucket whose versioning configuration is being set.
*/
private String bucketName;
/**
* The new versioning configuration for the specified bucket.
*/
private BucketVersioningConfiguration versioningConfiguration;
/**
* The optional Multi-Factor Authentication information to include with this
* request. Multi-Factor Authentication is required when enabling or
* disabling the MFA Delete option. See
* {@link BucketVersioningConfiguration} for more details on MFA Delete.
*/
private MultiFactorAuthentication mfa;
/**
* Constructs a new {@link SetBucketVersioningConfigurationRequest}
* to set the bucket versioning configuration of
* the specified bucket.
*
* @param bucketName
* The name of the bucket whose versioning configuration is being
* set.
* @param configuration
* The new versioning configuration for the specified bucket.
*
* @see SetBucketVersioningConfigurationRequest#SetBucketVersioningConfigurationRequest(String, BucketVersioningConfiguration, MultiFactorAuthentication)
*/
public SetBucketVersioningConfigurationRequest(
String bucketName, BucketVersioningConfiguration configuration) {
this.bucketName = bucketName;
this.versioningConfiguration = configuration;
}
/**
* Constructs a new {@link SetBucketVersioningConfigurationRequest}
* to set the bucket versioning configuration of
* the specified bucket, including the specified Multi-Factor Authentication
* (MFA) information, which is required when changing the state of the MFA
* Delete option.
*
* @param bucketName
* The name of the bucket whose versioning configuration is being
* set.
* @param configuration
* The new versioning configuration for the specified bucket.
* @param mfa
* The Multi-Factor Authentication information to include in this
* request.
*
* @see SetBucketVersioningConfigurationRequest#SetBucketVersioningConfigurationRequest(String, BucketVersioningConfiguration)
*/
public SetBucketVersioningConfigurationRequest(
String bucketName, BucketVersioningConfiguration configuration,
MultiFactorAuthentication mfa) {
this(bucketName, configuration);
this.mfa = mfa;
}
/**
* Gets the name of the bucket whose versioning configuration is being
* set.
*
* @return The name of the bucket whose versioning configuration is being
* set.
*
* @see SetBucketVersioningConfigurationRequest#setBucketName(String)
*/
public String getBucketName() {
return bucketName;
}
/**
* Sets the name of the bucket whose versioning configuration is being set.
*
* @param bucketName
* The name of the bucket whose versioning configuration is being
* set.
*
* @see SetBucketVersioningConfigurationRequest#getBucketName()
*/
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
/**
* Sets the name of the bucket whose versioning configuration is being set,
* and returns this object so that additional method calls may be chained
* together.
*
* @param bucketName
* The name of the bucket whose versioning configuration is being
* set.
*
* @return This {@link SetBucketVersioningConfigurationRequest} object so that
* additional method calls may be chained together.
*
* @see SetBucketVersioningConfigurationRequest#setBucketName(String)
*/
public SetBucketVersioningConfigurationRequest withBucketName(String bucketName) {
setBucketName(bucketName);
return this;
}
/**
* Gets the new versioning configuration for the specified bucket.
*
* @return The new versioning configuration for the specified bucket.
*
* @see SetBucketVersioningConfigurationRequest#setVersioningConfiguration(BucketVersioningConfiguration)
* @see SetBucketVersioningConfigurationRequest#withVersioningConfiguration(BucketVersioningConfiguration)
*/
public BucketVersioningConfiguration getVersioningConfiguration() {
return versioningConfiguration;
}
/**
* Sets the new versioning configuration for the specified bucket.
*
* @param versioningConfiguration
* The new versioning configuration for the specified bucket.
*
* @see SetBucketVersioningConfigurationRequest#getVersioningConfiguration()
* @see SetBucketVersioningConfigurationRequest#withVersioningConfiguration(BucketVersioningConfiguration)
*/
public void setVersioningConfiguration(
BucketVersioningConfiguration versioningConfiguration) {
this.versioningConfiguration = versioningConfiguration;
}
/**
* Sets the new versioning configuration for the specified bucket and
* returns this object, enabling additional method calls to be chained
* together.
*
* @param versioningConfiguration
* The new versioning configuration for the specified bucket.
*
* @return This {@link SetBucketVersioningConfigurationRequest} object, enabling that
* additional method calls may be chained together.
*
* @see SetBucketVersioningConfigurationRequest#getVersioningConfiguration()
* @see SetBucketVersioningConfigurationRequest#getVersioningConfiguration()
*/
public SetBucketVersioningConfigurationRequest withVersioningConfiguration(
BucketVersioningConfiguration versioningConfiguration) {
setVersioningConfiguration(versioningConfiguration);
return this;
}
/**
* <p>
* Gets the optional Multi-Factor Authentication information included
* with this request.
* </p>
* <p>
* Multi-Factor Authentication is required when enabling or disabling MFA
* Delete functionality for a bucket.
* </p>
* <p>
* See {@link BucketVersioningConfiguration#setMfaDeleteEnabled(Boolean)}
* for more information on MFADelete.
* </p>
*
* @return The optional Multi-Factor Authentication information included
* with this request.
*
* @see SetBucketVersioningConfigurationRequest#setMfa(MultiFactorAuthentication)
* @see SetBucketVersioningConfigurationRequest#withMfa(MultiFactorAuthentication)
*/
public MultiFactorAuthentication getMfa() {
return mfa;
}
/**
* Sets the optional Multi-Factor Authentication information to include with
* this request.
* <p>
* Multi-Factor Authentication is required when enabling or disabling MFA
* delete functionality for a bucket.
* </p>
* <p>
* See {@link BucketVersioningConfiguration#setMfaDeleteEnabled(Boolean)}
* for more information on MFADelete.
* </p>
*
* @param mfa
* The optional Multi-Factor Authentication information to
* include with this request.
*
* @see SetBucketVersioningConfigurationRequest#getMfa()
* @see SetBucketVersioningConfigurationRequest#withMfa(MultiFactorAuthentication)
*/
public void setMfa(MultiFactorAuthentication mfa) {
this.mfa = mfa;
}
/**
* Sets the optional Multi-Factor Authentication information to include with
* this request, and returns this object so that additional method calls may
* be chained together.
* <p>
* Multi-Factor Authentication is required when enabling or disabling MFA
* delete functionality for a bucket.
* </p>
* <p>
* See {@link BucketVersioningConfiguration#setMfaDeleteEnabled(Boolean)}
* for more information on MFADelete.
* </p>
*
* @param mfa
* The optional Multi-Factor Authentication information to
* include with this request.
*
* @return The updated SetBucketVersioningConfigurationRequest object so
* that additional method calls may be chained together.
*
* @see SetBucketVersioningConfigurationRequest#getMfa()
* @see SetBucketVersioningConfigurationRequest#setMfa(MultiFactorAuthentication)
*/
public SetBucketVersioningConfigurationRequest withMfa(MultiFactorAuthentication mfa) {
setMfa(mfa);
return this;
}
}