aws-sdk-ec2 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-ec2.rb +70 -0
  3. data/lib/aws-sdk-ec2/classic_address.rb +227 -0
  4. data/lib/aws-sdk-ec2/client.rb +14254 -0
  5. data/lib/aws-sdk-ec2/client_api.rb +6182 -0
  6. data/lib/aws-sdk-ec2/customizations.rb +21 -0
  7. data/lib/aws-sdk-ec2/customizations/instance.rb +29 -0
  8. data/lib/aws-sdk-ec2/customizations/resource.rb +18 -0
  9. data/lib/aws-sdk-ec2/dhcp_options.rb +183 -0
  10. data/lib/aws-sdk-ec2/errors.rb +23 -0
  11. data/lib/aws-sdk-ec2/image.rb +462 -0
  12. data/lib/aws-sdk-ec2/instance.rb +1570 -0
  13. data/lib/aws-sdk-ec2/internet_gateway.rb +204 -0
  14. data/lib/aws-sdk-ec2/key_pair.rb +120 -0
  15. data/lib/aws-sdk-ec2/key_pair_info.rb +122 -0
  16. data/lib/aws-sdk-ec2/network_acl.rb +341 -0
  17. data/lib/aws-sdk-ec2/network_interface.rb +474 -0
  18. data/lib/aws-sdk-ec2/network_interface_association.rb +151 -0
  19. data/lib/aws-sdk-ec2/placement_group.rb +426 -0
  20. data/lib/aws-sdk-ec2/plugins/copy_encrypted_snapshot.rb +59 -0
  21. data/lib/aws-sdk-ec2/plugins/region_validation.rb +19 -0
  22. data/lib/aws-sdk-ec2/resource.rb +2684 -0
  23. data/lib/aws-sdk-ec2/route.rb +243 -0
  24. data/lib/aws-sdk-ec2/route_table.rb +277 -0
  25. data/lib/aws-sdk-ec2/route_table_association.rb +177 -0
  26. data/lib/aws-sdk-ec2/security_group.rb +530 -0
  27. data/lib/aws-sdk-ec2/snapshot.rb +478 -0
  28. data/lib/aws-sdk-ec2/subnet.rb +972 -0
  29. data/lib/aws-sdk-ec2/tag.rb +223 -0
  30. data/lib/aws-sdk-ec2/types.rb +20124 -0
  31. data/lib/aws-sdk-ec2/volume.rb +555 -0
  32. data/lib/aws-sdk-ec2/vpc.rb +1698 -0
  33. data/lib/aws-sdk-ec2/vpc_address.rb +219 -0
  34. data/lib/aws-sdk-ec2/vpc_peering_connection.rb +265 -0
  35. data/lib/aws-sdk-ec2/waiters.rb +1334 -0
  36. metadata +107 -0
