aws-sdk-ec2 1.0.0.rc2 → 1.0.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,478 +1,476 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module EC2
10
- class Snapshot
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(id, options = {})
15
- # @param [String] id
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :id
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @id = extract_id(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
26
-
27
- # @!group Read-Only Attributes
8
+ module Aws::EC2
9
+ class Snapshot
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(id, options = {})
14
+ # @param [String] id
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :id
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @id = extract_id(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
28
25
 
29
- # @return [String]
30
- def id
31
- @id
32
- end
33
- alias :snapshot_id :id
34
-
35
- # The ID of the volume that was used to create the snapshot. Snapshots
36
- # created by the CopySnapshot action have an arbitrary volume ID that
37
- # should not be used for any purpose.
38
- # @return [String]
39
- def volume_id
40
- data.volume_id
41
- end
26
+ # @!group Read-Only Attributes
42
27
 
43
- # The snapshot state.
44
- # @return [String]
45
- def state
46
- data.state
47
- end
28
+ # @return [String]
29
+ def id
30
+ @id
31
+ end
32
+ alias :snapshot_id :id
33
+
34
+ # The ID of the volume that was used to create the snapshot. Snapshots
35
+ # created by the CopySnapshot action have an arbitrary volume ID that
36
+ # should not be used for any purpose.
37
+ # @return [String]
38
+ def volume_id
39
+ data.volume_id
40
+ end
48
41
 
49
- # Encrypted Amazon EBS snapshots are copied asynchronously. If a
50
- # snapshot copy operation fails (for example, if the proper AWS Key
51
- # Management Service (AWS KMS) permissions are not obtained) this field
52
- # displays error state details to help you diagnose why the error
53
- # occurred. This parameter is only returned by the DescribeSnapshots API
54
- # operation.
55
- # @return [String]
56
- def state_message
57
- data.state_message
58
- end
42
+ # The snapshot state.
43
+ # @return [String]
44
+ def state
45
+ data.state
46
+ end
59
47
 
60
- # The time stamp when the snapshot was initiated.
61
- # @return [Time]
62
- def start_time
63
- data.start_time
64
- end
48
+ # Encrypted Amazon EBS snapshots are copied asynchronously. If a
49
+ # snapshot copy operation fails (for example, if the proper AWS Key
50
+ # Management Service (AWS KMS) permissions are not obtained) this field
51
+ # displays error state details to help you diagnose why the error
52
+ # occurred. This parameter is only returned by the DescribeSnapshots API
53
+ # operation.
54
+ # @return [String]
55
+ def state_message
56
+ data.state_message
57
+ end
65
58
 
66
- # The progress of the snapshot, as a percentage.
67
- # @return [String]
68
- def progress
69
- data.progress
70
- end
59
+ # The time stamp when the snapshot was initiated.
60
+ # @return [Time]
61
+ def start_time
62
+ data.start_time
63
+ end
71
64
 
72
- # The AWS account ID of the EBS snapshot owner.
73
- # @return [String]
74
- def owner_id
75
- data.owner_id
76
- end
65
+ # The progress of the snapshot, as a percentage.
66
+ # @return [String]
67
+ def progress
68
+ data.progress
69
+ end
77
70
 
78
- # The description for the snapshot.
79
- # @return [String]
80
- def description
81
- data.description
82
- end
71
+ # The AWS account ID of the EBS snapshot owner.
72
+ # @return [String]
73
+ def owner_id
74
+ data.owner_id
75
+ end
83
76
 
84
- # The size of the volume, in GiB.
85
- # @return [Integer]
86
- def volume_size
87
- data.volume_size
88
- end
77
+ # The description for the snapshot.
78
+ # @return [String]
79
+ def description
80
+ data.description
81
+ end
89
82
 
90
- # Value from an Amazon-maintained list (`amazon` \| `aws-marketplace` \|
91
- # `microsoft`) of snapshot owners. Not to be confused with the
92
- # user-configured AWS account alias, which is set from the IAM console.
93
- # @return [String]
94
- def owner_alias
95
- data.owner_alias
96
- end
83
+ # The size of the volume, in GiB.
84
+ # @return [Integer]
85
+ def volume_size
86
+ data.volume_size
87
+ end
97
88
 
98
- # Any tags assigned to the snapshot.
99
- # @return [Array<Types::Tag>]
100
- def tags
101
- data.tags
102
- end
89
+ # Value from an Amazon-maintained list (`amazon` \| `aws-marketplace` \|
90
+ # `microsoft`) of snapshot owners. Not to be confused with the
91
+ # user-configured AWS account alias, which is set from the IAM console.
92
+ # @return [String]
93
+ def owner_alias
94
+ data.owner_alias
95
+ end
103
96
 
104
- # Indicates whether the snapshot is encrypted.
105
- # @return [Boolean]
106
- def encrypted
107
- data.encrypted
108
- end
97
+ # Any tags assigned to the snapshot.
98
+ # @return [Array<Types::Tag>]
99
+ def tags
100
+ data.tags
101
+ end
109
102
 
110
- # The full ARN of the AWS Key Management Service (AWS KMS) customer
111
- # master key (CMK) that was used to protect the volume encryption key
112
- # for the parent volume.
113
- # @return [String]
114
- def kms_key_id
115
- data.kms_key_id
116
- end
103
+ # Indicates whether the snapshot is encrypted.
104
+ # @return [Boolean]
105
+ def encrypted
106
+ data.encrypted
107
+ end
117
108
 
118
- # The data encryption key identifier for the snapshot. This value is a
119
- # unique identifier that corresponds to the data encryption key that was
120
- # used to encrypt the original volume or snapshot copy. Because data
121
- # encryption keys are inherited by volumes created from snapshots, and
122
- # vice versa, if snapshots share the same data encryption key
123
- # identifier, then they belong to the same volume/snapshot lineage. This
124
- # parameter is only returned by the DescribeSnapshots API operation.
125
- # @return [String]
126
- def data_encryption_key_id
127
- data.data_encryption_key_id
128
- end
109
+ # The full ARN of the AWS Key Management Service (AWS KMS) customer
110
+ # master key (CMK) that was used to protect the volume encryption key
111
+ # for the parent volume.
112
+ # @return [String]
113
+ def kms_key_id
114
+ data.kms_key_id
115
+ end
129
116
 
130
- # @!endgroup
117
+ # The data encryption key identifier for the snapshot. This value is a
118
+ # unique identifier that corresponds to the data encryption key that was
119
+ # used to encrypt the original volume or snapshot copy. Because data
120
+ # encryption keys are inherited by volumes created from snapshots, and
121
+ # vice versa, if snapshots share the same data encryption key
122
+ # identifier, then they belong to the same volume/snapshot lineage. This
123
+ # parameter is only returned by the DescribeSnapshots API operation.
124
+ # @return [String]
125
+ def data_encryption_key_id
126
+ data.data_encryption_key_id
127
+ end
131
128
 
132
- # @return [Client]
133
- def client
134
- @client
135
- end
129
+ # @!endgroup
136
130
 
137
- # Loads, or reloads {#data} for the current {Snapshot}.
138
- # Returns `self` making it possible to chain methods.
139
- #
140
- # snapshot.reload.data
141
- #
142
- # @return [self]
143
- def load
144
- resp = @client.describe_snapshots(snapshot_ids: [@id])
145
- @data = resp.snapshots[0]
146
- self
147
- end
148
- alias :reload :load
149
-
150
- # @return [Types::Snapshot]
151
- # Returns the data for this {Snapshot}. Calls
152
- # {Client#describe_snapshots} if {#data_loaded?} is `false`.
153
- def data
154
- load unless @data
155
- @data
156
- end
131
+ # @return [Client]
132
+ def client
133
+ @client
134
+ end
157
135
 
158
- # @return [Boolean]
159
- # Returns `true` if this resource is loaded. Accessing attributes or
160
- # {#data} on an unloaded resource will trigger a call to {#load}.
161
- def data_loaded?
162
- !!@data
163
- end
136
+ # Loads, or reloads {#data} for the current {Snapshot}.
137
+ # Returns `self` making it possible to chain methods.
138
+ #
139
+ # snapshot.reload.data
140
+ #
141
+ # @return [self]
142
+ def load
143
+ resp = @client.describe_snapshots(snapshot_ids: [@id])
144
+ @data = resp.snapshots[0]
145
+ self
146
+ end
147
+ alias :reload :load
148
+
149
+ # @return [Types::Snapshot]
150
+ # Returns the data for this {Snapshot}. Calls
151
+ # {Client#describe_snapshots} if {#data_loaded?} is `false`.
152
+ def data
153
+ load unless @data
154
+ @data
155
+ end
164
156
 
165
- # @param [Hash] options ({})
166
- # @option options [Integer] :max_attempts (40)
167
- # @option options [Float] :delay (15)
168
- # @option options [Proc] :before_attempt
169
- # @option options [Proc] :before_wait
170
- # @return [Snapshot]
171
- def wait_until_completed(options = {})
172
- options, params = separate_params_and_options(options)
173
- waiter = Waiters::SnapshotCompleted.new(options)
174
- yield_waiter_and_warn(waiter, &Proc.new) if block_given?
175
- resp = waiter.wait(params.merge(snapshot_ids: [@id]))
176
- Snapshot.new({
177
- id: @id,
178
- data: resp.data.snapshots[],
179
- client: @client
180
- })
181
- end
157
+ # @return [Boolean]
158
+ # Returns `true` if this resource is loaded. Accessing attributes or
159
+ # {#data} on an unloaded resource will trigger a call to {#load}.
160
+ def data_loaded?
161
+ !!@data
162
+ end
182
163
 
183
- # @!group Actions
184
-
185
- # @example Request syntax with placeholder values
186
- #
187
- # snapshot.copy({
188
- # dry_run: false,
189
- # source_region: "String", # required
190
- # description: "String",
191
- # destination_region: "String",
192
- # presigned_url: "String",
193
- # encrypted: false,
194
- # kms_key_id: "String",
195
- # })
196
- # @param [Hash] options ({})
197
- # @option options [Boolean] :dry_run
198
- # Checks whether you have the required permissions for the action,
199
- # without actually making the request, and provides an error response.
200
- # If you have the required permissions, the error response is
201
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
202
- # @option options [required, String] :source_region
203
- # The ID of the region that contains the snapshot to be copied.
204
- # @option options [String] :description
205
- # A description for the EBS snapshot.
206
- # @option options [String] :destination_region
207
- # The destination region to use in the `PresignedUrl` parameter of a
208
- # snapshot copy operation. This parameter is only valid for specifying
209
- # the destination region in a `PresignedUrl` parameter, where it is
210
- # required.
211
- #
212
- # <note markdown="1"> `CopySnapshot` sends the snapshot copy to the regional endpoint that
213
- # you send the HTTP request to, such as `ec2.us-east-1.amazonaws.com`
214
- # (in the AWS CLI, this is specified with the `--region` parameter or
215
- # the default region in your AWS configuration file).
216
- #
217
- # </note>
218
- # @option options [String] :presigned_url
219
- # The pre-signed URL that facilitates copying an encrypted snapshot.
220
- # This parameter is only required when copying an encrypted snapshot
221
- # with the Amazon EC2 Query API; it is available as an optional
222
- # parameter in all other cases. The `PresignedUrl` should use the
223
- # snapshot source endpoint, the `CopySnapshot` action, and include the
224
- # `SourceRegion`, `SourceSnapshotId`, and `DestinationRegion`
225
- # parameters. The `PresignedUrl` must be signed using AWS Signature
226
- # Version 4. Because EBS snapshots are stored in Amazon S3, the signing
227
- # algorithm for this parameter uses the same logic that is described in
228
- # [Authenticating Requests by Using Query Parameters (AWS Signature
229
- # Version 4)][1] in the *Amazon Simple Storage Service API Reference*.
230
- # An invalid or improperly signed `PresignedUrl` will cause the copy
231
- # operation to fail asynchronously, and the snapshot will move to an
232
- # `error` state.
233
- #
234
- #
235
- #
236
- # [1]: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
237
- # @option options [Boolean] :encrypted
238
- # Specifies whether the destination snapshot should be encrypted. You
239
- # can encrypt a copy of an unencrypted snapshot using this flag, but you
240
- # cannot use it to create an unencrypted copy from an encrypted
241
- # snapshot. Your default CMK for EBS is used unless a non-default AWS
242
- # Key Management Service (AWS KMS) CMK is specified with `KmsKeyId`. For
243
- # more information, see [Amazon EBS Encryption][1] in the *Amazon
244
- # Elastic Compute Cloud User Guide*.
245
- #
246
- #
247
- #
248
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html
249
- # @option options [String] :kms_key_id
250
- # The full ARN of the AWS Key Management Service (AWS KMS) CMK to use
251
- # when creating the snapshot copy. This parameter is only required if
252
- # you want to use a non-default CMK; if this parameter is not specified,
253
- # the default CMK for EBS is used. The ARN contains the `arn:aws:kms`
254
- # namespace, followed by the region of the CMK, the AWS account ID of
255
- # the CMK owner, the `key` namespace, and then the CMK ID. For example,
256
- # arn:aws:kms:*us-east-1*\:*012345678910*\:key/*abcd1234-a123-456a-a12b-a123b4cd56ef*.
257
- # The specified CMK must exist in the region that the snapshot is being
258
- # copied to. If a `KmsKeyId` is specified, the `Encrypted` flag must
259
- # also be set.
260
- # @return [Types::CopySnapshotResult]
261
- def copy(options = {})
262
- options = options.merge(source_snapshot_id: @id)
263
- resp = @client.copy_snapshot(options)
264
- resp.data
265
- end
164
+ # @param [Hash] options ({})
165
+ # @option options [Integer] :max_attempts (40)
166
+ # @option options [Float] :delay (15)
167
+ # @option options [Proc] :before_attempt
168
+ # @option options [Proc] :before_wait
169
+ # @return [Snapshot]
170
+ def wait_until_completed(options = {})
171
+ options, params = separate_params_and_options(options)
172
+ waiter = Waiters::SnapshotCompleted.new(options)
173
+ yield_waiter_and_warn(waiter, &Proc.new) if block_given?
174
+ resp = waiter.wait(params.merge(snapshot_ids: [@id]))
175
+ Snapshot.new({
176
+ id: @id,
177
+ data: resp.data.snapshots[],
178
+ client: @client
179
+ })
180
+ end
266
181
 
267
- # @example Request syntax with placeholder values
268
- #
269
- # tag = snapshot.create_tags({
270
- # dry_run: false,
271
- # tags: [ # required
272
- # {
273
- # key: "String",
274
- # value: "String",
275
- # },
276
- # ],
277
- # })
278
- # @param [Hash] options ({})
279
- # @option options [Boolean] :dry_run
280
- # Checks whether you have the required permissions for the action,
281
- # without actually making the request, and provides an error response.
282
- # If you have the required permissions, the error response is
283
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
284
- # @option options [required, Array<Types::Tag>] :tags
285
- # One or more tags. The `value` parameter is required, but if you don't
286
- # want the tag to have a value, specify the parameter with no value, and
287
- # we set the value to an empty string.
288
- # @return [Tag::Collection]
289
- def create_tags(options = {})
290
- batch = []
291
- options = Aws::Util.deep_merge(options, resources: [@id])
292
- resp = @client.create_tags(options)
293
- options[:tags].each do |t|
294
- batch << Tag.new(
295
- resource_id: @id,
296
- key: t[:key],
297
- value: t[:value],
298
- client: @client
299
- )
300
- end
301
- Tag::Collection.new([batch], size: batch.size)
302
- end
182
+ # @!group Actions
183
+
184
+ # @example Request syntax with placeholder values
185
+ #
186
+ # snapshot.copy({
187
+ # dry_run: false,
188
+ # source_region: "String", # required
189
+ # description: "String",
190
+ # destination_region: "String",
191
+ # presigned_url: "String",
192
+ # encrypted: false,
193
+ # kms_key_id: "String",
194
+ # })
195
+ # @param [Hash] options ({})
196
+ # @option options [Boolean] :dry_run
197
+ # Checks whether you have the required permissions for the action,
198
+ # without actually making the request, and provides an error response.
199
+ # If you have the required permissions, the error response is
200
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
201
+ # @option options [required, String] :source_region
202
+ # The ID of the region that contains the snapshot to be copied.
203
+ # @option options [String] :description
204
+ # A description for the EBS snapshot.
205
+ # @option options [String] :destination_region
206
+ # The destination region to use in the `PresignedUrl` parameter of a
207
+ # snapshot copy operation. This parameter is only valid for specifying
208
+ # the destination region in a `PresignedUrl` parameter, where it is
209
+ # required.
210
+ #
211
+ # <note markdown="1"> `CopySnapshot` sends the snapshot copy to the regional endpoint that
212
+ # you send the HTTP request to, such as `ec2.us-east-1.amazonaws.com`
213
+ # (in the AWS CLI, this is specified with the `--region` parameter or
214
+ # the default region in your AWS configuration file).
215
+ #
216
+ # </note>
217
+ # @option options [String] :presigned_url
218
+ # The pre-signed URL that facilitates copying an encrypted snapshot.
219
+ # This parameter is only required when copying an encrypted snapshot
220
+ # with the Amazon EC2 Query API; it is available as an optional
221
+ # parameter in all other cases. The `PresignedUrl` should use the
222
+ # snapshot source endpoint, the `CopySnapshot` action, and include the
223
+ # `SourceRegion`, `SourceSnapshotId`, and `DestinationRegion`
224
+ # parameters. The `PresignedUrl` must be signed using AWS Signature
225
+ # Version 4. Because EBS snapshots are stored in Amazon S3, the signing
226
+ # algorithm for this parameter uses the same logic that is described in
227
+ # [Authenticating Requests by Using Query Parameters (AWS Signature
228
+ # Version 4)][1] in the *Amazon Simple Storage Service API Reference*.
229
+ # An invalid or improperly signed `PresignedUrl` will cause the copy
230
+ # operation to fail asynchronously, and the snapshot will move to an
231
+ # `error` state.
232
+ #
233
+ #
234
+ #
235
+ # [1]: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
236
+ # @option options [Boolean] :encrypted
237
+ # Specifies whether the destination snapshot should be encrypted. You
238
+ # can encrypt a copy of an unencrypted snapshot using this flag, but you
239
+ # cannot use it to create an unencrypted copy from an encrypted
240
+ # snapshot. Your default CMK for EBS is used unless a non-default AWS
241
+ # Key Management Service (AWS KMS) CMK is specified with `KmsKeyId`. For
242
+ # more information, see [Amazon EBS Encryption][1] in the *Amazon
243
+ # Elastic Compute Cloud User Guide*.
244
+ #
245
+ #
246
+ #
247
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html
248
+ # @option options [String] :kms_key_id
249
+ # The full ARN of the AWS Key Management Service (AWS KMS) CMK to use
250
+ # when creating the snapshot copy. This parameter is only required if
251
+ # you want to use a non-default CMK; if this parameter is not specified,
252
+ # the default CMK for EBS is used. The ARN contains the `arn:aws:kms`
253
+ # namespace, followed by the region of the CMK, the AWS account ID of
254
+ # the CMK owner, the `key` namespace, and then the CMK ID. For example,
255
+ # arn:aws:kms:*us-east-1*\:*012345678910*\:key/*abcd1234-a123-456a-a12b-a123b4cd56ef*.
256
+ # The specified CMK must exist in the region that the snapshot is being
257
+ # copied to. If a `KmsKeyId` is specified, the `Encrypted` flag must
258
+ # also be set.
259
+ # @return [Types::CopySnapshotResult]
260
+ def copy(options = {})
261
+ options = options.merge(source_snapshot_id: @id)
262
+ resp = @client.copy_snapshot(options)
263
+ resp.data
264
+ end
303
265
 
304
- # @example Request syntax with placeholder values
305
- #
306
- # snapshot.delete({
307
- # dry_run: false,
308
- # })
309
- # @param [Hash] options ({})
310
- # @option options [Boolean] :dry_run
311
- # Checks whether you have the required permissions for the action,
312
- # without actually making the request, and provides an error response.
313
- # If you have the required permissions, the error response is
314
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
315
- # @return [EmptyStructure]
316
- def delete(options = {})
317
- options = options.merge(snapshot_id: @id)
318
- resp = @client.delete_snapshot(options)
319
- resp.data
266
+ # @example Request syntax with placeholder values
267
+ #
268
+ # tag = snapshot.create_tags({
269
+ # dry_run: false,
270
+ # tags: [ # required
271
+ # {
272
+ # key: "String",
273
+ # value: "String",
274
+ # },
275
+ # ],
276
+ # })
277
+ # @param [Hash] options ({})
278
+ # @option options [Boolean] :dry_run
279
+ # Checks whether you have the required permissions for the action,
280
+ # without actually making the request, and provides an error response.
281
+ # If you have the required permissions, the error response is
282
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
283
+ # @option options [required, Array<Types::Tag>] :tags
284
+ # One or more tags. The `value` parameter is required, but if you don't
285
+ # want the tag to have a value, specify the parameter with no value, and
286
+ # we set the value to an empty string.
287
+ # @return [Tag::Collection]
288
+ def create_tags(options = {})
289
+ batch = []
290
+ options = Aws::Util.deep_merge(options, resources: [@id])
291
+ resp = @client.create_tags(options)
292
+ options[:tags].each do |t|
293
+ batch << Tag.new(
294
+ resource_id: @id,
295
+ key: t[:key],
296
+ value: t[:value],
297
+ client: @client
298
+ )
320
299
  end
300
+ Tag::Collection.new([batch], size: batch.size)
301
+ end
321
302
 
322
- # @example Request syntax with placeholder values
323
- #
324
- # snapshot.describe_attribute({
325
- # dry_run: false,
326
- # attribute: "productCodes", # required, accepts productCodes, createVolumePermission
327
- # })
328
- # @param [Hash] options ({})
329
- # @option options [Boolean] :dry_run
330
- # Checks whether you have the required permissions for the action,
331
- # without actually making the request, and provides an error response.
332
- # If you have the required permissions, the error response is
333
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
334
- # @option options [required, String] :attribute
335
- # The snapshot attribute you would like to view.
336
- # @return [Types::DescribeSnapshotAttributeResult]
337
- def describe_attribute(options = {})
338
- options = options.merge(snapshot_id: @id)
339
- resp = @client.describe_snapshot_attribute(options)
340
- resp.data
341
- end
303
+ # @example Request syntax with placeholder values
304
+ #
305
+ # snapshot.delete({
306
+ # dry_run: false,
307
+ # })
308
+ # @param [Hash] options ({})
309
+ # @option options [Boolean] :dry_run
310
+ # Checks whether you have the required permissions for the action,
311
+ # without actually making the request, and provides an error response.
312
+ # If you have the required permissions, the error response is
313
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
314
+ # @return [EmptyStructure]
315
+ def delete(options = {})
316
+ options = options.merge(snapshot_id: @id)
317
+ resp = @client.delete_snapshot(options)
318
+ resp.data
319
+ end
342
320
 
343
- # @example Request syntax with placeholder values
344
- #
345
- # snapshot.modify_attribute({
346
- # dry_run: false,
347
- # attribute: "productCodes", # accepts productCodes, createVolumePermission
348
- # operation_type: "add", # accepts add, remove
349
- # user_ids: ["String"],
350
- # group_names: ["String"],
351
- # create_volume_permission: {
352
- # add: [
353
- # {
354
- # user_id: "String",
355
- # group: "all", # accepts all
356
- # },
357
- # ],
358
- # remove: [
359
- # {
360
- # user_id: "String",
361
- # group: "all", # accepts all
362
- # },
363
- # ],
364
- # },
365
- # })
366
- # @param [Hash] options ({})
367
- # @option options [Boolean] :dry_run
368
- # Checks whether you have the required permissions for the action,
369
- # without actually making the request, and provides an error response.
370
- # If you have the required permissions, the error response is
371
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
372
- # @option options [String] :attribute
373
- # The snapshot attribute to modify.
374
- #
375
- # <note markdown="1"> Only volume creation permissions may be modified at the customer
376
- # level.
377
- #
378
- # </note>
379
- # @option options [String] :operation_type
380
- # The type of operation to perform to the attribute.
381
- # @option options [Array<String>] :user_ids
382
- # The account ID to modify for the snapshot.
383
- # @option options [Array<String>] :group_names
384
- # The group to modify for the snapshot.
385
- # @option options [Types::CreateVolumePermissionModifications] :create_volume_permission
386
- # A JSON representation of the snapshot attribute modification.
387
- # @return [EmptyStructure]
388
- def modify_attribute(options = {})
389
- options = options.merge(snapshot_id: @id)
390
- resp = @client.modify_snapshot_attribute(options)
391
- resp.data
392
- end
321
+ # @example Request syntax with placeholder values
322
+ #
323
+ # snapshot.describe_attribute({
324
+ # dry_run: false,
325
+ # attribute: "productCodes", # required, accepts productCodes, createVolumePermission
326
+ # })
327
+ # @param [Hash] options ({})
328
+ # @option options [Boolean] :dry_run
329
+ # Checks whether you have the required permissions for the action,
330
+ # without actually making the request, and provides an error response.
331
+ # If you have the required permissions, the error response is
332
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
333
+ # @option options [required, String] :attribute
334
+ # The snapshot attribute you would like to view.
335
+ # @return [Types::DescribeSnapshotAttributeResult]
336
+ def describe_attribute(options = {})
337
+ options = options.merge(snapshot_id: @id)
338
+ resp = @client.describe_snapshot_attribute(options)
339
+ resp.data
340
+ end
393
341
 
394
- # @example Request syntax with placeholder values
395
- #
396
- # snapshot.reset_attribute({
397
- # dry_run: false,
398
- # attribute: "productCodes", # required, accepts productCodes, createVolumePermission
399
- # })
400
- # @param [Hash] options ({})
401
- # @option options [Boolean] :dry_run
402
- # Checks whether you have the required permissions for the action,
403
- # without actually making the request, and provides an error response.
404
- # If you have the required permissions, the error response is
405
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
406
- # @option options [required, String] :attribute
407
- # The attribute to reset. Currently, only the attribute for permission
408
- # to create volumes can be reset.
409
- # @return [EmptyStructure]
410
- def reset_attribute(options = {})
411
- options = options.merge(snapshot_id: @id)
412
- resp = @client.reset_snapshot_attribute(options)
413
- resp.data
414
- end
342
+ # @example Request syntax with placeholder values
343
+ #
344
+ # snapshot.modify_attribute({
345
+ # dry_run: false,
346
+ # attribute: "productCodes", # accepts productCodes, createVolumePermission
347
+ # operation_type: "add", # accepts add, remove
348
+ # user_ids: ["String"],
349
+ # group_names: ["String"],
350
+ # create_volume_permission: {
351
+ # add: [
352
+ # {
353
+ # user_id: "String",
354
+ # group: "all", # accepts all
355
+ # },
356
+ # ],
357
+ # remove: [
358
+ # {
359
+ # user_id: "String",
360
+ # group: "all", # accepts all
361
+ # },
362
+ # ],
363
+ # },
364
+ # })
365
+ # @param [Hash] options ({})
366
+ # @option options [Boolean] :dry_run
367
+ # Checks whether you have the required permissions for the action,
368
+ # without actually making the request, and provides an error response.
369
+ # If you have the required permissions, the error response is
370
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
371
+ # @option options [String] :attribute
372
+ # The snapshot attribute to modify.
373
+ #
374
+ # <note markdown="1"> Only volume creation permissions may be modified at the customer
375
+ # level.
376
+ #
377
+ # </note>
378
+ # @option options [String] :operation_type
379
+ # The type of operation to perform to the attribute.
380
+ # @option options [Array<String>] :user_ids
381
+ # The account ID to modify for the snapshot.
382
+ # @option options [Array<String>] :group_names
383
+ # The group to modify for the snapshot.
384
+ # @option options [Types::CreateVolumePermissionModifications] :create_volume_permission
385
+ # A JSON representation of the snapshot attribute modification.
386
+ # @return [EmptyStructure]
387
+ def modify_attribute(options = {})
388
+ options = options.merge(snapshot_id: @id)
389
+ resp = @client.modify_snapshot_attribute(options)
390
+ resp.data
391
+ end
415
392
 
416
- # @!group Associations
393
+ # @example Request syntax with placeholder values
394
+ #
395
+ # snapshot.reset_attribute({
396
+ # dry_run: false,
397
+ # attribute: "productCodes", # required, accepts productCodes, createVolumePermission
398
+ # })
399
+ # @param [Hash] options ({})
400
+ # @option options [Boolean] :dry_run
401
+ # Checks whether you have the required permissions for the action,
402
+ # without actually making the request, and provides an error response.
403
+ # If you have the required permissions, the error response is
404
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
405
+ # @option options [required, String] :attribute
406
+ # The attribute to reset. Currently, only the attribute for permission
407
+ # to create volumes can be reset.
408
+ # @return [EmptyStructure]
409
+ def reset_attribute(options = {})
410
+ options = options.merge(snapshot_id: @id)
411
+ resp = @client.reset_snapshot_attribute(options)
412
+ resp.data
413
+ end
417
414
 
418
- # @return [Volume, nil]
419
- def volume
420
- if data.volume_id
421
- Volume.new(
422
- id: data.volume_id,
423
- client: @client
424
- )
425
- else
426
- nil
427
- end
428
- end
415
+ # @!group Associations
429
416
 
430
- # @deprecated
431
- # @api private
432
- def identifiers
433
- { id: @id }
417
+ # @return [Volume, nil]
418
+ def volume
419
+ if data.volume_id
420
+ Volume.new(
421
+ id: data.volume_id,
422
+ client: @client
423
+ )
424
+ else
425
+ nil
434
426
  end
435
- deprecated(:identifiers)
436
-
437
- private
427
+ end
438
428
 
439
- def extract_id(args, options)
440
- value = args[0] || options.delete(:id)
441
- case value
442
- when String then value
443
- when nil then raise ArgumentError, "missing required option :id"
444
- else
445
- msg = "expected :id to be a String, got #{value.class}"
446
- raise ArgumentError, msg
447
- end
429
+ # @deprecated
430
+ # @api private
431
+ def identifiers
432
+ { id: @id }
433
+ end
434
+ deprecated(:identifiers)
435
+
436
+ private
437
+
438
+ def extract_id(args, options)
439
+ value = args[0] || options.delete(:id)
440
+ case value
441
+ when String then value
442
+ when nil then raise ArgumentError, "missing required option :id"
443
+ else
444
+ msg = "expected :id to be a String, got #{value.class}"
445
+ raise ArgumentError, msg
448
446
  end
447
+ end
449
448
 
450
- def yield_waiter_and_warn(waiter, &block)
451
- if !@waiter_block_warned
452
- msg = "pass options to configure the waiter; "
453
- msg << "yielding the waiter is deprecated"
454
- warn(msg)
455
- @waiter_block_warned = true
456
- end
457
- yield(waiter.waiter)
449
+ def yield_waiter_and_warn(waiter, &block)
450
+ if !@waiter_block_warned
451
+ msg = "pass options to configure the waiter; "
452
+ msg << "yielding the waiter is deprecated"
453
+ warn(msg)
454
+ @waiter_block_warned = true
458
455
  end
456
+ yield(waiter.waiter)
457
+ end
459
458
 
460
- def separate_params_and_options(options)
461
- opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
462
- waiter_opts = {}
463
- waiter_params = {}
464
- options.each_pair do |key, value|
465
- if opts.include?(key)
466
- waiter_opts[key] = value
467
- else
468
- waiter_params[key] = value
469
- end
459
+ def separate_params_and_options(options)
460
+ opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
461
+ waiter_opts = {}
462
+ waiter_params = {}
463
+ options.each_pair do |key, value|
464
+ if opts.include?(key)
465
+ waiter_opts[key] = value
466
+ else
467
+ waiter_params[key] = value
470
468
  end
471
- waiter_opts[:client] ||= @client
472
- [waiter_opts, waiter_params]
473
469
  end
474
-
475
- class Collection < Aws::Resources::Collection; end
470
+ waiter_opts[:client] ||= @client
471
+ [waiter_opts, waiter_params]
476
472
  end
473
+
474
+ class Collection < Aws::Resources::Collection; end
477
475
  end
478
476
  end