@@ -0,0 +1,59 @@
1
+ require 'aws-sigv4'
2
+
3
+ module Aws
4
+ module EC2
5
+ module Plugins
6
+
7
+ # This plugin auto populates the following request params for the
8
+ # CopySnapshot API:
9
+ #
10
+ # * `:destination_region`
11
+ # * `:presigned_url`
12
+ #
13
+ # These params are required by EC2 when copying an encrypted snapshot.
14
+ # @api private
15
+ class CopyEncryptedSnapshot < Seahorse::Client::Plugin
16
+
17
+ # @api private
18
+ class Handler < Seahorse::Client::Handler
19
+
20
+ def call(context)
21
+ params = context.params
22
+ params[:destination_region] = context.config.region
23
+ params[:presigned_url] = presigned_url(context, params)
24
+ @handler.call(context)
25
+ end
26
+
27
+ private
28
+
29
+ def presigned_url(context, params)
30
+ param_list = Aws::Query::ParamList.new
31
+ param_list.set('Action', 'CopySnapshot')
32
+ param_list.set('DestinationRegion', context.config.region)
33
+ param_list.set('Version', context.config.api.version)
34
+ Aws::Query::EC2ParamBuilder.new(param_list).apply(context.operation.input, params)
35
+
36
+ signer = Aws::Sigv4::Signer.new(
37
+ service: 'ec2',
38
+ region: params[:source_region],
39
+ credentials_provider: context.config.credentials
40
+ )
41
+ url = Aws::Partitions::EndpointProvider.resolve(signer.region, 'ec2')
42
+ url += "?#{param_list.to_s}"
43
+
44
+ signer.presign_url(
45
+ http_method: 'GET',
46
+ url: url,
47
+ body: '',
48
+ expires_in: 3600
49
+ ).to_s
50
+ end
51
+
52
+ end
53
+
54
+ handler(Handler, step: :initialize, operations: [:copy_snapshot])
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,19 @@
1
+ module Aws
2
+ module EC2
3
+ module Plugins
4
+ # @api private
5
+ class RegionValidation < Seahorse::Client::Plugin
6
+
7
+ def after_initialize(client)
8
+ if region = client.config.region
9
+ if matches = region.match(/^(\w+-\w+-\d+)[a-z]$/)
10
+ msg = ":region option must a region name, not an availability "
11
+ msg << "zone name; try `#{matches[1]}' instead of `#{matches[0]}'"
12
+ raise ArgumentError, msg
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,2684 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module EC2
10
+ class Resource
11
+
12
+ # @param options ({})
13
+ # @option options [Client] :client
14
+ def initialize(options = {})
15
+ @client = options[:client] || Client.new(options)
16
+ end
17
+
18
+ # @return [Client]
19
+ def client
20
+ @client
21
+ end
22
+
23
+ # @!group Actions
24
+
25
+ # @example Request syntax with placeholder values
26
+ #
27
+ # dhcpoptions = ec2.create_dhcp_options({
28
+ # dry_run: false,
29
+ # dhcp_configurations: [ # required
30
+ # {
31
+ # key: "String",
32
+ # values: ["String"],
33
+ # },
34
+ # ],
35
+ # })
36
+ # @param [Hash] options ({})
37
+ # @option options [Boolean] :dry_run
38
+ # Checks whether you have the required permissions for the action,
39
+ # without actually making the request, and provides an error response.
40
+ # If you have the required permissions, the error response is
41
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
42
+ # @option options [required, Array<Types::NewDhcpConfiguration>] :dhcp_configurations
43
+ # A DHCP configuration option.
44
+ # @return [DhcpOptions]
45
+ def create_dhcp_options(options = {})
46
+ resp = @client.create_dhcp_options(options)
47
+ DhcpOptions.new(
48
+ id: resp.data.dhcp_options.dhcp_options_id,
49
+ data: resp.data.dhcp_options,
50
+ client: @client
51
+ )
52
+ end
53
+
54
+ # @example Request syntax with placeholder values
55
+ #
56
+ # instance = ec2.create_instances({
57
+ # dry_run: false,
58
+ # image_id: "String", # required
59
+ # min_count: 1, # required
60
+ # max_count: 1, # required
61
+ # key_name: "String",
62
+ # security_groups: ["String"],
63
+ # security_group_ids: ["String"],
64
+ # user_data: "String",
65
+ # instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
66
+ # placement: {
67
+ # availability_zone: "String",
68
+ # group_name: "String",
69
+ # tenancy: "default", # accepts default, dedicated, host
70
+ # host_id: "String",
71
+ # affinity: "String",
72
+ # },
73
+ # kernel_id: "String",
74
+ # ramdisk_id: "String",
75
+ # block_device_mappings: [
76
+ # {
77
+ # virtual_name: "String",
78
+ # device_name: "String",
79
+ # ebs: {
80
+ # snapshot_id: "String",
81
+ # volume_size: 1,
82
+ # delete_on_termination: false,
83
+ # volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
84
+ # iops: 1,
85
+ # encrypted: false,
86
+ # },
87
+ # no_device: "String",
88
+ # },
89
+ # ],
90
+ # monitoring: {
91
+ # enabled: false, # required
92
+ # },
93
+ # subnet_id: "String",
94
+ # disable_api_termination: false,
95
+ # instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
96
+ # private_ip_address: "String",
97
+ # client_token: "String",
98
+ # additional_info: "String",
99
+ # network_interfaces: [
100
+ # {
101
+ # network_interface_id: "String",
102
+ # device_index: 1,
103
+ # subnet_id: "String",
104
+ # description: "String",
105
+ # private_ip_address: "String",
106
+ # groups: ["String"],
107
+ # delete_on_termination: false,
108
+ # private_ip_addresses: [
109
+ # {
110
+ # private_ip_address: "String", # required
111
+ # primary: false,
112
+ # },
113
+ # ],
114
+ # secondary_private_ip_address_count: 1,
115
+ # associate_public_ip_address: false,
116
+ # },
117
+ # ],
118
+ # iam_instance_profile: {
119
+ # arn: "String",
120
+ # name: "String",
121
+ # },
122
+ # ebs_optimized: false,
123
+ # })
124
+ # @param [Hash] options ({})
125
+ # @option options [Boolean] :dry_run
126
+ # Checks whether you have the required permissions for the action,
127
+ # without actually making the request, and provides an error response.
128
+ # If you have the required permissions, the error response is
129
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
130
+ # @option options [required, String] :image_id
131
+ # The ID of the AMI, which you can get by calling DescribeImages.
132
+ # @option options [required, Integer] :min_count
133
+ # The minimum number of instances to launch. If you specify a minimum
134
+ # that is more instances than Amazon EC2 can launch in the target
135
+ # Availability Zone, Amazon EC2 launches no instances.
136
+ #
137
+ # Constraints: Between 1 and the maximum number you're allowed for the
138
+ # specified instance type. For more information about the default
139
+ # limits, and how to request an increase, see [How many instances can I
140
+ # run in Amazon EC2][1] in the Amazon EC2 General FAQ.
141
+ #
142
+ #
143
+ #
144
+ # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
145
+ # @option options [required, Integer] :max_count
146
+ # The maximum number of instances to launch. If you specify more
147
+ # instances than Amazon EC2 can launch in the target Availability Zone,
148
+ # Amazon EC2 launches the largest possible number of instances above
149
+ # `MinCount`.
150
+ #
151
+ # Constraints: Between 1 and the maximum number you're allowed for the
152
+ # specified instance type. For more information about the default
153
+ # limits, and how to request an increase, see [How many instances can I
154
+ # run in Amazon EC2][1] in the Amazon EC2 FAQ.
155
+ #
156
+ #
157
+ #
158
+ # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
159
+ # @option options [String] :key_name
160
+ # The name of the key pair. You can create a key pair using
161
+ # CreateKeyPair or ImportKeyPair.
162
+ #
163
+ # If you do not specify a key pair, you can't connect to the instance
164
+ # unless you choose an AMI that is configured to allow users another way
165
+ # to log in.
166
+ # @option options [Array<String>] :security_groups
167
+ # \[EC2-Classic, default VPC\] One or more security group names. For a
168
+ # nondefault VPC, you must use security group IDs instead.
169
+ #
170
+ # Default: Amazon EC2 uses the default security group.
171
+ # @option options [Array<String>] :security_group_ids
172
+ # One or more security group IDs. You can create a security group using
173
+ # CreateSecurityGroup.
174
+ #
175
+ # Default: Amazon EC2 uses the default security group.
176
+ # @option options [String] :user_data
177
+ # The user data to make available to the instance. For more information,
178
+ # see [Running Commands on Your Linux Instance at Launch][1] (Linux) and
179
+ # [Adding User Data][2] (Windows). If you are using an AWS SDK or
180
+ # command line tool, Base64-encoding is performed for you, and you can
181
+ # load the text from a file. Otherwise, you must provide Base64-encoded
182
+ # text.
183
+ #
184
+ #
185
+ #
186
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
187
+ # [2]: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data
188
+ # @option options [String] :instance_type
189
+ # The instance type. For more information, see [Instance Types][1] in
190
+ # the *Amazon Elastic Compute Cloud User Guide*.
191
+ #
192
+ # Default: `m1.small`
193
+ #
194
+ #
195
+ #
196
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
197
+ # @option options [Types::Placement] :placement
198
+ # The placement for the instance.
199
+ # @option options [String] :kernel_id
200
+ # The ID of the kernel.
201
+ #
202
+ # We recommend that you use PV-GRUB instead of kernels and RAM disks.
203
+ # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
204
+ # Cloud User Guide*.
205
+ #
206
+ #
207
+ #
208
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
209
+ # @option options [String] :ramdisk_id
210
+ # The ID of the RAM disk.
211
+ #
212
+ # We recommend that you use PV-GRUB instead of kernels and RAM disks.
213
+ # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
214
+ # Cloud User Guide*.
215
+ #
216
+ #
217
+ #
218
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
219
+ # @option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
220
+ # The block device mapping.
221
+ #
222
+ # Supplying both a snapshot ID and an encryption value as arguments for
223
+ # block-device mapping results in an error. This is because only blank
224
+ # volumes can be encrypted on start, and these are not created from a
225
+ # snapshot. If a snapshot is the basis for the volume, it contains data
226
+ # by definition and its encryption status cannot be changed using this
227
+ # action.
228
+ # @option options [Types::RunInstancesMonitoringEnabled] :monitoring
229
+ # The monitoring for the instance.
230
+ # @option options [String] :subnet_id
231
+ # \[EC2-VPC\] The ID of the subnet to launch the instance into.
232
+ # @option options [Boolean] :disable_api_termination
233
+ # If you set this parameter to `true`, you can't terminate the instance
234
+ # using the Amazon EC2 console, CLI, or API; otherwise, you can. If you
235
+ # set this parameter to `true` and then later want to be able to
236
+ # terminate the instance, you must first change the value of the
237
+ # `disableApiTermination` attribute to `false` using
238
+ # ModifyInstanceAttribute. Alternatively, if you set
239
+ # `InstanceInitiatedShutdownBehavior` to `terminate`, you can terminate
240
+ # the instance by running the shutdown command from the instance.
241
+ #
242
+ # Default: `false`
243
+ # @option options [String] :instance_initiated_shutdown_behavior
244
+ # Indicates whether an instance stops or terminates when you initiate
245
+ # shutdown from the instance (using the operating system command for
246
+ # system shutdown).
247
+ #
248
+ # Default: `stop`
249
+ # @option options [String] :private_ip_address
250
+ # \[EC2-VPC\] The primary IP address. You must specify a value from the
251
+ # IP address range of the subnet.
252
+ #
253
+ # Only one private IP address can be designated as primary. Therefore,
254
+ # you can't specify this parameter if `PrivateIpAddresses.n.Primary` is
255
+ # set to `true` and `PrivateIpAddresses.n.PrivateIpAddress` is set to an
256
+ # IP address.
257
+ #
258
+ # You cannot specify this option if you're launching more than one
259
+ # instance in the request.
260
+ #
261
+ # Default: We select an IP address from the IP address range of the
262
+ # subnet.
263
+ # @option options [String] :client_token
264
+ # Unique, case-sensitive identifier you provide to ensure the
265
+ # idempotency of the request. For more information, see [Ensuring
266
+ # Idempotency][1].
267
+ #
268
+ # Constraints: Maximum 64 ASCII characters
269
+ #
270
+ #
271
+ #
272
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html
273
+ # @option options [String] :additional_info
274
+ # Reserved.
275
+ # @option options [Array<Types::InstanceNetworkInterfaceSpecification>] :network_interfaces
276
+ # One or more network interfaces.
277
+ # @option options [Types::IamInstanceProfileSpecification] :iam_instance_profile
278
+ # The IAM instance profile.
279
+ # @option options [Boolean] :ebs_optimized
280
+ # Indicates whether the instance is optimized for EBS I/O. This
281
+ # optimization provides dedicated throughput to Amazon EBS and an
282
+ # optimized configuration stack to provide optimal EBS I/O performance.
283
+ # This optimization isn't available with all instance types. Additional
284
+ # usage charges apply when using an EBS-optimized instance.
285
+ #
286
+ # Default: `false`
287
+ # @return [Instance::Collection]
288
+ def create_instances(options = {})
289
+ batch = []
290
+ resp = @client.run_instances(options)
291
+ resp.data.instances.each do |i|
292
+ batch << Instance.new(
293
+ id: i.instance_id,
294
+ data: i,
295
+ client: @client
296
+ )
297
+ end
298
+ Instance::Collection.new([batch], size: batch.size)
299
+ end
300
+
301
+ # @example Request syntax with placeholder values
302
+ #
303
+ # internetgateway = ec2.create_internet_gateway({
304
+ # dry_run: false,
305
+ # })
306
+ # @param [Hash] options ({})
307
+ # @option options [Boolean] :dry_run
308
+ # Checks whether you have the required permissions for the action,
309
+ # without actually making the request, and provides an error response.
310
+ # If you have the required permissions, the error response is
311
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
312
+ # @return [InternetGateway]
313
+ def create_internet_gateway(options = {})
314
+ resp = @client.create_internet_gateway(options)
315
+ InternetGateway.new(
316
+ id: resp.data.internet_gateway.internet_gateway_id,
317
+ data: resp.data.internet_gateway,
318
+ client: @client
319
+ )
320
+ end
321
+
322
+ # @example Request syntax with placeholder values
323
+ #
324
+ # keypair = ec2.create_key_pair({
325
+ # dry_run: false,
326
+ # key_name: "String", # required
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] :key_name
335
+ # A unique name for the key pair.
336
+ #
337
+ # Constraints: Up to 255 ASCII characters
338
+ # @return [KeyPair]
339
+ def create_key_pair(options = {})
340
+ resp = @client.create_key_pair(options)
341
+ KeyPair.new(
342
+ name: resp.data.key_name,
343
+ data: resp.data,
344
+ client: @client
345
+ )
346
+ end
347
+
348
+ # @example Request syntax with placeholder values
349
+ #
350
+ # networkacl = ec2.create_network_acl({
351
+ # dry_run: false,
352
+ # vpc_id: "String", # required
353
+ # })
354
+ # @param [Hash] options ({})
355
+ # @option options [Boolean] :dry_run
356
+ # Checks whether you have the required permissions for the action,
357
+ # without actually making the request, and provides an error response.
358
+ # If you have the required permissions, the error response is
359
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
360
+ # @option options [required, String] :vpc_id
361
+ # The ID of the VPC.
362
+ # @return [NetworkAcl]
363
+ def create_network_acl(options = {})
364
+ resp = @client.create_network_acl(options)
365
+ NetworkAcl.new(
366
+ id: resp.data.network_acl.network_acl_id,
367
+ data: resp.data.network_acl,
368
+ client: @client
369
+ )
370
+ end
371
+
372
+ # @example Request syntax with placeholder values
373
+ #
374
+ # networkinterface = ec2.create_network_interface({
375
+ # subnet_id: "String", # required
376
+ # description: "String",
377
+ # private_ip_address: "String",
378
+ # groups: ["String"],
379
+ # private_ip_addresses: [
380
+ # {
381
+ # private_ip_address: "String", # required
382
+ # primary: false,
383
+ # },
384
+ # ],
385
+ # secondary_private_ip_address_count: 1,
386
+ # dry_run: false,
387
+ # })
388
+ # @param [Hash] options ({})
389
+ # @option options [required, String] :subnet_id
390
+ # The ID of the subnet to associate with the network interface.
391
+ # @option options [String] :description
392
+ # A description for the network interface.
393
+ # @option options [String] :private_ip_address
394
+ # The primary private IP address of the network interface. If you don't
395
+ # specify an IP address, Amazon EC2 selects one for you from the subnet
396
+ # range. If you specify an IP address, you cannot indicate any IP
397
+ # addresses specified in `privateIpAddresses` as primary (only one IP
398
+ # address can be designated as primary).
399
+ # @option options [Array<String>] :groups
400
+ # The IDs of one or more security groups.
401
+ # @option options [Array<Types::PrivateIpAddressSpecification>] :private_ip_addresses
402
+ # One or more private IP addresses.
403
+ # @option options [Integer] :secondary_private_ip_address_count
404
+ # The number of secondary private IP addresses to assign to a network
405
+ # interface. When you specify a number of secondary IP addresses, Amazon
406
+ # EC2 selects these IP addresses within the subnet range. You can't
407
+ # specify this option and specify more than one private IP address using
408
+ # `privateIpAddresses`.
409
+ #
410
+ # The number of IP addresses you can assign to a network interface
411
+ # varies by instance type. For more information, see [Private IP
412
+ # Addresses Per ENI Per Instance Type][1] in the *Amazon Elastic Compute
413
+ # Cloud User Guide*.
414
+ #
415
+ #
416
+ #
417
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI
418
+ # @option options [Boolean] :dry_run
419
+ # Checks whether you have the required permissions for the action,
420
+ # without actually making the request, and provides an error response.
421
+ # If you have the required permissions, the error response is
422
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
423
+ # @return [NetworkInterface]
424
+ def create_network_interface(options = {})
425
+ resp = @client.create_network_interface(options)
426
+ NetworkInterface.new(
427
+ id: resp.data.network_interface.network_interface_id,
428
+ data: resp.data.network_interface,
429
+ client: @client
430
+ )
431
+ end
432
+
433
+ # @example Request syntax with placeholder values
434
+ #
435
+ # placementgroup = ec2.create_placement_group({
436
+ # dry_run: false,
437
+ # group_name: "String", # required
438
+ # strategy: "cluster", # required, accepts cluster
439
+ # })
440
+ # @param [Hash] options ({})
441
+ # @option options [Boolean] :dry_run
442
+ # Checks whether you have the required permissions for the action,
443
+ # without actually making the request, and provides an error response.
444
+ # If you have the required permissions, the error response is
445
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
446
+ # @option options [required, String] :group_name
447
+ # A name for the placement group.
448
+ #
449
+ # Constraints: Up to 255 ASCII characters
450
+ # @option options [required, String] :strategy
451
+ # The placement strategy.
452
+ # @return [PlacementGroup]
453
+ def create_placement_group(options = {})
454
+ resp = @client.create_placement_group(options)
455
+ PlacementGroup.new(
456
+ name: options[:group_name],
457
+ client: @client
458
+ )
459
+ end
460
+
461
+ # @example Request syntax with placeholder values
462
+ #
463
+ # routetable = ec2.create_route_table({
464
+ # dry_run: false,
465
+ # vpc_id: "String", # required
466
+ # })
467
+ # @param [Hash] options ({})
468
+ # @option options [Boolean] :dry_run
469
+ # Checks whether you have the required permissions for the action,
470
+ # without actually making the request, and provides an error response.
471
+ # If you have the required permissions, the error response is
472
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
473
+ # @option options [required, String] :vpc_id
474
+ # The ID of the VPC.
475
+ # @return [RouteTable]
476
+ def create_route_table(options = {})
477
+ resp = @client.create_route_table(options)
478
+ RouteTable.new(
479
+ id: resp.data.route_table.route_table_id,
480
+ data: resp.data.route_table,
481
+ client: @client
482
+ )
483
+ end
484
+
485
+ # @example Request syntax with placeholder values
486
+ #
487
+ # securitygroup = ec2.create_security_group({
488
+ # dry_run: false,
489
+ # group_name: "String", # required
490
+ # description: "String", # required
491
+ # vpc_id: "String",
492
+ # })
493
+ # @param [Hash] options ({})
494
+ # @option options [Boolean] :dry_run
495
+ # Checks whether you have the required permissions for the action,
496
+ # without actually making the request, and provides an error response.
497
+ # If you have the required permissions, the error response is
498
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
499
+ # @option options [required, String] :group_name
500
+ # The name of the security group.
501
+ #
502
+ # Constraints: Up to 255 characters in length
503
+ #
504
+ # Constraints for EC2-Classic: ASCII characters
505
+ #
506
+ # Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
507
+ # .\_-:/()#,@\[\]+=&amp;;\\\{\\}!$*
508
+ # @option options [required, String] :description
509
+ # A description for the security group. This is informational only.
510
+ #
511
+ # Constraints: Up to 255 characters in length
512
+ #
513
+ # Constraints for EC2-Classic: ASCII characters
514
+ #
515
+ # Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
516
+ # .\_-:/()#,@\[\]+=&amp;;\\\{\\}!$*
517
+ # @option options [String] :vpc_id
518
+ # \[EC2-VPC\] The ID of the VPC. Required for EC2-VPC.
519
+ # @return [SecurityGroup]
520
+ def create_security_group(options = {})
521
+ resp = @client.create_security_group(options)
522
+ SecurityGroup.new(
523
+ id: resp.data.group_id,
524
+ client: @client
525
+ )
526
+ end
527
+
528
+ # @example Request syntax with placeholder values
529
+ #
530
+ # snapshot = ec2.create_snapshot({
531
+ # dry_run: false,
532
+ # volume_id: "String", # required
533
+ # description: "String",
534
+ # })
535
+ # @param [Hash] options ({})
536
+ # @option options [Boolean] :dry_run
537
+ # Checks whether you have the required permissions for the action,
538
+ # without actually making the request, and provides an error response.
539
+ # If you have the required permissions, the error response is
540
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
541
+ # @option options [required, String] :volume_id
542
+ # The ID of the EBS volume.
543
+ # @option options [String] :description
544
+ # A description for the snapshot.
545
+ # @return [Snapshot]
546
+ def create_snapshot(options = {})
547
+ resp = @client.create_snapshot(options)
548
+ Snapshot.new(
549
+ id: resp.data.snapshot_id,
550
+ data: resp.data,
551
+ client: @client
552
+ )
553
+ end
554
+
555
+ # @example Request syntax with placeholder values
556
+ #
557
+ # subnet = ec2.create_subnet({
558
+ # dry_run: false,
559
+ # vpc_id: "String", # required
560
+ # cidr_block: "String", # required
561
+ # availability_zone: "String",
562
+ # })
563
+ # @param [Hash] options ({})
564
+ # @option options [Boolean] :dry_run
565
+ # Checks whether you have the required permissions for the action,
566
+ # without actually making the request, and provides an error response.
567
+ # If you have the required permissions, the error response is
568
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
569
+ # @option options [required, String] :vpc_id
570
+ # The ID of the VPC.
571
+ # @option options [required, String] :cidr_block
572
+ # The network range for the subnet, in CIDR notation. For example,
573
+ # `10.0.0.0/24`.
574
+ # @option options [String] :availability_zone
575
+ # The Availability Zone for the subnet.
576
+ #
577
+ # Default: AWS selects one for you. If you create more than one subnet
578
+ # in your VPC, we may not necessarily select a different zone for each
579
+ # subnet.
580
+ # @return [Subnet]
581
+ def create_subnet(options = {})
582
+ resp = @client.create_subnet(options)
583
+ Subnet.new(
584
+ id: resp.data.subnet.subnet_id,
585
+ data: resp.data.subnet,
586
+ client: @client
587
+ )
588
+ end
589
+
590
+ # @example Request syntax with placeholder values
591
+ #
592
+ # ec2.create_tags({
593
+ # dry_run: false,
594
+ # resources: ["String"], # required
595
+ # tags: [ # required
596
+ # {
597
+ # key: "String",
598
+ # value: "String",
599
+ # },
600
+ # ],
601
+ # })
602
+ # @param [Hash] options ({})
603
+ # @option options [Boolean] :dry_run
604
+ # Checks whether you have the required permissions for the action,
605
+ # without actually making the request, and provides an error response.
606
+ # If you have the required permissions, the error response is
607
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
608
+ # @option options [required, Array<String>] :resources
609
+ # The IDs of one or more resources to tag. For example, ami-1a2b3c4d.
610
+ # @option options [required, Array<Types::Tag>] :tags
611
+ # One or more tags. The `value` parameter is required, but if you don't
612
+ # want the tag to have a value, specify the parameter with no value, and
613
+ # we set the value to an empty string.
614
+ # @return [EmptyStructure]
615
+ def create_tags(options = {})
616
+ resp = @client.create_tags(options)
617
+ resp.data
618
+ end
619
+
620
+ # @example Request syntax with placeholder values
621
+ #
622
+ # volume = ec2.create_volume({
623
+ # dry_run: false,
624
+ # size: 1,
625
+ # snapshot_id: "String",
626
+ # availability_zone: "String", # required
627
+ # volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
628
+ # iops: 1,
629
+ # encrypted: false,
630
+ # kms_key_id: "String",
631
+ # })
632
+ # @param [Hash] options ({})
633
+ # @option options [Boolean] :dry_run
634
+ # Checks whether you have the required permissions for the action,
635
+ # without actually making the request, and provides an error response.
636
+ # If you have the required permissions, the error response is
637
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
638
+ # @option options [Integer] :size
639
+ # The size of the volume, in GiBs.
640
+ #
641
+ # Constraints: 1-16384 for `gp2`, 4-16384 for `io1`, 500-16384 for
642
+ # `st1`, 500-16384 for `sc1`, and 1-1024 for `standard`. If you specify
643
+ # a snapshot, the volume size must be equal to or larger than the
644
+ # snapshot size.
645
+ #
646
+ # Default: If you're creating the volume from a snapshot and don't
647
+ # specify a volume size, the default is the snapshot size.
648
+ # @option options [String] :snapshot_id
649
+ # The snapshot from which to create the volume.
650
+ # @option options [required, String] :availability_zone
651
+ # The Availability Zone in which to create the volume. Use
652
+ # DescribeAvailabilityZones to list the Availability Zones that are
653
+ # currently available to you.
654
+ # @option options [String] :volume_type
655
+ # The volume type. This can be `gp2` for General Purpose SSD, `io1` for
656
+ # Provisioned IOPS SSD, `st1` for Throughput Optimized HDD, `sc1` for
657
+ # Cold HDD, or `standard` for Magnetic volumes.
658
+ #
659
+ # Default: `standard`
660
+ # @option options [Integer] :iops
661
+ # Only valid for Provisioned IOPS SSD volumes. The number of I/O
662
+ # operations per second (IOPS) to provision for the volume, with a
663
+ # maximum ratio of 30 IOPS/GiB.
664
+ #
665
+ # Constraint: Range is 100 to 20000 for Provisioned IOPS SSD volumes
666
+ # @option options [Boolean] :encrypted
667
+ # Specifies whether the volume should be encrypted. Encrypted Amazon EBS
668
+ # volumes may only be attached to instances that support Amazon EBS
669
+ # encryption. Volumes that are created from encrypted snapshots are
670
+ # automatically encrypted. There is no way to create an encrypted volume
671
+ # from an unencrypted snapshot or vice versa. If your AMI uses encrypted
672
+ # volumes, you can only launch it on supported instance types. For more
673
+ # information, see [Amazon EBS Encryption][1] in the *Amazon Elastic
674
+ # Compute Cloud User Guide*.
675
+ #
676
+ #
677
+ #
678
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html
679
+ # @option options [String] :kms_key_id
680
+ # The full ARN of the AWS Key Management Service (AWS KMS) customer
681
+ # master key (CMK) to use when creating the encrypted volume. This
682
+ # parameter is only required if you want to use a non-default CMK; if
683
+ # this parameter is not specified, the default CMK for EBS is used. The
684
+ # ARN contains the `arn:aws:kms` namespace, followed by the region of
685
+ # the CMK, the AWS account ID of the CMK owner, the `key` namespace, and
686
+ # then the CMK ID. For example,
687
+ # arn:aws:kms:*us-east-1*\:*012345678910*\:key/*abcd1234-a123-456a-a12b-a123b4cd56ef*.
688
+ # If a `KmsKeyId` is specified, the `Encrypted` flag must also be set.
689
+ # @return [Volume]
690
+ def create_volume(options = {})
691
+ resp = @client.create_volume(options)
692
+ Volume.new(
693
+ id: resp.data.volume_id,
694
+ data: resp.data,
695
+ client: @client
696
+ )
697
+ end
698
+
699
+ # @example Request syntax with placeholder values
700
+ #
701
+ # vpc = ec2.create_vpc({
702
+ # dry_run: false,
703
+ # cidr_block: "String", # required
704
+ # instance_tenancy: "default", # accepts default, dedicated, host
705
+ # })
706
+ # @param [Hash] options ({})
707
+ # @option options [Boolean] :dry_run
708
+ # Checks whether you have the required permissions for the action,
709
+ # without actually making the request, and provides an error response.
710
+ # If you have the required permissions, the error response is
711
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
712
+ # @option options [required, String] :cidr_block
713
+ # The network range for the VPC, in CIDR notation. For example,
714
+ # `10.0.0.0/16`.
715
+ # @option options [String] :instance_tenancy
716
+ # The tenancy options for instances launched into the VPC. For
717
+ # `default`, instances are launched with shared tenancy by default. You
718
+ # can launch instances with any tenancy into a shared tenancy VPC. For
719
+ # `dedicated`, instances are launched as dedicated tenancy instances by
720
+ # default. You can only launch instances with a tenancy of `dedicated`
721
+ # or `host` into a dedicated tenancy VPC.
722
+ #
723
+ # **Important:** The `host` value cannot be used with this parameter.
724
+ # Use the `default` or `dedicated` values only.
725
+ #
726
+ # Default: `default`
727
+ # @return [Vpc]
728
+ def create_vpc(options = {})
729
+ resp = @client.create_vpc(options)
730
+ Vpc.new(
731
+ id: resp.data.vpc.vpc_id,
732
+ data: resp.data.vpc,
733
+ client: @client
734
+ )
735
+ end
736
+
737
+ # @example Request syntax with placeholder values
738
+ #
739
+ # vpcpeeringconnection = ec2.create_vpc_peering_connection({
740
+ # dry_run: false,
741
+ # vpc_id: "String",
742
+ # peer_vpc_id: "String",
743
+ # peer_owner_id: "String",
744
+ # })
745
+ # @param [Hash] options ({})
746
+ # @option options [Boolean] :dry_run
747
+ # Checks whether you have the required permissions for the action,
748
+ # without actually making the request, and provides an error response.
749
+ # If you have the required permissions, the error response is
750
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
751
+ # @option options [String] :vpc_id
752
+ # The ID of the requester VPC.
753
+ # @option options [String] :peer_vpc_id
754
+ # The ID of the VPC with which you are creating the VPC peering
755
+ # connection.
756
+ # @option options [String] :peer_owner_id
757
+ # The AWS account ID of the owner of the peer VPC.
758
+ #
759
+ # Default: Your AWS account ID
760
+ # @return [VpcPeeringConnection]
761
+ def create_vpc_peering_connection(options = {})
762
+ resp = @client.create_vpc_peering_connection(options)
763
+ VpcPeeringConnection.new(
764
+ id: resp.data.vpc_peering_connection.vpc_peering_connection_id,
765
+ data: resp.data.vpc_peering_connection,
766
+ client: @client
767
+ )
768
+ end
769
+
770
+ # @example Request syntax with placeholder values
771
+ #
772
+ # ec2.disassociate_route_table({
773
+ # dry_run: false,
774
+ # association_id: "String", # required
775
+ # })
776
+ # @param [Hash] options ({})
777
+ # @option options [Boolean] :dry_run
778
+ # Checks whether you have the required permissions for the action,
779
+ # without actually making the request, and provides an error response.
780
+ # If you have the required permissions, the error response is
781
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
782
+ # @option options [required, String] :association_id
783
+ # The association ID representing the current association between the
784
+ # route table and subnet.
785
+ # @return [EmptyStructure]
786
+ def disassociate_route_table(options = {})
787
+ resp = @client.disassociate_route_table(options)
788
+ resp.data
789
+ end
790
+
791
+ # @example Request syntax with placeholder values
792
+ #
793
+ # keypairinfo = ec2.import_key_pair({
794
+ # dry_run: false,
795
+ # key_name: "String", # required
796
+ # public_key_material: "data", # required
797
+ # })
798
+ # @param [Hash] options ({})
799
+ # @option options [Boolean] :dry_run
800
+ # Checks whether you have the required permissions for the action,
801
+ # without actually making the request, and provides an error response.
802
+ # If you have the required permissions, the error response is
803
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
804
+ # @option options [required, String] :key_name
805
+ # A unique name for the key pair.
806
+ # @option options [required, String, IO] :public_key_material
807
+ # The public key. For API calls, the text must be base64-encoded. For
808
+ # command line tools, base64 encoding is performed for you.
809
+ # @return [KeyPairInfo]
810
+ def import_key_pair(options = {})
811
+ resp = @client.import_key_pair(options)
812
+ KeyPairInfo.new(
813
+ name: resp.data.key_name,
814
+ client: @client
815
+ )
816
+ end
817
+
818
+ # @example Request syntax with placeholder values
819
+ #
820
+ # image = ec2.register_image({
821
+ # dry_run: false,
822
+ # image_location: "String",
823
+ # name: "String", # required
824
+ # description: "String",
825
+ # architecture: "i386", # accepts i386, x86_64
826
+ # kernel_id: "String",
827
+ # ramdisk_id: "String",
828
+ # root_device_name: "String",
829
+ # block_device_mappings: [
830
+ # {
831
+ # virtual_name: "String",
832
+ # device_name: "String",
833
+ # ebs: {
834
+ # snapshot_id: "String",
835
+ # volume_size: 1,
836
+ # delete_on_termination: false,
837
+ # volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
838
+ # iops: 1,
839
+ # encrypted: false,
840
+ # },
841
+ # no_device: "String",
842
+ # },
843
+ # ],
844
+ # virtualization_type: "String",
845
+ # sriov_net_support: "String",
846
+ # ena_support: false,
847
+ # })
848
+ # @param [Hash] options ({})
849
+ # @option options [Boolean] :dry_run
850
+ # Checks whether you have the required permissions for the action,
851
+ # without actually making the request, and provides an error response.
852
+ # If you have the required permissions, the error response is
853
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
854
+ # @option options [String] :image_location
855
+ # The full path to your AMI manifest in Amazon S3 storage.
856
+ # @option options [required, String] :name
857
+ # A name for your AMI.
858
+ #
859
+ # Constraints: 3-128 alphanumeric characters, parentheses (()), square
860
+ # brackets (\[\]), spaces ( ), periods (.), slashes (/), dashes (-),
861
+ # single quotes ('), at-signs (@), or underscores(\_)
862
+ # @option options [String] :description
863
+ # A description for your AMI.
864
+ # @option options [String] :architecture
865
+ # The architecture of the AMI.
866
+ #
867
+ # Default: For Amazon EBS-backed AMIs, `i386`. For instance store-backed
868
+ # AMIs, the architecture specified in the manifest file.
869
+ # @option options [String] :kernel_id
870
+ # The ID of the kernel.
871
+ # @option options [String] :ramdisk_id
872
+ # The ID of the RAM disk.
873
+ # @option options [String] :root_device_name
874
+ # The name of the root device (for example, `/dev/sda1`, or
875
+ # `/dev/xvda`).
876
+ # @option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
877
+ # One or more block device mapping entries.
878
+ # @option options [String] :virtualization_type
879
+ # The type of virtualization.
880
+ #
881
+ # Default: `paravirtual`
882
+ # @option options [String] :sriov_net_support
883
+ # Set to `simple` to enable enhanced networking with the Intel 82599
884
+ # Virtual Function interface for the AMI and any instances that you
885
+ # launch from the AMI.
886
+ #
887
+ # There is no way to disable `sriovNetSupport` at this time.
888
+ #
889
+ # This option is supported only for HVM AMIs. Specifying this option
890
+ # with a PV AMI can make instances launched from the AMI unreachable.
891
+ # @option options [Boolean] :ena_support
892
+ # Set to `true` to enable enhanced networking with ENA for the AMI and
893
+ # any instances that you launch from the AMI.
894
+ #
895
+ # This option is supported only for HVM AMIs. Specifying this option
896
+ # with a PV AMI can make instances launched from the AMI unreachable.
897
+ # @return [Image]
898
+ def register_image(options = {})
899
+ resp = @client.register_image(options)
900
+ Image.new(
901
+ id: resp.data.image_id,
902
+ client: @client
903
+ )
904
+ end
905
+
906
+ # @!group Associations
907
+
908
+ # @example Request syntax with placeholder values
909
+ #
910
+ # classicaddresses = ec2.classic_addresses({
911
+ # dry_run: false,
912
+ # public_ips: ["String"],
913
+ # filters: [
914
+ # {
915
+ # name: "String",
916
+ # values: ["String"],
917
+ # },
918
+ # ],
919
+ # allocation_ids: ["String"],
920
+ # })
921
+ # @param [Hash] options ({})
922
+ # @option options [Boolean] :dry_run
923
+ # Checks whether you have the required permissions for the action,
924
+ # without actually making the request, and provides an error response.
925
+ # If you have the required permissions, the error response is
926
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
927
+ # @option options [Array<String>] :public_ips
928
+ # \[EC2-Classic\] One or more Elastic IP addresses.
929
+ #
930
+ # Default: Describes all your Elastic IP addresses.
931
+ # @option options [Array<Types::Filter>] :filters
932
+ # One or more filters. Filter names and values are case-sensitive.
933
+ #
934
+ # * `allocation-id` - \[EC2-VPC\] The allocation ID for the address.
935
+ #
936
+ # * `association-id` - \[EC2-VPC\] The association ID for the address.
937
+ #
938
+ # * `domain` - Indicates whether the address is for use in EC2-Classic
939
+ # (`standard`) or in a VPC (`vpc`).
940
+ #
941
+ # * `instance-id` - The ID of the instance the address is associated
942
+ # with, if any.
943
+ #
944
+ # * `network-interface-id` - \[EC2-VPC\] The ID of the network interface
945
+ # that the address is associated with, if any.
946
+ #
947
+ # * `network-interface-owner-id` - The AWS account ID of the owner.
948
+ #
949
+ # * `private-ip-address` - \[EC2-VPC\] The private IP address associated
950
+ # with the Elastic IP address.
951
+ #
952
+ # * `public-ip` - The Elastic IP address.
953
+ # @option options [Array<String>] :allocation_ids
954
+ # \[EC2-VPC\] One or more allocation IDs.
955
+ #
956
+ # Default: Describes all your Elastic IP addresses.
957
+ # @return [ClassicAddress::Collection]
958
+ def classic_addresses(options = {})
959
+ batches = Enumerator.new do |y|
960
+ batch = []
961
+ options = Aws::Util.deep_merge(options, filters: [{
962
+ name: "domain",
963
+ values: ["standard"]
964
+ }])
965
+ resp = @client.describe_addresses(options)
966
+ resp.data.addresses.each do |a|
967
+ batch << ClassicAddress.new(
968
+ public_ip: a.public_ip,
969
+ data: a,
970
+ client: @client
971
+ )
972
+ end
973
+ y.yield(batch)
974
+ end
975
+ ClassicAddress::Collection.new(batches)
976
+ end
977
+
978
+ # @param [String] id
979
+ # @return [DhcpOptions]
980
+ def dhcp_options(id)
981
+ DhcpOptions.new(
982
+ id: id,
983
+ client: @client
984
+ )
985
+ end
986
+
987
+ # @example Request syntax with placeholder values
988
+ #
989
+ # dhcpoptionssets = ec2.dhcp_options_sets({
990
+ # dry_run: false,
991
+ # dhcp_options_ids: ["String"],
992
+ # filters: [
993
+ # {
994
+ # name: "String",
995
+ # values: ["String"],
996
+ # },
997
+ # ],
998
+ # })
999
+ # @param [Hash] options ({})
1000
+ # @option options [Boolean] :dry_run
1001
+ # Checks whether you have the required permissions for the action,
1002
+ # without actually making the request, and provides an error response.
1003
+ # If you have the required permissions, the error response is
1004
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1005
+ # @option options [Array<String>] :dhcp_options_ids
1006
+ # The IDs of one or more DHCP options sets.
1007
+ #
1008
+ # Default: Describes all your DHCP options sets.
1009
+ # @option options [Array<Types::Filter>] :filters
1010
+ # One or more filters.
1011
+ #
1012
+ # * `dhcp-options-id` - The ID of a set of DHCP options.
1013
+ #
1014
+ # * `key` - The key for one of the options (for example, `domain-name`).
1015
+ #
1016
+ # * `value` - The value for one of the options.
1017
+ #
1018
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1019
+ # to the resource.
1020
+ #
1021
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1022
+ # is independent of the `tag-value` filter. For example, if you use
1023
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
1024
+ # you get any resources assigned both the tag key Purpose (regardless
1025
+ # of what the tag's value is), and the tag value X (regardless of
1026
+ # what the tag's key is). If you want to list only resources where
1027
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
1028
+ #
1029
+ # * `tag-value` - The value of a tag assigned to the resource. This
1030
+ # filter is independent of the `tag-key` filter.
1031
+ # @return [DhcpOptions::Collection]
1032
+ def dhcp_options_sets(options = {})
1033
+ batches = Enumerator.new do |y|
1034
+ batch = []
1035
+ resp = @client.describe_dhcp_options(options)
1036
+ resp.data.dhcp_options.each do |d|
1037
+ batch << DhcpOptions.new(
1038
+ id: d.dhcp_options_id,
1039
+ data: d,
1040
+ client: @client
1041
+ )
1042
+ end
1043
+ y.yield(batch)
1044
+ end
1045
+ DhcpOptions::Collection.new(batches)
1046
+ end
1047
+
1048
+ # @param [String] id
1049
+ # @return [Image]
1050
+ def image(id)
1051
+ Image.new(
1052
+ id: id,
1053
+ client: @client
1054
+ )
1055
+ end
1056
+
1057
+ # @example Request syntax with placeholder values
1058
+ #
1059
+ # images = ec2.images({
1060
+ # dry_run: false,
1061
+ # image_ids: ["String"],
1062
+ # owners: ["String"],
1063
+ # executable_users: ["String"],
1064
+ # filters: [
1065
+ # {
1066
+ # name: "String",
1067
+ # values: ["String"],
1068
+ # },
1069
+ # ],
1070
+ # })
1071
+ # @param [Hash] options ({})
1072
+ # @option options [Boolean] :dry_run
1073
+ # Checks whether you have the required permissions for the action,
1074
+ # without actually making the request, and provides an error response.
1075
+ # If you have the required permissions, the error response is
1076
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1077
+ # @option options [Array<String>] :image_ids
1078
+ # One or more image IDs.
1079
+ #
1080
+ # Default: Describes all images available to you.
1081
+ # @option options [Array<String>] :owners
1082
+ # Filters the images by the owner. Specify an AWS account ID, `self`
1083
+ # (owner is the sender of the request), or an AWS owner alias (valid
1084
+ # values are `amazon` \| `aws-marketplace` \| `microsoft`). Omitting
1085
+ # this option returns all images for which you have launch permissions,
1086
+ # regardless of ownership.
1087
+ # @option options [Array<String>] :executable_users
1088
+ # Scopes the images by users with explicit launch permissions. Specify
1089
+ # an AWS account ID, `self` (the sender of the request), or `all`
1090
+ # (public AMIs).
1091
+ # @option options [Array<Types::Filter>] :filters
1092
+ # One or more filters.
1093
+ #
1094
+ # * `architecture` - The image architecture (`i386` \| `x86_64`).
1095
+ #
1096
+ # * `block-device-mapping.delete-on-termination` - A Boolean value that
1097
+ # indicates whether the Amazon EBS volume is deleted on instance
1098
+ # termination.
1099
+ #
1100
+ # * `block-device-mapping.device-name` - The device name for the EBS
1101
+ # volume (for example, `/dev/sdh`).
1102
+ #
1103
+ # * `block-device-mapping.snapshot-id` - The ID of the snapshot used for
1104
+ # the EBS volume.
1105
+ #
1106
+ # * `block-device-mapping.volume-size` - The volume size of the EBS
1107
+ # volume, in GiB.
1108
+ #
1109
+ # * `block-device-mapping.volume-type` - The volume type of the EBS
1110
+ # volume (`gp2` \| `io1` \| `st1 `\| `sc1` \| `standard`).
1111
+ #
1112
+ # * `description` - The description of the image (provided during image
1113
+ # creation).
1114
+ #
1115
+ # * `hypervisor` - The hypervisor type (`ovm` \| `xen`).
1116
+ #
1117
+ # * `image-id` - The ID of the image.
1118
+ #
1119
+ # * `image-type` - The image type (`machine` \| `kernel` \| `ramdisk`).
1120
+ #
1121
+ # * `is-public` - A Boolean that indicates whether the image is public.
1122
+ #
1123
+ # * `kernel-id` - The kernel ID.
1124
+ #
1125
+ # * `manifest-location` - The location of the image manifest.
1126
+ #
1127
+ # * `name` - The name of the AMI (provided during image creation).
1128
+ #
1129
+ # * `owner-alias` - String value from an Amazon-maintained list
1130
+ # (`amazon` \| `aws-marketplace` \| `microsoft`) of snapshot owners.
1131
+ # Not to be confused with the user-configured AWS account alias, which
1132
+ # is set from the IAM console.
1133
+ #
1134
+ # * `owner-id` - The AWS account ID of the image owner.
1135
+ #
1136
+ # * `platform` - The platform. To only list Windows-based AMIs, use
1137
+ # `windows`.
1138
+ #
1139
+ # * `product-code` - The product code.
1140
+ #
1141
+ # * `product-code.type` - The type of the product code (`devpay` \|
1142
+ # `marketplace`).
1143
+ #
1144
+ # * `ramdisk-id` - The RAM disk ID.
1145
+ #
1146
+ # * `root-device-name` - The name of the root device volume (for
1147
+ # example, `/dev/sda1`).
1148
+ #
1149
+ # * `root-device-type` - The type of the root device volume (`ebs` \|
1150
+ # `instance-store`).
1151
+ #
1152
+ # * `state` - The state of the image (`available` \| `pending` \|
1153
+ # `failed`).
1154
+ #
1155
+ # * `state-reason-code` - The reason code for the state change.
1156
+ #
1157
+ # * `state-reason-message` - The message for the state change.
1158
+ #
1159
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1160
+ # to the resource.
1161
+ #
1162
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1163
+ # is independent of the tag-value filter. For example, if you use both
1164
+ # the filter "tag-key=Purpose" and the filter "tag-value=X", you
1165
+ # get any resources assigned both the tag key Purpose (regardless of
1166
+ # what the tag's value is), and the tag value X (regardless of what
1167
+ # the tag's key is). If you want to list only resources where Purpose
1168
+ # is X, see the `tag`\:*key*=*value* filter.
1169
+ #
1170
+ # * `tag-value` - The value of a tag assigned to the resource. This
1171
+ # filter is independent of the `tag-key` filter.
1172
+ #
1173
+ # * `virtualization-type` - The virtualization type (`paravirtual` \|
1174
+ # `hvm`).
1175
+ # @return [Image::Collection]
1176
+ def images(options = {})
1177
+ batches = Enumerator.new do |y|
1178
+ batch = []
1179
+ resp = @client.describe_images(options)
1180
+ resp.data.images.each do |i|
1181
+ batch << Image.new(
1182
+ id: i.image_id,
1183
+ data: i,
1184
+ client: @client
1185
+ )
1186
+ end
1187
+ y.yield(batch)
1188
+ end
1189
+ Image::Collection.new(batches)
1190
+ end
1191
+
1192
+ # @param [String] id
1193
+ # @return [Instance]
1194
+ def instance(id)
1195
+ Instance.new(
1196
+ id: id,
1197
+ client: @client
1198
+ )
1199
+ end
1200
+
1201
+ # @example Request syntax with placeholder values
1202
+ #
1203
+ # instances = ec2.instances({
1204
+ # dry_run: false,
1205
+ # instance_ids: ["String"],
1206
+ # filters: [
1207
+ # {
1208
+ # name: "String",
1209
+ # values: ["String"],
1210
+ # },
1211
+ # ],
1212
+ # })
1213
+ # @param [Hash] options ({})
1214
+ # @option options [Boolean] :dry_run
1215
+ # Checks whether you have the required permissions for the action,
1216
+ # without actually making the request, and provides an error response.
1217
+ # If you have the required permissions, the error response is
1218
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1219
+ # @option options [Array<String>] :instance_ids
1220
+ # One or more instance IDs.
1221
+ #
1222
+ # Default: Describes all your instances.
1223
+ # @option options [Array<Types::Filter>] :filters
1224
+ # One or more filters.
1225
+ #
1226
+ # * `affinity` - The affinity setting for an instance running on a
1227
+ # Dedicated Host (`default` \| `host`).
1228
+ #
1229
+ # * `architecture` - The instance architecture (`i386` \| `x86_64`).
1230
+ #
1231
+ # * `availability-zone` - The Availability Zone of the instance.
1232
+ #
1233
+ # * `block-device-mapping.attach-time` - The attach time for an EBS
1234
+ # volume mapped to the instance, for example,
1235
+ # `2010-09-15T17:15:20.000Z`.
1236
+ #
1237
+ # * `block-device-mapping.delete-on-termination` - A Boolean that
1238
+ # indicates whether the EBS volume is deleted on instance termination.
1239
+ #
1240
+ # * `block-device-mapping.device-name` - The device name for the EBS
1241
+ # volume (for example, `/dev/sdh` or `xvdh`).
1242
+ #
1243
+ # * `block-device-mapping.status` - The status for the EBS volume
1244
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
1245
+ #
1246
+ # * `block-device-mapping.volume-id` - The volume ID of the EBS volume.
1247
+ #
1248
+ # * `client-token` - The idempotency token you provided when you
1249
+ # launched the instance.
1250
+ #
1251
+ # * `dns-name` - The public DNS name of the instance.
1252
+ #
1253
+ # * `group-id` - The ID of the security group for the instance.
1254
+ # EC2-Classic only.
1255
+ #
1256
+ # * `group-name` - The name of the security group for the instance.
1257
+ # EC2-Classic only.
1258
+ #
1259
+ # * `host-id` - The ID of the Dedicated Host on which the instance is
1260
+ # running, if applicable.
1261
+ #
1262
+ # * `hypervisor` - The hypervisor type of the instance (`ovm` \| `xen`).
1263
+ #
1264
+ # * `iam-instance-profile.arn` - The instance profile associated with
1265
+ # the instance. Specified as an ARN.
1266
+ #
1267
+ # * `image-id` - The ID of the image used to launch the instance.
1268
+ #
1269
+ # * `instance-id` - The ID of the instance.
1270
+ #
1271
+ # * `instance-lifecycle` - Indicates whether this is a Spot Instance or
1272
+ # a Scheduled Instance (`spot` \| `scheduled`).
1273
+ #
1274
+ # * `instance-state-code` - The state of the instance, as a 16-bit
1275
+ # unsigned integer. The high byte is an opaque internal value and
1276
+ # should be ignored. The low byte is set based on the state
1277
+ # represented. The valid values are: 0 (pending), 16 (running), 32
1278
+ # (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).
1279
+ #
1280
+ # * `instance-state-name` - The state of the instance (`pending` \|
1281
+ # `running` \| `shutting-down` \| `terminated` \| `stopping` \|
1282
+ # `stopped`).
1283
+ #
1284
+ # * `instance-type` - The type of instance (for example, `t2.micro`).
1285
+ #
1286
+ # * `instance.group-id` - The ID of the security group for the instance.
1287
+ #
1288
+ # * `instance.group-name` - The name of the security group for the
1289
+ # instance.
1290
+ #
1291
+ # * `ip-address` - The public IP address of the instance.
1292
+ #
1293
+ # * `kernel-id` - The kernel ID.
1294
+ #
1295
+ # * `key-name` - The name of the key pair used when the instance was
1296
+ # launched.
1297
+ #
1298
+ # * `launch-index` - When launching multiple instances, this is the
1299
+ # index for the instance in the launch group (for example, 0, 1, 2,
1300
+ # and so on).
1301
+ #
1302
+ # * `launch-time` - The time when the instance was launched.
1303
+ #
1304
+ # * `monitoring-state` - Indicates whether monitoring is enabled for the
1305
+ # instance (`disabled` \| `enabled`).
1306
+ #
1307
+ # * `owner-id` - The AWS account ID of the instance owner.
1308
+ #
1309
+ # * `placement-group-name` - The name of the placement group for the
1310
+ # instance.
1311
+ #
1312
+ # * `platform` - The platform. Use `windows` if you have Windows
1313
+ # instances; otherwise, leave blank.
1314
+ #
1315
+ # * `private-dns-name` - The private DNS name of the instance.
1316
+ #
1317
+ # * `private-ip-address` - The private IP address of the instance.
1318
+ #
1319
+ # * `product-code` - The product code associated with the AMI used to
1320
+ # launch the instance.
1321
+ #
1322
+ # * `product-code.type` - The type of product code (`devpay` \|
1323
+ # `marketplace`).
1324
+ #
1325
+ # * `ramdisk-id` - The RAM disk ID.
1326
+ #
1327
+ # * `reason` - The reason for the current state of the instance (for
1328
+ # example, shows "User Initiated \[date\]" when you stop or
1329
+ # terminate the instance). Similar to the state-reason-code filter.
1330
+ #
1331
+ # * `requester-id` - The ID of the entity that launched the instance on
1332
+ # your behalf (for example, AWS Management Console, Auto Scaling, and
1333
+ # so on).
1334
+ #
1335
+ # * `reservation-id` - The ID of the instance's reservation. A
1336
+ # reservation ID is created any time you launch an instance. A
1337
+ # reservation ID has a one-to-one relationship with an instance launch
1338
+ # request, but can be associated with more than one instance if you
1339
+ # launch multiple instances using the same launch request. For
1340
+ # example, if you launch one instance, you'll get one reservation ID.
1341
+ # If you launch ten instances using the same launch request, you'll
1342
+ # also get one reservation ID.
1343
+ #
1344
+ # * `root-device-name` - The name of the root device for the instance
1345
+ # (for example, `/dev/sda1` or `/dev/xvda`).
1346
+ #
1347
+ # * `root-device-type` - The type of root device that the instance uses
1348
+ # (`ebs` \| `instance-store`).
1349
+ #
1350
+ # * `source-dest-check` - Indicates whether the instance performs
1351
+ # source/destination checking. A value of `true` means that checking
1352
+ # is enabled, and `false` means checking is disabled. The value must
1353
+ # be `false` for the instance to perform network address translation
1354
+ # (NAT) in your VPC.
1355
+ #
1356
+ # * `spot-instance-request-id` - The ID of the Spot instance request.
1357
+ #
1358
+ # * `state-reason-code` - The reason code for the state change.
1359
+ #
1360
+ # * `state-reason-message` - A message that describes the state change.
1361
+ #
1362
+ # * `subnet-id` - The ID of the subnet for the instance.
1363
+ #
1364
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1365
+ # to the resource, where `tag`\:*key* is the tag's key.
1366
+ #
1367
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1368
+ # is independent of the `tag-value` filter. For example, if you use
1369
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
1370
+ # you get any resources assigned both the tag key Purpose (regardless
1371
+ # of what the tag's value is), and the tag value X (regardless of
1372
+ # what the tag's key is). If you want to list only resources where
1373
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
1374
+ #
1375
+ # * `tag-value` - The value of a tag assigned to the resource. This
1376
+ # filter is independent of the `tag-key` filter.
1377
+ #
1378
+ # * `tenancy` - The tenancy of an instance (`dedicated` \| `default` \|
1379
+ # `host`).
1380
+ #
1381
+ # * `virtualization-type` - The virtualization type of the instance
1382
+ # (`paravirtual` \| `hvm`).
1383
+ #
1384
+ # * `vpc-id` - The ID of the VPC that the instance is running in.
1385
+ #
1386
+ # * `network-interface.description` - The description of the network
1387
+ # interface.
1388
+ #
1389
+ # * `network-interface.subnet-id` - The ID of the subnet for the network
1390
+ # interface.
1391
+ #
1392
+ # * `network-interface.vpc-id` - The ID of the VPC for the network
1393
+ # interface.
1394
+ #
1395
+ # * `network-interface.network-interface-id` - The ID of the network
1396
+ # interface.
1397
+ #
1398
+ # * `network-interface.owner-id` - The ID of the owner of the network
1399
+ # interface.
1400
+ #
1401
+ # * `network-interface.availability-zone` - The Availability Zone for
1402
+ # the network interface.
1403
+ #
1404
+ # * `network-interface.requester-id` - The requester ID for the network
1405
+ # interface.
1406
+ #
1407
+ # * `network-interface.requester-managed` - Indicates whether the
1408
+ # network interface is being managed by AWS.
1409
+ #
1410
+ # * `network-interface.status` - The status of the network interface
1411
+ # (`available`) \| `in-use`).
1412
+ #
1413
+ # * `network-interface.mac-address` - The MAC address of the network
1414
+ # interface.
1415
+ #
1416
+ # * `network-interface.private-dns-name` - The private DNS name of the
1417
+ # network interface.
1418
+ #
1419
+ # * `network-interface.source-dest-check` - Whether the network
1420
+ # interface performs source/destination checking. A value of `true`
1421
+ # means checking is enabled, and `false` means checking is disabled.
1422
+ # The value must be `false` for the network interface to perform
1423
+ # network address translation (NAT) in your VPC.
1424
+ #
1425
+ # * `network-interface.group-id` - The ID of a security group associated
1426
+ # with the network interface.
1427
+ #
1428
+ # * `network-interface.group-name` - The name of a security group
1429
+ # associated with the network interface.
1430
+ #
1431
+ # * `network-interface.attachment.attachment-id` - The ID of the
1432
+ # interface attachment.
1433
+ #
1434
+ # * `network-interface.attachment.instance-id` - The ID of the instance
1435
+ # to which the network interface is attached.
1436
+ #
1437
+ # * `network-interface.attachment.instance-owner-id` - The owner ID of
1438
+ # the instance to which the network interface is attached.
1439
+ #
1440
+ # * `network-interface.addresses.private-ip-address` - The private IP
1441
+ # address associated with the network interface.
1442
+ #
1443
+ # * `network-interface.attachment.device-index` - The device index to
1444
+ # which the network interface is attached.
1445
+ #
1446
+ # * `network-interface.attachment.status` - The status of the attachment
1447
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
1448
+ #
1449
+ # * `network-interface.attachment.attach-time` - The time that the
1450
+ # network interface was attached to an instance.
1451
+ #
1452
+ # * `network-interface.attachment.delete-on-termination` - Specifies
1453
+ # whether the attachment is deleted when an instance is terminated.
1454
+ #
1455
+ # * `network-interface.addresses.primary` - Specifies whether the IP
1456
+ # address of the network interface is the primary private IP address.
1457
+ #
1458
+ # * `network-interface.addresses.association.public-ip` - The ID of the
1459
+ # association of an Elastic IP address with a network interface.
1460
+ #
1461
+ # * `network-interface.addresses.association.ip-owner-id` - The owner ID
1462
+ # of the private IP address associated with the network interface.
1463
+ #
1464
+ # * `association.public-ip` - The address of the Elastic IP address
1465
+ # bound to the network interface.
1466
+ #
1467
+ # * `association.ip-owner-id` - The owner of the Elastic IP address
1468
+ # associated with the network interface.
1469
+ #
1470
+ # * `association.allocation-id` - The allocation ID returned when you
1471
+ # allocated the Elastic IP address for your network interface.
1472
+ #
1473
+ # * `association.association-id` - The association ID returned when the
1474
+ # network interface was associated with an IP address.
1475
+ # @return [Instance::Collection]
1476
+ def instances(options = {})
1477
+ batches = Enumerator.new do |y|
1478
+ resp = @client.describe_instances(options)
1479
+ resp.each_page do |page|
1480
+ batch = []
1481
+ page.data.reservations.each do |r|
1482
+ r.instances.each do |i|
1483
+ batch << Instance.new(
1484
+ id: i.instance_id,
1485
+ data: i,
1486
+ client: @client
1487
+ )
1488
+ end
1489
+ end
1490
+ y.yield(batch)
1491
+ end
1492
+ end
1493
+ Instance::Collection.new(batches)
1494
+ end
1495
+
1496
+ # @param [String] id
1497
+ # @return [InternetGateway]
1498
+ def internet_gateway(id)
1499
+ InternetGateway.new(
1500
+ id: id,
1501
+ client: @client
1502
+ )
1503
+ end
1504
+
1505
+ # @example Request syntax with placeholder values
1506
+ #
1507
+ # internetgateways = ec2.internet_gateways({
1508
+ # dry_run: false,
1509
+ # internet_gateway_ids: ["String"],
1510
+ # filters: [
1511
+ # {
1512
+ # name: "String",
1513
+ # values: ["String"],
1514
+ # },
1515
+ # ],
1516
+ # })
1517
+ # @param [Hash] options ({})
1518
+ # @option options [Boolean] :dry_run
1519
+ # Checks whether you have the required permissions for the action,
1520
+ # without actually making the request, and provides an error response.
1521
+ # If you have the required permissions, the error response is
1522
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1523
+ # @option options [Array<String>] :internet_gateway_ids
1524
+ # One or more Internet gateway IDs.
1525
+ #
1526
+ # Default: Describes all your Internet gateways.
1527
+ # @option options [Array<Types::Filter>] :filters
1528
+ # One or more filters.
1529
+ #
1530
+ # * `attachment.state` - The current state of the attachment between the
1531
+ # gateway and the VPC (`available`). Present only if a VPC is
1532
+ # attached.
1533
+ #
1534
+ # * `attachment.vpc-id` - The ID of an attached VPC.
1535
+ #
1536
+ # * `internet-gateway-id` - The ID of the Internet gateway.
1537
+ #
1538
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1539
+ # to the resource.
1540
+ #
1541
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1542
+ # is independent of the `tag-value` filter. For example, if you use
1543
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
1544
+ # you get any resources assigned both the tag key Purpose (regardless
1545
+ # of what the tag's value is), and the tag value X (regardless of
1546
+ # what the tag's key is). If you want to list only resources where
1547
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
1548
+ #
1549
+ # * `tag-value` - The value of a tag assigned to the resource. This
1550
+ # filter is independent of the `tag-key` filter.
1551
+ # @return [InternetGateway::Collection]
1552
+ def internet_gateways(options = {})
1553
+ batches = Enumerator.new do |y|
1554
+ batch = []
1555
+ resp = @client.describe_internet_gateways(options)
1556
+ resp.data.internet_gateways.each do |i|
1557
+ batch << InternetGateway.new(
1558
+ id: i.internet_gateway_id,
1559
+ data: i,
1560
+ client: @client
1561
+ )
1562
+ end
1563
+ y.yield(batch)
1564
+ end
1565
+ InternetGateway::Collection.new(batches)
1566
+ end
1567
+
1568
+ # @param [String] name
1569
+ # @return [KeyPairInfo]
1570
+ def key_pair(name)
1571
+ KeyPairInfo.new(
1572
+ name: name,
1573
+ client: @client
1574
+ )
1575
+ end
1576
+
1577
+ # @example Request syntax with placeholder values
1578
+ #
1579
+ # keypairs = ec2.key_pairs({
1580
+ # dry_run: false,
1581
+ # key_names: ["String"],
1582
+ # filters: [
1583
+ # {
1584
+ # name: "String",
1585
+ # values: ["String"],
1586
+ # },
1587
+ # ],
1588
+ # })
1589
+ # @param [Hash] options ({})
1590
+ # @option options [Boolean] :dry_run
1591
+ # Checks whether you have the required permissions for the action,
1592
+ # without actually making the request, and provides an error response.
1593
+ # If you have the required permissions, the error response is
1594
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1595
+ # @option options [Array<String>] :key_names
1596
+ # One or more key pair names.
1597
+ #
1598
+ # Default: Describes all your key pairs.
1599
+ # @option options [Array<Types::Filter>] :filters
1600
+ # One or more filters.
1601
+ #
1602
+ # * `fingerprint` - The fingerprint of the key pair.
1603
+ #
1604
+ # * `key-name` - The name of the key pair.
1605
+ # @return [KeyPairInfo::Collection]
1606
+ def key_pairs(options = {})
1607
+ batches = Enumerator.new do |y|
1608
+ batch = []
1609
+ resp = @client.describe_key_pairs(options)
1610
+ resp.data.key_pairs.each do |k|
1611
+ batch << KeyPairInfo.new(
1612
+ name: k.key_name,
1613
+ data: k,
1614
+ client: @client
1615
+ )
1616
+ end
1617
+ y.yield(batch)
1618
+ end
1619
+ KeyPairInfo::Collection.new(batches)
1620
+ end
1621
+
1622
+ # @param [String] id
1623
+ # @return [NetworkAcl]
1624
+ def network_acl(id)
1625
+ NetworkAcl.new(
1626
+ id: id,
1627
+ client: @client
1628
+ )
1629
+ end
1630
+
1631
+ # @example Request syntax with placeholder values
1632
+ #
1633
+ # networkacls = ec2.network_acls({
1634
+ # dry_run: false,
1635
+ # network_acl_ids: ["String"],
1636
+ # filters: [
1637
+ # {
1638
+ # name: "String",
1639
+ # values: ["String"],
1640
+ # },
1641
+ # ],
1642
+ # })
1643
+ # @param [Hash] options ({})
1644
+ # @option options [Boolean] :dry_run
1645
+ # Checks whether you have the required permissions for the action,
1646
+ # without actually making the request, and provides an error response.
1647
+ # If you have the required permissions, the error response is
1648
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1649
+ # @option options [Array<String>] :network_acl_ids
1650
+ # One or more network ACL IDs.
1651
+ #
1652
+ # Default: Describes all your network ACLs.
1653
+ # @option options [Array<Types::Filter>] :filters
1654
+ # One or more filters.
1655
+ #
1656
+ # * `association.association-id` - The ID of an association ID for the
1657
+ # ACL.
1658
+ #
1659
+ # * `association.network-acl-id` - The ID of the network ACL involved in
1660
+ # the association.
1661
+ #
1662
+ # * `association.subnet-id` - The ID of the subnet involved in the
1663
+ # association.
1664
+ #
1665
+ # * `default` - Indicates whether the ACL is the default network ACL for
1666
+ # the VPC.
1667
+ #
1668
+ # * `entry.cidr` - The CIDR range specified in the entry.
1669
+ #
1670
+ # * `entry.egress` - Indicates whether the entry applies to egress
1671
+ # traffic.
1672
+ #
1673
+ # * `entry.icmp.code` - The ICMP code specified in the entry, if any.
1674
+ #
1675
+ # * `entry.icmp.type` - The ICMP type specified in the entry, if any.
1676
+ #
1677
+ # * `entry.port-range.from` - The start of the port range specified in
1678
+ # the entry.
1679
+ #
1680
+ # * `entry.port-range.to` - The end of the port range specified in the
1681
+ # entry.
1682
+ #
1683
+ # * `entry.protocol` - The protocol specified in the entry (`tcp` \|
1684
+ # `udp` \| `icmp` or a protocol number).
1685
+ #
1686
+ # * `entry.rule-action` - Allows or denies the matching traffic (`allow`
1687
+ # \| `deny`).
1688
+ #
1689
+ # * `entry.rule-number` - The number of an entry (in other words, rule)
1690
+ # in the ACL's set of entries.
1691
+ #
1692
+ # * `network-acl-id` - The ID of the network ACL.
1693
+ #
1694
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1695
+ # to the resource.
1696
+ #
1697
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1698
+ # is independent of the `tag-value` filter. For example, if you use
1699
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
1700
+ # you get any resources assigned both the tag key Purpose (regardless
1701
+ # of what the tag's value is), and the tag value X (regardless of
1702
+ # what the tag's key is). If you want to list only resources where
1703
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
1704
+ #
1705
+ # * `tag-value` - The value of a tag assigned to the resource. This
1706
+ # filter is independent of the `tag-key` filter.
1707
+ #
1708
+ # * `vpc-id` - The ID of the VPC for the network ACL.
1709
+ # @return [NetworkAcl::Collection]
1710
+ def network_acls(options = {})
1711
+ batches = Enumerator.new do |y|
1712
+ batch = []
1713
+ resp = @client.describe_network_acls(options)
1714
+ resp.data.network_acls.each do |n|
1715
+ batch << NetworkAcl.new(
1716
+ id: n.network_acl_id,
1717
+ data: n,
1718
+ client: @client
1719
+ )
1720
+ end
1721
+ y.yield(batch)
1722
+ end
1723
+ NetworkAcl::Collection.new(batches)
1724
+ end
1725
+
1726
+ # @param [String] id
1727
+ # @return [NetworkInterface]
1728
+ def network_interface(id)
1729
+ NetworkInterface.new(
1730
+ id: id,
1731
+ client: @client
1732
+ )
1733
+ end
1734
+
1735
+ # @example Request syntax with placeholder values
1736
+ #
1737
+ # networkinterfaces = ec2.network_interfaces({
1738
+ # dry_run: false,
1739
+ # network_interface_ids: ["String"],
1740
+ # filters: [
1741
+ # {
1742
+ # name: "String",
1743
+ # values: ["String"],
1744
+ # },
1745
+ # ],
1746
+ # })
1747
+ # @param [Hash] options ({})
1748
+ # @option options [Boolean] :dry_run
1749
+ # Checks whether you have the required permissions for the action,
1750
+ # without actually making the request, and provides an error response.
1751
+ # If you have the required permissions, the error response is
1752
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1753
+ # @option options [Array<String>] :network_interface_ids
1754
+ # One or more network interface IDs.
1755
+ #
1756
+ # Default: Describes all your network interfaces.
1757
+ # @option options [Array<Types::Filter>] :filters
1758
+ # One or more filters.
1759
+ #
1760
+ # * `addresses.private-ip-address` - The private IP addresses associated
1761
+ # with the network interface.
1762
+ #
1763
+ # * `addresses.primary` - Whether the private IP address is the primary
1764
+ # IP address associated with the network interface.
1765
+ #
1766
+ # * `addresses.association.public-ip` - The association ID returned when
1767
+ # the network interface was associated with the Elastic IP address.
1768
+ #
1769
+ # * `addresses.association.owner-id` - The owner ID of the addresses
1770
+ # associated with the network interface.
1771
+ #
1772
+ # * `association.association-id` - The association ID returned when the
1773
+ # network interface was associated with an IP address.
1774
+ #
1775
+ # * `association.allocation-id` - The allocation ID returned when you
1776
+ # allocated the Elastic IP address for your network interface.
1777
+ #
1778
+ # * `association.ip-owner-id` - The owner of the Elastic IP address
1779
+ # associated with the network interface.
1780
+ #
1781
+ # * `association.public-ip` - The address of the Elastic IP address
1782
+ # bound to the network interface.
1783
+ #
1784
+ # * `association.public-dns-name` - The public DNS name for the network
1785
+ # interface.
1786
+ #
1787
+ # * `attachment.attachment-id` - The ID of the interface attachment.
1788
+ #
1789
+ # * `attachment.attach.time` - The time that the network interface was
1790
+ # attached to an instance.
1791
+ #
1792
+ # * `attachment.delete-on-termination` - Indicates whether the
1793
+ # attachment is deleted when an instance is terminated.
1794
+ #
1795
+ # * `attachment.device-index` - The device index to which the network
1796
+ # interface is attached.
1797
+ #
1798
+ # * `attachment.instance-id` - The ID of the instance to which the
1799
+ # network interface is attached.
1800
+ #
1801
+ # * `attachment.instance-owner-id` - The owner ID of the instance to
1802
+ # which the network interface is attached.
1803
+ #
1804
+ # * `attachment.nat-gateway-id` - The ID of the NAT gateway to which the
1805
+ # network interface is attached.
1806
+ #
1807
+ # * `attachment.status` - The status of the attachment (`attaching` \|
1808
+ # `attached` \| `detaching` \| `detached`).
1809
+ #
1810
+ # * `availability-zone` - The Availability Zone of the network
1811
+ # interface.
1812
+ #
1813
+ # * `description` - The description of the network interface.
1814
+ #
1815
+ # * `group-id` - The ID of a security group associated with the network
1816
+ # interface.
1817
+ #
1818
+ # * `group-name` - The name of a security group associated with the
1819
+ # network interface.
1820
+ #
1821
+ # * `mac-address` - The MAC address of the network interface.
1822
+ #
1823
+ # * `network-interface-id` - The ID of the network interface.
1824
+ #
1825
+ # * `owner-id` - The AWS account ID of the network interface owner.
1826
+ #
1827
+ # * `private-ip-address` - The private IP address or addresses of the
1828
+ # network interface.
1829
+ #
1830
+ # * `private-dns-name` - The private DNS name of the network interface.
1831
+ #
1832
+ # * `requester-id` - The ID of the entity that launched the instance on
1833
+ # your behalf (for example, AWS Management Console, Auto Scaling, and
1834
+ # so on).
1835
+ #
1836
+ # * `requester-managed` - Indicates whether the network interface is
1837
+ # being managed by an AWS service (for example, AWS Management
1838
+ # Console, Auto Scaling, and so on).
1839
+ #
1840
+ # * `source-desk-check` - Indicates whether the network interface
1841
+ # performs source/destination checking. A value of `true` means
1842
+ # checking is enabled, and `false` means checking is disabled. The
1843
+ # value must be `false` for the network interface to perform network
1844
+ # address translation (NAT) in your VPC.
1845
+ #
1846
+ # * `status` - The status of the network interface. If the network
1847
+ # interface is not attached to an instance, the status is `available`;
1848
+ # if a network interface is attached to an instance the status is
1849
+ # `in-use`.
1850
+ #
1851
+ # * `subnet-id` - The ID of the subnet for the network interface.
1852
+ #
1853
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
1854
+ # to the resource.
1855
+ #
1856
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
1857
+ # is independent of the `tag-value` filter. For example, if you use
1858
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
1859
+ # you get any resources assigned both the tag key Purpose (regardless
1860
+ # of what the tag's value is), and the tag value X (regardless of
1861
+ # what the tag's key is). If you want to list only resources where
1862
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
1863
+ #
1864
+ # * `tag-value` - The value of a tag assigned to the resource. This
1865
+ # filter is independent of the `tag-key` filter.
1866
+ #
1867
+ # * `vpc-id` - The ID of the VPC for the network interface.
1868
+ # @return [NetworkInterface::Collection]
1869
+ def network_interfaces(options = {})
1870
+ batches = Enumerator.new do |y|
1871
+ batch = []
1872
+ resp = @client.describe_network_interfaces(options)
1873
+ resp.data.network_interfaces.each do |n|
1874
+ batch << NetworkInterface.new(
1875
+ id: n.network_interface_id,
1876
+ data: n,
1877
+ client: @client
1878
+ )
1879
+ end
1880
+ y.yield(batch)
1881
+ end
1882
+ NetworkInterface::Collection.new(batches)
1883
+ end
1884
+
1885
+ # @param [String] name
1886
+ # @return [PlacementGroup]
1887
+ def placement_group(name)
1888
+ PlacementGroup.new(
1889
+ name: name,
1890
+ client: @client
1891
+ )
1892
+ end
1893
+
1894
+ # @example Request syntax with placeholder values
1895
+ #
1896
+ # placementgroups = ec2.placement_groups({
1897
+ # dry_run: false,
1898
+ # group_names: ["String"],
1899
+ # filters: [
1900
+ # {
1901
+ # name: "String",
1902
+ # values: ["String"],
1903
+ # },
1904
+ # ],
1905
+ # })
1906
+ # @param [Hash] options ({})
1907
+ # @option options [Boolean] :dry_run
1908
+ # Checks whether you have the required permissions for the action,
1909
+ # without actually making the request, and provides an error response.
1910
+ # If you have the required permissions, the error response is
1911
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1912
+ # @option options [Array<String>] :group_names
1913
+ # One or more placement group names.
1914
+ #
1915
+ # Default: Describes all your placement groups, or only those otherwise
1916
+ # specified.
1917
+ # @option options [Array<Types::Filter>] :filters
1918
+ # One or more filters.
1919
+ #
1920
+ # * `group-name` - The name of the placement group.
1921
+ #
1922
+ # * `state` - The state of the placement group (`pending` \| `available`
1923
+ # \| `deleting` \| `deleted`).
1924
+ #
1925
+ # * `strategy` - The strategy of the placement group (`cluster`).
1926
+ # @return [PlacementGroup::Collection]
1927
+ def placement_groups(options = {})
1928
+ batches = Enumerator.new do |y|
1929
+ batch = []
1930
+ resp = @client.describe_placement_groups(options)
1931
+ resp.data.placement_groups.each do |p|
1932
+ batch << PlacementGroup.new(
1933
+ name: p.group_name,
1934
+ data: p,
1935
+ client: @client
1936
+ )
1937
+ end
1938
+ y.yield(batch)
1939
+ end
1940
+ PlacementGroup::Collection.new(batches)
1941
+ end
1942
+
1943
+ # @param [String] id
1944
+ # @return [RouteTable]
1945
+ def route_table(id)
1946
+ RouteTable.new(
1947
+ id: id,
1948
+ client: @client
1949
+ )
1950
+ end
1951
+
1952
+ # @param [String] id
1953
+ # @return [RouteTableAssociation]
1954
+ def route_table_association(id)
1955
+ RouteTableAssociation.new(
1956
+ id: id,
1957
+ client: @client
1958
+ )
1959
+ end
1960
+
1961
+ # @example Request syntax with placeholder values
1962
+ #
1963
+ # routetables = ec2.route_tables({
1964
+ # dry_run: false,
1965
+ # route_table_ids: ["String"],
1966
+ # filters: [
1967
+ # {
1968
+ # name: "String",
1969
+ # values: ["String"],
1970
+ # },
1971
+ # ],
1972
+ # })
1973
+ # @param [Hash] options ({})
1974
+ # @option options [Boolean] :dry_run
1975
+ # Checks whether you have the required permissions for the action,
1976
+ # without actually making the request, and provides an error response.
1977
+ # If you have the required permissions, the error response is
1978
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
1979
+ # @option options [Array<String>] :route_table_ids
1980
+ # One or more route table IDs.
1981
+ #
1982
+ # Default: Describes all your route tables.
1983
+ # @option options [Array<Types::Filter>] :filters
1984
+ # One or more filters.
1985
+ #
1986
+ # * `association.route-table-association-id` - The ID of an association
1987
+ # ID for the route table.
1988
+ #
1989
+ # * `association.route-table-id` - The ID of the route table involved in
1990
+ # the association.
1991
+ #
1992
+ # * `association.subnet-id` - The ID of the subnet involved in the
1993
+ # association.
1994
+ #
1995
+ # * `association.main` - Indicates whether the route table is the main
1996
+ # route table for the VPC (`true` \| `false`).
1997
+ #
1998
+ # * `route-table-id` - The ID of the route table.
1999
+ #
2000
+ # * `route.destination-cidr-block` - The CIDR range specified in a route
2001
+ # in the table.
2002
+ #
2003
+ # * `route.destination-prefix-list-id` - The ID (prefix) of the AWS
2004
+ # service specified in a route in the table.
2005
+ #
2006
+ # * `route.gateway-id` - The ID of a gateway specified in a route in the
2007
+ # table.
2008
+ #
2009
+ # * `route.instance-id` - The ID of an instance specified in a route in
2010
+ # the table.
2011
+ #
2012
+ # * `route.nat-gateway-id` - The ID of a NAT gateway.
2013
+ #
2014
+ # * `route.origin` - Describes how the route was created.
2015
+ # `CreateRouteTable` indicates that the route was automatically
2016
+ # created when the route table was created; `CreateRoute` indicates
2017
+ # that the route was manually added to the route table;
2018
+ # `EnableVgwRoutePropagation` indicates that the route was propagated
2019
+ # by route propagation.
2020
+ #
2021
+ # * `route.state` - The state of a route in the route table (`active` \|
2022
+ # `blackhole`). The blackhole state indicates that the route's target
2023
+ # isn't available (for example, the specified gateway isn't attached
2024
+ # to the VPC, the specified NAT instance has been terminated, and so
2025
+ # on).
2026
+ #
2027
+ # * `route.vpc-peering-connection-id` - The ID of a VPC peering
2028
+ # connection specified in a route in the table.
2029
+ #
2030
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2031
+ # to the resource.
2032
+ #
2033
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2034
+ # is independent of the `tag-value` filter. For example, if you use
2035
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2036
+ # you get any resources assigned both the tag key Purpose (regardless
2037
+ # of what the tag's value is), and the tag value X (regardless of
2038
+ # what the tag's key is). If you want to list only resources where
2039
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2040
+ #
2041
+ # * `tag-value` - The value of a tag assigned to the resource. This
2042
+ # filter is independent of the `tag-key` filter.
2043
+ #
2044
+ # * `vpc-id` - The ID of the VPC for the route table.
2045
+ # @return [RouteTable::Collection]
2046
+ def route_tables(options = {})
2047
+ batches = Enumerator.new do |y|
2048
+ batch = []
2049
+ resp = @client.describe_route_tables(options)
2050
+ resp.data.route_tables.each do |r|
2051
+ batch << RouteTable.new(
2052
+ id: r.route_table_id,
2053
+ data: r,
2054
+ client: @client
2055
+ )
2056
+ end
2057
+ y.yield(batch)
2058
+ end
2059
+ RouteTable::Collection.new(batches)
2060
+ end
2061
+
2062
+ # @param [String] id
2063
+ # @return [SecurityGroup]
2064
+ def security_group(id)
2065
+ SecurityGroup.new(
2066
+ id: id,
2067
+ client: @client
2068
+ )
2069
+ end
2070
+
2071
+ # @example Request syntax with placeholder values
2072
+ #
2073
+ # securitygroups = ec2.security_groups({
2074
+ # dry_run: false,
2075
+ # group_names: ["String"],
2076
+ # group_ids: ["String"],
2077
+ # filters: [
2078
+ # {
2079
+ # name: "String",
2080
+ # values: ["String"],
2081
+ # },
2082
+ # ],
2083
+ # })
2084
+ # @param [Hash] options ({})
2085
+ # @option options [Boolean] :dry_run
2086
+ # Checks whether you have the required permissions for the action,
2087
+ # without actually making the request, and provides an error response.
2088
+ # If you have the required permissions, the error response is
2089
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2090
+ # @option options [Array<String>] :group_names
2091
+ # \[EC2-Classic and default VPC only\] One or more security group names.
2092
+ # You can specify either the security group name or the security group
2093
+ # ID. For security groups in a nondefault VPC, use the `group-name`
2094
+ # filter to describe security groups by name.
2095
+ #
2096
+ # Default: Describes all your security groups.
2097
+ # @option options [Array<String>] :group_ids
2098
+ # One or more security group IDs. Required for security groups in a
2099
+ # nondefault VPC.
2100
+ #
2101
+ # Default: Describes all your security groups.
2102
+ # @option options [Array<Types::Filter>] :filters
2103
+ # One or more filters. If using multiple filters for rules, the results
2104
+ # include security groups for which any combination of rules - not
2105
+ # necessarily a single rule - match all filters.
2106
+ #
2107
+ # * `description` - The description of the security group.
2108
+ #
2109
+ # * `egress.ip-permission.prefix-list-id` - The ID (prefix) of the AWS
2110
+ # service to which the security group allows access.
2111
+ #
2112
+ # * `group-id` - The ID of the security group.
2113
+ #
2114
+ # * `group-name` - The name of the security group.
2115
+ #
2116
+ # * `ip-permission.cidr` - A CIDR range that has been granted
2117
+ # permission.
2118
+ #
2119
+ # * `ip-permission.from-port` - The start of port range for the TCP and
2120
+ # UDP protocols, or an ICMP type number.
2121
+ #
2122
+ # * `ip-permission.group-id` - The ID of a security group that has been
2123
+ # granted permission.
2124
+ #
2125
+ # * `ip-permission.group-name` - The name of a security group that has
2126
+ # been granted permission.
2127
+ #
2128
+ # * `ip-permission.protocol` - The IP protocol for the permission (`tcp`
2129
+ # \| `udp` \| `icmp` or a protocol number).
2130
+ #
2131
+ # * `ip-permission.to-port` - The end of port range for the TCP and UDP
2132
+ # protocols, or an ICMP code.
2133
+ #
2134
+ # * `ip-permission.user-id` - The ID of an AWS account that has been
2135
+ # granted permission.
2136
+ #
2137
+ # * `owner-id` - The AWS account ID of the owner of the security group.
2138
+ #
2139
+ # * `tag-key` - The key of a tag assigned to the security group.
2140
+ #
2141
+ # * `tag-value` - The value of a tag assigned to the security group.
2142
+ #
2143
+ # * `vpc-id` - The ID of the VPC specified when the security group was
2144
+ # created.
2145
+ # @return [SecurityGroup::Collection]
2146
+ def security_groups(options = {})
2147
+ batches = Enumerator.new do |y|
2148
+ batch = []
2149
+ resp = @client.describe_security_groups(options)
2150
+ resp.data.security_groups.each do |s|
2151
+ batch << SecurityGroup.new(
2152
+ id: s.group_id,
2153
+ data: s,
2154
+ client: @client
2155
+ )
2156
+ end
2157
+ y.yield(batch)
2158
+ end
2159
+ SecurityGroup::Collection.new(batches)
2160
+ end
2161
+
2162
+ # @param [String] id
2163
+ # @return [Snapshot]
2164
+ def snapshot(id)
2165
+ Snapshot.new(
2166
+ id: id,
2167
+ client: @client
2168
+ )
2169
+ end
2170
+
2171
+ # @example Request syntax with placeholder values
2172
+ #
2173
+ # snapshots = ec2.snapshots({
2174
+ # dry_run: false,
2175
+ # snapshot_ids: ["String"],
2176
+ # owner_ids: ["String"],
2177
+ # restorable_by_user_ids: ["String"],
2178
+ # filters: [
2179
+ # {
2180
+ # name: "String",
2181
+ # values: ["String"],
2182
+ # },
2183
+ # ],
2184
+ # })
2185
+ # @param [Hash] options ({})
2186
+ # @option options [Boolean] :dry_run
2187
+ # Checks whether you have the required permissions for the action,
2188
+ # without actually making the request, and provides an error response.
2189
+ # If you have the required permissions, the error response is
2190
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2191
+ # @option options [Array<String>] :snapshot_ids
2192
+ # One or more snapshot IDs.
2193
+ #
2194
+ # Default: Describes snapshots for which you have launch permissions.
2195
+ # @option options [Array<String>] :owner_ids
2196
+ # Returns the snapshots owned by the specified owner. Multiple owners
2197
+ # can be specified.
2198
+ # @option options [Array<String>] :restorable_by_user_ids
2199
+ # One or more AWS accounts IDs that can create volumes from the
2200
+ # snapshot.
2201
+ # @option options [Array<Types::Filter>] :filters
2202
+ # One or more filters.
2203
+ #
2204
+ # * `description` - A description of the snapshot.
2205
+ #
2206
+ # * `owner-alias` - Value from an Amazon-maintained list (`amazon` \|
2207
+ # `aws-marketplace` \| `microsoft`) of snapshot owners. Not to be
2208
+ # confused with the user-configured AWS account alias, which is set
2209
+ # from the IAM consolew.
2210
+ #
2211
+ # * `owner-id` - The ID of the AWS account that owns the snapshot.
2212
+ #
2213
+ # * `progress` - The progress of the snapshot, as a percentage (for
2214
+ # example, 80%).
2215
+ #
2216
+ # * `snapshot-id` - The snapshot ID.
2217
+ #
2218
+ # * `start-time` - The time stamp when the snapshot was initiated.
2219
+ #
2220
+ # * `status` - The status of the snapshot (`pending` \| `completed` \|
2221
+ # `error`).
2222
+ #
2223
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2224
+ # to the resource.
2225
+ #
2226
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2227
+ # is independent of the `tag-value` filter. For example, if you use
2228
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2229
+ # you get any resources assigned both the tag key Purpose (regardless
2230
+ # of what the tag's value is), and the tag value X (regardless of
2231
+ # what the tag's key is). If you want to list only resources where
2232
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2233
+ #
2234
+ # * `tag-value` - The value of a tag assigned to the resource. This
2235
+ # filter is independent of the `tag-key` filter.
2236
+ #
2237
+ # * `volume-id` - The ID of the volume the snapshot is for.
2238
+ #
2239
+ # * `volume-size` - The size of the volume, in GiB.
2240
+ # @return [Snapshot::Collection]
2241
+ def snapshots(options = {})
2242
+ batches = Enumerator.new do |y|
2243
+ resp = @client.describe_snapshots(options)
2244
+ resp.each_page do |page|
2245
+ batch = []
2246
+ page.data.snapshots.each do |s|
2247
+ batch << Snapshot.new(
2248
+ id: s.snapshot_id,
2249
+ data: s,
2250
+ client: @client
2251
+ )
2252
+ end
2253
+ y.yield(batch)
2254
+ end
2255
+ end
2256
+ Snapshot::Collection.new(batches)
2257
+ end
2258
+
2259
+ # @param [String] id
2260
+ # @return [Subnet]
2261
+ def subnet(id)
2262
+ Subnet.new(
2263
+ id: id,
2264
+ client: @client
2265
+ )
2266
+ end
2267
+
2268
+ # @example Request syntax with placeholder values
2269
+ #
2270
+ # subnets = ec2.subnets({
2271
+ # dry_run: false,
2272
+ # subnet_ids: ["String"],
2273
+ # filters: [
2274
+ # {
2275
+ # name: "String",
2276
+ # values: ["String"],
2277
+ # },
2278
+ # ],
2279
+ # })
2280
+ # @param [Hash] options ({})
2281
+ # @option options [Boolean] :dry_run
2282
+ # Checks whether you have the required permissions for the action,
2283
+ # without actually making the request, and provides an error response.
2284
+ # If you have the required permissions, the error response is
2285
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2286
+ # @option options [Array<String>] :subnet_ids
2287
+ # One or more subnet IDs.
2288
+ #
2289
+ # Default: Describes all your subnets.
2290
+ # @option options [Array<Types::Filter>] :filters
2291
+ # One or more filters.
2292
+ #
2293
+ # * `availabilityZone` - The Availability Zone for the subnet. You can
2294
+ # also use `availability-zone` as the filter name.
2295
+ #
2296
+ # * `available-ip-address-count` - The number of IP addresses in the
2297
+ # subnet that are available.
2298
+ #
2299
+ # * `cidrBlock` - The CIDR block of the subnet. The CIDR block you
2300
+ # specify must exactly match the subnet's CIDR block for information
2301
+ # to be returned for the subnet. You can also use `cidr` or
2302
+ # `cidr-block` as the filter names.
2303
+ #
2304
+ # * `defaultForAz` - Indicates whether this is the default subnet for
2305
+ # the Availability Zone. You can also use `default-for-az` as the
2306
+ # filter name.
2307
+ #
2308
+ # * `state` - The state of the subnet (`pending` \| `available`).
2309
+ #
2310
+ # * `subnet-id` - The ID of the subnet.
2311
+ #
2312
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2313
+ # to the resource.
2314
+ #
2315
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2316
+ # is independent of the `tag-value` filter. For example, if you use
2317
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2318
+ # you get any resources assigned both the tag key Purpose (regardless
2319
+ # of what the tag's value is), and the tag value X (regardless of
2320
+ # what the tag's key is). If you want to list only resources where
2321
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2322
+ #
2323
+ # * `tag-value` - The value of a tag assigned to the resource. This
2324
+ # filter is independent of the `tag-key` filter.
2325
+ #
2326
+ # * `vpc-id` - The ID of the VPC for the subnet.
2327
+ # @return [Subnet::Collection]
2328
+ def subnets(options = {})
2329
+ batches = Enumerator.new do |y|
2330
+ batch = []
2331
+ resp = @client.describe_subnets(options)
2332
+ resp.data.subnets.each do |s|
2333
+ batch << Subnet.new(
2334
+ id: s.subnet_id,
2335
+ data: s,
2336
+ client: @client
2337
+ )
2338
+ end
2339
+ y.yield(batch)
2340
+ end
2341
+ Subnet::Collection.new(batches)
2342
+ end
2343
+
2344
+ # @param [String] id
2345
+ # @return [Volume]
2346
+ def volume(id)
2347
+ Volume.new(
2348
+ id: id,
2349
+ client: @client
2350
+ )
2351
+ end
2352
+
2353
+ # @example Request syntax with placeholder values
2354
+ #
2355
+ # volumes = ec2.volumes({
2356
+ # dry_run: false,
2357
+ # volume_ids: ["String"],
2358
+ # filters: [
2359
+ # {
2360
+ # name: "String",
2361
+ # values: ["String"],
2362
+ # },
2363
+ # ],
2364
+ # })
2365
+ # @param [Hash] options ({})
2366
+ # @option options [Boolean] :dry_run
2367
+ # Checks whether you have the required permissions for the action,
2368
+ # without actually making the request, and provides an error response.
2369
+ # If you have the required permissions, the error response is
2370
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2371
+ # @option options [Array<String>] :volume_ids
2372
+ # One or more volume IDs.
2373
+ # @option options [Array<Types::Filter>] :filters
2374
+ # One or more filters.
2375
+ #
2376
+ # * `attachment.attach-time` - The time stamp when the attachment
2377
+ # initiated.
2378
+ #
2379
+ # * `attachment.delete-on-termination` - Whether the volume is deleted
2380
+ # on instance termination.
2381
+ #
2382
+ # * `attachment.device` - The device name that is exposed to the
2383
+ # instance (for example, `/dev/sda1`).
2384
+ #
2385
+ # * `attachment.instance-id` - The ID of the instance the volume is
2386
+ # attached to.
2387
+ #
2388
+ # * `attachment.status` - The attachment state (`attaching` \|
2389
+ # `attached` \| `detaching` \| `detached`).
2390
+ #
2391
+ # * `availability-zone` - The Availability Zone in which the volume was
2392
+ # created.
2393
+ #
2394
+ # * `create-time` - The time stamp when the volume was created.
2395
+ #
2396
+ # * `encrypted` - The encryption status of the volume.
2397
+ #
2398
+ # * `size` - The size of the volume, in GiB.
2399
+ #
2400
+ # * `snapshot-id` - The snapshot from which the volume was created.
2401
+ #
2402
+ # * `status` - The status of the volume (`creating` \| `available` \|
2403
+ # `in-use` \| `deleting` \| `deleted` \| `error`).
2404
+ #
2405
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2406
+ # to the resource.
2407
+ #
2408
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2409
+ # is independent of the `tag-value` filter. For example, if you use
2410
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2411
+ # you get any resources assigned both the tag key Purpose (regardless
2412
+ # of what the tag's value is), and the tag value X (regardless of
2413
+ # what the tag's key is). If you want to list only resources where
2414
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2415
+ #
2416
+ # * `tag-value` - The value of a tag assigned to the resource. This
2417
+ # filter is independent of the `tag-key` filter.
2418
+ #
2419
+ # * `volume-id` - The volume ID.
2420
+ #
2421
+ # * `volume-type` - The Amazon EBS volume type. This can be `gp2` for
2422
+ # General Purpose SSD, `io1` for Provisioned IOPS SSD, `st1` for
2423
+ # Throughput Optimized HDD, `sc1` for Cold HDD, or `standard` for
2424
+ # Magnetic volumes.
2425
+ # @return [Volume::Collection]
2426
+ def volumes(options = {})
2427
+ batches = Enumerator.new do |y|
2428
+ resp = @client.describe_volumes(options)
2429
+ resp.each_page do |page|
2430
+ batch = []
2431
+ page.data.volumes.each do |v|
2432
+ batch << Volume.new(
2433
+ id: v.volume_id,
2434
+ data: v,
2435
+ client: @client
2436
+ )
2437
+ end
2438
+ y.yield(batch)
2439
+ end
2440
+ end
2441
+ Volume::Collection.new(batches)
2442
+ end
2443
+
2444
+ # @param [String] id
2445
+ # @return [Vpc]
2446
+ def vpc(id)
2447
+ Vpc.new(
2448
+ id: id,
2449
+ client: @client
2450
+ )
2451
+ end
2452
+
2453
+ # @example Request syntax with placeholder values
2454
+ #
2455
+ # vpcaddresses = ec2.vpc_addresses({
2456
+ # dry_run: false,
2457
+ # public_ips: ["String"],
2458
+ # filters: [
2459
+ # {
2460
+ # name: "String",
2461
+ # values: ["String"],
2462
+ # },
2463
+ # ],
2464
+ # allocation_ids: ["String"],
2465
+ # })
2466
+ # @param [Hash] options ({})
2467
+ # @option options [Boolean] :dry_run
2468
+ # Checks whether you have the required permissions for the action,
2469
+ # without actually making the request, and provides an error response.
2470
+ # If you have the required permissions, the error response is
2471
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2472
+ # @option options [Array<String>] :public_ips
2473
+ # \[EC2-Classic\] One or more Elastic IP addresses.
2474
+ #
2475
+ # Default: Describes all your Elastic IP addresses.
2476
+ # @option options [Array<Types::Filter>] :filters
2477
+ # One or more filters. Filter names and values are case-sensitive.
2478
+ #
2479
+ # * `allocation-id` - \[EC2-VPC\] The allocation ID for the address.
2480
+ #
2481
+ # * `association-id` - \[EC2-VPC\] The association ID for the address.
2482
+ #
2483
+ # * `domain` - Indicates whether the address is for use in EC2-Classic
2484
+ # (`standard`) or in a VPC (`vpc`).
2485
+ #
2486
+ # * `instance-id` - The ID of the instance the address is associated
2487
+ # with, if any.
2488
+ #
2489
+ # * `network-interface-id` - \[EC2-VPC\] The ID of the network interface
2490
+ # that the address is associated with, if any.
2491
+ #
2492
+ # * `network-interface-owner-id` - The AWS account ID of the owner.
2493
+ #
2494
+ # * `private-ip-address` - \[EC2-VPC\] The private IP address associated
2495
+ # with the Elastic IP address.
2496
+ #
2497
+ # * `public-ip` - The Elastic IP address.
2498
+ # @option options [Array<String>] :allocation_ids
2499
+ # \[EC2-VPC\] One or more allocation IDs.
2500
+ #
2501
+ # Default: Describes all your Elastic IP addresses.
2502
+ # @return [VpcAddress::Collection]
2503
+ def vpc_addresses(options = {})
2504
+ batches = Enumerator.new do |y|
2505
+ batch = []
2506
+ options = Aws::Util.deep_merge(options, filters: [{
2507
+ name: "domain",
2508
+ values: ["vpc"]
2509
+ }])
2510
+ resp = @client.describe_addresses(options)
2511
+ resp.data.addresses.each do |a|
2512
+ batch << VpcAddress.new(
2513
+ allocation_id: a.allocation_id,
2514
+ data: a,
2515
+ client: @client
2516
+ )
2517
+ end
2518
+ y.yield(batch)
2519
+ end
2520
+ VpcAddress::Collection.new(batches)
2521
+ end
2522
+
2523
+ # @param [String] id
2524
+ # @return [VpcPeeringConnection]
2525
+ def vpc_peering_connection(id)
2526
+ VpcPeeringConnection.new(
2527
+ id: id,
2528
+ client: @client
2529
+ )
2530
+ end
2531
+
2532
+ # @example Request syntax with placeholder values
2533
+ #
2534
+ # vpcpeeringconnections = ec2.vpc_peering_connections({
2535
+ # dry_run: false,
2536
+ # vpc_peering_connection_ids: ["String"],
2537
+ # filters: [
2538
+ # {
2539
+ # name: "String",
2540
+ # values: ["String"],
2541
+ # },
2542
+ # ],
2543
+ # })
2544
+ # @param [Hash] options ({})
2545
+ # @option options [Boolean] :dry_run
2546
+ # Checks whether you have the required permissions for the action,
2547
+ # without actually making the request, and provides an error response.
2548
+ # If you have the required permissions, the error response is
2549
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2550
+ # @option options [Array<String>] :vpc_peering_connection_ids
2551
+ # One or more VPC peering connection IDs.
2552
+ #
2553
+ # Default: Describes all your VPC peering connections.
2554
+ # @option options [Array<Types::Filter>] :filters
2555
+ # One or more filters.
2556
+ #
2557
+ # * `accepter-vpc-info.cidr-block` - The CIDR block of the peer VPC.
2558
+ #
2559
+ # * `accepter-vpc-info.owner-id` - The AWS account ID of the owner of
2560
+ # the peer VPC.
2561
+ #
2562
+ # * `accepter-vpc-info.vpc-id` - The ID of the peer VPC.
2563
+ #
2564
+ # * `expiration-time` - The expiration date and time for the VPC peering
2565
+ # connection.
2566
+ #
2567
+ # * `requester-vpc-info.cidr-block` - The CIDR block of the requester's
2568
+ # VPC.
2569
+ #
2570
+ # * `requester-vpc-info.owner-id` - The AWS account ID of the owner of
2571
+ # the requester VPC.
2572
+ #
2573
+ # * `requester-vpc-info.vpc-id` - The ID of the requester VPC.
2574
+ #
2575
+ # * `status-code` - The status of the VPC peering connection
2576
+ # (`pending-acceptance` \| `failed` \| `expired` \| `provisioning` \|
2577
+ # `active` \| `deleted` \| `rejected`).
2578
+ #
2579
+ # * `status-message` - A message that provides more information about
2580
+ # the status of the VPC peering connection, if applicable.
2581
+ #
2582
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2583
+ # to the resource.
2584
+ #
2585
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2586
+ # is independent of the `tag-value` filter. For example, if you use
2587
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2588
+ # you get any resources assigned both the tag key Purpose (regardless
2589
+ # of what the tag's value is), and the tag value X (regardless of
2590
+ # what the tag's key is). If you want to list only resources where
2591
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2592
+ #
2593
+ # * `tag-value` - The value of a tag assigned to the resource. This
2594
+ # filter is independent of the `tag-key` filter.
2595
+ #
2596
+ # * `vpc-peering-connection-id` - The ID of the VPC peering connection.
2597
+ # @return [VpcPeeringConnection::Collection]
2598
+ def vpc_peering_connections(options = {})
2599
+ batches = Enumerator.new do |y|
2600
+ batch = []
2601
+ resp = @client.describe_vpc_peering_connections(options)
2602
+ resp.data.vpc_peering_connections.each do |v|
2603
+ batch << VpcPeeringConnection.new(
2604
+ id: v.vpc_peering_connection_id,
2605
+ data: v,
2606
+ client: @client
2607
+ )
2608
+ end
2609
+ y.yield(batch)
2610
+ end
2611
+ VpcPeeringConnection::Collection.new(batches)
2612
+ end
2613
+
2614
+ # @example Request syntax with placeholder values
2615
+ #
2616
+ # vpcs = ec2.vpcs({
2617
+ # dry_run: false,
2618
+ # vpc_ids: ["String"],
2619
+ # filters: [
2620
+ # {
2621
+ # name: "String",
2622
+ # values: ["String"],
2623
+ # },
2624
+ # ],
2625
+ # })
2626
+ # @param [Hash] options ({})
2627
+ # @option options [Boolean] :dry_run
2628
+ # Checks whether you have the required permissions for the action,
2629
+ # without actually making the request, and provides an error response.
2630
+ # If you have the required permissions, the error response is
2631
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
2632
+ # @option options [Array<String>] :vpc_ids
2633
+ # One or more VPC IDs.
2634
+ #
2635
+ # Default: Describes all your VPCs.
2636
+ # @option options [Array<Types::Filter>] :filters
2637
+ # One or more filters.
2638
+ #
2639
+ # * `cidr` - The CIDR block of the VPC. The CIDR block you specify must
2640
+ # exactly match the VPC's CIDR block for information to be returned
2641
+ # for the VPC. Must contain the slash followed by one or two digits
2642
+ # (for example, `/28`).
2643
+ #
2644
+ # * `dhcp-options-id` - The ID of a set of DHCP options.
2645
+ #
2646
+ # * `isDefault` - Indicates whether the VPC is the default VPC.
2647
+ #
2648
+ # * `state` - The state of the VPC (`pending` \| `available`).
2649
+ #
2650
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
2651
+ # to the resource.
2652
+ #
2653
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
2654
+ # is independent of the `tag-value` filter. For example, if you use
2655
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
2656
+ # you get any resources assigned both the tag key Purpose (regardless
2657
+ # of what the tag's value is), and the tag value X (regardless of
2658
+ # what the tag's key is). If you want to list only resources where
2659
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
2660
+ #
2661
+ # * `tag-value` - The value of a tag assigned to the resource. This
2662
+ # filter is independent of the `tag-key` filter.
2663
+ #
2664
+ # * `vpc-id` - The ID of the VPC.
2665
+ # @return [Vpc::Collection]
2666
+ def vpcs(options = {})
2667
+ batches = Enumerator.new do |y|
2668
+ batch = []
2669
+ resp = @client.describe_vpcs(options)
2670
+ resp.data.vpcs.each do |v|
2671
+ batch << Vpc.new(
2672
+ id: v.vpc_id,
2673
+ data: v,
2674
+ client: @client
2675
+ )
2676
+ end
2677
+ y.yield(batch)
2678
+ end
2679
+ Vpc::Collection.new(batches)
2680
+ end
2681
+
2682
+ end
2683
+ end
2684
+ end