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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,1031 +1,1035 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module EC2
10
- class Subnet
8
+ module Aws::EC2
9
+ class Subnet
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(id, options = {})
15
- # @param [String] id
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :id
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @id = extract_id(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
13
+ # @overload def initialize(id, options = {})
14
+ # @param [String] id
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :id
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @id = extract_id(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def id
31
- @id
32
- end
33
- alias :subnet_id :id
28
+ # @return [String]
29
+ def id
30
+ @id
31
+ end
32
+ alias :subnet_id :id
34
33
 
35
- # The current state of the subnet.
36
- # @return [String]
37
- def state
38
- data.state
39
- end
34
+ # The current state of the subnet.
35
+ # @return [String]
36
+ def state
37
+ data.state
38
+ end
40
39
 
41
- # The ID of the VPC the subnet is in.
42
- # @return [String]
43
- def vpc_id
44
- data.vpc_id
45
- end
40
+ # The ID of the VPC the subnet is in.
41
+ # @return [String]
42
+ def vpc_id
43
+ data.vpc_id
44
+ end
46
45
 
47
- # The IPv4 CIDR block assigned to the subnet.
48
- # @return [String]
49
- def cidr_block
50
- data.cidr_block
51
- end
46
+ # The IPv4 CIDR block assigned to the subnet.
47
+ # @return [String]
48
+ def cidr_block
49
+ data.cidr_block
50
+ end
52
51
 
53
- # Information about the IPv6 CIDR blocks associated with the subnet.
54
- # @return [Array<Types::SubnetIpv6CidrBlockAssociation>]
55
- def ipv_6_cidr_block_association_set
56
- data.ipv_6_cidr_block_association_set
57
- end
52
+ # Information about the IPv6 CIDR blocks associated with the subnet.
53
+ # @return [Array<Types::SubnetIpv6CidrBlockAssociation>]
54
+ def ipv_6_cidr_block_association_set
55
+ data.ipv_6_cidr_block_association_set
56
+ end
58
57
 
59
- # Indicates whether a network interface created in this subnet
60
- # (including a network interface created by RunInstances) receives an
61
- # IPv6 address.
62
- # @return [Boolean]
63
- def assign_ipv_6_address_on_creation
64
- data.assign_ipv_6_address_on_creation
65
- end
58
+ # Indicates whether a network interface created in this subnet
59
+ # (including a network interface created by RunInstances) receives an
60
+ # IPv6 address.
61
+ # @return [Boolean]
62
+ def assign_ipv_6_address_on_creation
63
+ data.assign_ipv_6_address_on_creation
64
+ end
66
65
 
67
- # The number of unused private IPv4 addresses in the subnet. Note that
68
- # the IPv4 addresses for any stopped instances are considered
69
- # unavailable.
70
- # @return [Integer]
71
- def available_ip_address_count
72
- data.available_ip_address_count
73
- end
66
+ # The number of unused private IPv4 addresses in the subnet. Note that
67
+ # the IPv4 addresses for any stopped instances are considered
68
+ # unavailable.
69
+ # @return [Integer]
70
+ def available_ip_address_count
71
+ data.available_ip_address_count
72
+ end
74
73
 
75
- # The Availability Zone of the subnet.
76
- # @return [String]
77
- def availability_zone
78
- data.availability_zone
79
- end
74
+ # The Availability Zone of the subnet.
75
+ # @return [String]
76
+ def availability_zone
77
+ data.availability_zone
78
+ end
80
79
 
81
- # Indicates whether this is the default subnet for the Availability
82
- # Zone.
83
- # @return [Boolean]
84
- def default_for_az
85
- data.default_for_az
86
- end
80
+ # Indicates whether this is the default subnet for the Availability
81
+ # Zone.
82
+ # @return [Boolean]
83
+ def default_for_az
84
+ data.default_for_az
85
+ end
87
86
 
88
- # Indicates whether instances launched in this subnet receive a public
89
- # IPv4 address.
90
- # @return [Boolean]
91
- def map_public_ip_on_launch
92
- data.map_public_ip_on_launch
93
- end
87
+ # Indicates whether instances launched in this subnet receive a public
88
+ # IPv4 address.
89
+ # @return [Boolean]
90
+ def map_public_ip_on_launch
91
+ data.map_public_ip_on_launch
92
+ end
94
93
 
95
- # Any tags assigned to the subnet.
96
- # @return [Array<Types::Tag>]
97
- def tags
98
- data.tags
99
- end
94
+ # Any tags assigned to the subnet.
95
+ # @return [Array<Types::Tag>]
96
+ def tags
97
+ data.tags
98
+ end
100
99
 
101
- # @!endgroup
100
+ # @!endgroup
102
101
 
103
- # @return [Client]
104
- def client
105
- @client
106
- end
102
+ # @return [Client]
103
+ def client
104
+ @client
105
+ end
107
106
 
108
- # Loads, or reloads {#data} for the current {Subnet}.
109
- # Returns `self` making it possible to chain methods.
110
- #
111
- # subnet.reload.data
112
- #
113
- # @return [self]
114
- def load
115
- resp = @client.describe_subnets(subnet_ids: [@id])
116
- @data = resp.subnets[0]
117
- self
118
- end
119
- alias :reload :load
107
+ # Loads, or reloads {#data} for the current {Subnet}.
108
+ # Returns `self` making it possible to chain methods.
109
+ #
110
+ # subnet.reload.data
111
+ #
112
+ # @return [self]
113
+ def load
114
+ resp = @client.describe_subnets(subnet_ids: [@id])
115
+ @data = resp.subnets[0]
116
+ self
117
+ end
118
+ alias :reload :load
120
119
 
121
- # @return [Types::Subnet]
122
- # Returns the data for this {Subnet}. Calls
123
- # {Client#describe_subnets} if {#data_loaded?} is `false`.
124
- def data
125
- load unless @data
126
- @data
127
- end
120
+ # @return [Types::Subnet]
121
+ # Returns the data for this {Subnet}. Calls
122
+ # {Client#describe_subnets} if {#data_loaded?} is `false`.
123
+ def data
124
+ load unless @data
125
+ @data
126
+ end
128
127
 
129
- # @return [Boolean]
130
- # Returns `true` if this resource is loaded. Accessing attributes or
131
- # {#data} on an unloaded resource will trigger a call to {#load}.
132
- def data_loaded?
133
- !!@data
134
- end
128
+ # @return [Boolean]
129
+ # Returns `true` if this resource is loaded. Accessing attributes or
130
+ # {#data} on an unloaded resource will trigger a call to {#load}.
131
+ def data_loaded?
132
+ !!@data
133
+ end
135
134
 
136
- # @!group Actions
135
+ # @!group Actions
137
136
 
138
- # @example Request syntax with placeholder values
139
- #
140
- # instance = subnet.create_instances({
141
- # dry_run: false,
142
- # image_id: "String", # required
143
- # min_count: 1, # required
144
- # max_count: 1, # required
145
- # key_name: "String",
146
- # security_groups: ["String"],
147
- # security_group_ids: ["String"],
148
- # user_data: "String",
149
- # instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, 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, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, 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, f1.2xlarge, f1.16xlarge
150
- # placement: {
151
- # availability_zone: "String",
152
- # group_name: "String",
153
- # tenancy: "default", # accepts default, dedicated, host
154
- # host_id: "String",
155
- # affinity: "String",
156
- # },
157
- # kernel_id: "String",
158
- # ramdisk_id: "String",
159
- # block_device_mappings: [
160
- # {
161
- # virtual_name: "String",
162
- # device_name: "String",
163
- # ebs: {
164
- # snapshot_id: "String",
165
- # volume_size: 1,
166
- # delete_on_termination: false,
167
- # volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
168
- # iops: 1,
169
- # encrypted: false,
170
- # },
171
- # no_device: "String",
172
- # },
173
- # ],
174
- # monitoring: {
175
- # enabled: false, # required
176
- # },
177
- # disable_api_termination: false,
178
- # instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
179
- # private_ip_address: "String",
180
- # ipv_6_addresses: [
181
- # {
182
- # ipv_6_address: "String",
183
- # },
184
- # ],
185
- # ipv_6_address_count: 1,
186
- # client_token: "String",
187
- # additional_info: "String",
188
- # network_interfaces: [
189
- # {
190
- # network_interface_id: "String",
191
- # device_index: 1,
192
- # subnet_id: "String",
193
- # description: "String",
194
- # private_ip_address: "String",
195
- # groups: ["String"],
196
- # delete_on_termination: false,
197
- # private_ip_addresses: [
198
- # {
199
- # private_ip_address: "String", # required
200
- # primary: false,
201
- # },
202
- # ],
203
- # secondary_private_ip_address_count: 1,
204
- # associate_public_ip_address: false,
205
- # ipv_6_addresses: [
206
- # {
207
- # ipv_6_address: "String",
208
- # },
209
- # ],
210
- # ipv_6_address_count: 1,
211
- # },
212
- # ],
213
- # iam_instance_profile: {
214
- # arn: "String",
215
- # name: "String",
216
- # },
217
- # ebs_optimized: false,
218
- # })
219
- # @param [Hash] options ({})
220
- # @option options [Boolean] :dry_run
221
- # Checks whether you have the required permissions for the action,
222
- # without actually making the request, and provides an error response.
223
- # If you have the required permissions, the error response is
224
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
225
- # @option options [required, String] :image_id
226
- # The ID of the AMI, which you can get by calling DescribeImages.
227
- # @option options [required, Integer] :min_count
228
- # The minimum number of instances to launch. If you specify a minimum
229
- # that is more instances than Amazon EC2 can launch in the target
230
- # Availability Zone, Amazon EC2 launches no instances.
231
- #
232
- # Constraints: Between 1 and the maximum number you're allowed for the
233
- # specified instance type. For more information about the default
234
- # limits, and how to request an increase, see [How many instances can I
235
- # run in Amazon EC2][1] in the Amazon EC2 General FAQ.
236
- #
237
- #
238
- #
239
- # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
240
- # @option options [required, Integer] :max_count
241
- # The maximum number of instances to launch. If you specify more
242
- # instances than Amazon EC2 can launch in the target Availability Zone,
243
- # Amazon EC2 launches the largest possible number of instances above
244
- # `MinCount`.
245
- #
246
- # Constraints: Between 1 and the maximum number you're allowed for the
247
- # specified instance type. For more information about the default
248
- # limits, and how to request an increase, see [How many instances can I
249
- # run in Amazon EC2][1] in the Amazon EC2 FAQ.
250
- #
251
- #
252
- #
253
- # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
254
- # @option options [String] :key_name
255
- # The name of the key pair. You can create a key pair using
256
- # CreateKeyPair or ImportKeyPair.
257
- #
258
- # If you do not specify a key pair, you can't connect to the instance
259
- # unless you choose an AMI that is configured to allow users another way
260
- # to log in.
261
- # @option options [Array<String>] :security_groups
262
- # \[EC2-Classic, default VPC\] One or more security group names. For a
263
- # nondefault VPC, you must use security group IDs instead.
264
- #
265
- # Default: Amazon EC2 uses the default security group.
266
- # @option options [Array<String>] :security_group_ids
267
- # One or more security group IDs. You can create a security group using
268
- # CreateSecurityGroup.
269
- #
270
- # Default: Amazon EC2 uses the default security group.
271
- # @option options [String] :user_data
272
- # The user data to make available to the instance. For more information,
273
- # see [Running Commands on Your Linux Instance at Launch][1] (Linux) and
274
- # [Adding User Data][2] (Windows). If you are using an AWS SDK or
275
- # command line tool, Base64-encoding is performed for you, and you can
276
- # load the text from a file. Otherwise, you must provide Base64-encoded
277
- # text.
278
- #
279
- #
280
- #
281
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
282
- # [2]: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data
283
- # @option options [String] :instance_type
284
- # The instance type. For more information, see [Instance Types][1] in
285
- # the *Amazon Elastic Compute Cloud User Guide*.
286
- #
287
- # Default: `m1.small`
288
- #
289
- #
290
- #
291
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
292
- # @option options [Types::Placement] :placement
293
- # The placement for the instance.
294
- # @option options [String] :kernel_id
295
- # The ID of the kernel.
296
- #
297
- # We recommend that you use PV-GRUB instead of kernels and RAM disks.
298
- # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
299
- # Cloud User Guide*.
300
- #
301
- #
302
- #
303
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
304
- # @option options [String] :ramdisk_id
305
- # The ID of the RAM disk.
306
- #
307
- # We recommend that you use PV-GRUB instead of kernels and RAM disks.
308
- # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
309
- # Cloud User Guide*.
310
- #
311
- #
312
- #
313
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
314
- # @option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
315
- # The block device mapping.
316
- #
317
- # Supplying both a snapshot ID and an encryption value as arguments for
318
- # block-device mapping results in an error. This is because only blank
319
- # volumes can be encrypted on start, and these are not created from a
320
- # snapshot. If a snapshot is the basis for the volume, it contains data
321
- # by definition and its encryption status cannot be changed using this
322
- # action.
323
- # @option options [Types::RunInstancesMonitoringEnabled] :monitoring
324
- # The monitoring for the instance.
325
- # @option options [Boolean] :disable_api_termination
326
- # If you set this parameter to `true`, you can't terminate the instance
327
- # using the Amazon EC2 console, CLI, or API; otherwise, you can. To
328
- # change this attribute to `false` after launch, use
329
- # ModifyInstanceAttribute. Alternatively, if you set
330
- # `InstanceInitiatedShutdownBehavior` to `terminate`, you can terminate
331
- # the instance by running the shutdown command from the instance.
332
- #
333
- # Default: `false`
334
- # @option options [String] :instance_initiated_shutdown_behavior
335
- # Indicates whether an instance stops or terminates when you initiate
336
- # shutdown from the instance (using the operating system command for
337
- # system shutdown).
338
- #
339
- # Default: `stop`
340
- # @option options [String] :private_ip_address
341
- # \[EC2-VPC\] The primary IPv4 address. You must specify a value from
342
- # the IPv4 address range of the subnet.
343
- #
344
- # Only one private IP address can be designated as primary. You can't
345
- # specify this option if you've specified the option to designate a
346
- # private IP address as the primary IP address in a network interface
347
- # specification. You cannot specify this option if you're launching
348
- # more than one instance in the request.
349
- # @option options [Array<Types::InstanceIpv6Address>] :ipv_6_addresses
350
- # \[EC2-VPC\] Specify one or more IPv6 addresses from the range of the
351
- # subnet to associate with the primary network interface. You cannot
352
- # specify this option and the option to assign a number of IPv6
353
- # addresses in the same request. You cannot specify this option if
354
- # you've specified a minimum number of instances to launch.
355
- # @option options [Integer] :ipv_6_address_count
356
- # \[EC2-VPC\] A number of IPv6 addresses to associate with the primary
357
- # network interface. Amazon EC2 chooses the IPv6 addresses from the
358
- # range of your subnet. You cannot specify this option and the option to
359
- # assign specific IPv6 addresses in the same request. You can specify
360
- # this option if you've specified a minimum number of instances to
361
- # launch.
362
- # @option options [String] :client_token
363
- # Unique, case-sensitive identifier you provide to ensure the
364
- # idempotency of the request. For more information, see [Ensuring
365
- # Idempotency][1].
366
- #
367
- # Constraints: Maximum 64 ASCII characters
368
- #
369
- #
370
- #
371
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html
372
- # @option options [String] :additional_info
373
- # Reserved.
374
- # @option options [Array<Types::InstanceNetworkInterfaceSpecification>] :network_interfaces
375
- # One or more network interfaces.
376
- # @option options [Types::IamInstanceProfileSpecification] :iam_instance_profile
377
- # The IAM instance profile.
378
- # @option options [Boolean] :ebs_optimized
379
- # Indicates whether the instance is optimized for EBS I/O. This
380
- # optimization provides dedicated throughput to Amazon EBS and an
381
- # optimized configuration stack to provide optimal EBS I/O performance.
382
- # This optimization isn't available with all instance types. Additional
383
- # usage charges apply when using an EBS-optimized instance.
384
- #
385
- # Default: `false`
386
- # @return [Instance::Collection]
387
- def create_instances(options = {})
388
- batch = []
389
- options = options.merge(subnet_id: @id)
390
- resp = @client.run_instances(options)
391
- resp.data.instances.each do |i|
392
- batch << Instance.new(
393
- id: i.instance_id,
394
- data: i,
395
- client: @client
396
- )
397
- end
398
- Instance::Collection.new([batch], size: batch.size)
399
- end
400
-
401
- # @example Request syntax with placeholder values
402
- #
403
- # networkinterface = subnet.create_network_interface({
404
- # description: "String",
405
- # private_ip_address: "String",
406
- # groups: ["String"],
407
- # private_ip_addresses: [
408
- # {
409
- # private_ip_address: "String", # required
410
- # primary: false,
411
- # },
412
- # ],
413
- # secondary_private_ip_address_count: 1,
414
- # ipv_6_addresses: [
415
- # {
416
- # ipv_6_address: "String",
417
- # },
418
- # ],
419
- # ipv_6_address_count: 1,
420
- # dry_run: false,
421
- # })
422
- # @param [Hash] options ({})
423
- # @option options [String] :description
424
- # A description for the network interface.
425
- # @option options [String] :private_ip_address
426
- # The primary private IPv4 address of the network interface. If you
427
- # don't specify an IPv4 address, Amazon EC2 selects one for you from
428
- # the subnet's IPv4 CIDR range. If you specify an IP address, you
429
- # cannot indicate any IP addresses specified in `privateIpAddresses` as
430
- # primary (only one IP address can be designated as primary).
431
- # @option options [Array<String>] :groups
432
- # The IDs of one or more security groups.
433
- # @option options [Array<Types::PrivateIpAddressSpecification>] :private_ip_addresses
434
- # One or more private IPv4 addresses.
435
- # @option options [Integer] :secondary_private_ip_address_count
436
- # The number of secondary private IPv4 addresses to assign to a network
437
- # interface. When you specify a number of secondary IPv4 addresses,
438
- # Amazon EC2 selects these IP addresses within the subnet's IPv4 CIDR
439
- # range. You can't specify this option and specify more than one
440
- # private IP address using `privateIpAddresses`.
441
- #
442
- # The number of IP addresses you can assign to a network interface
443
- # varies by instance type. For more information, see [IP Addresses Per
444
- # ENI Per Instance Type][1] in the *Amazon Virtual Private Cloud User
445
- # Guide*.
446
- #
447
- #
448
- #
449
- # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI
450
- # @option options [Array<Types::InstanceIpv6Address>] :ipv_6_addresses
451
- # One or more specific IPv6 addresses from the IPv6 CIDR block range of
452
- # your subnet. You can't use this option if you're specifying a number
453
- # of IPv6 addresses.
454
- # @option options [Integer] :ipv_6_address_count
455
- # The number of IPv6 addresses to assign to a network interface. Amazon
456
- # EC2 automatically selects the IPv6 addresses from the subnet range.
457
- # You can't use this option if specifying specific IPv6 addresses. If
458
- # your subnet has the `AssignIpv6AddressOnCreation` attribute set to
459
- # `true`, you can specify `0` to override this setting.
460
- # @option options [Boolean] :dry_run
461
- # Checks whether you have the required permissions for the action,
462
- # without actually making the request, and provides an error response.
463
- # If you have the required permissions, the error response is
464
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
465
- # @return [NetworkInterface]
466
- def create_network_interface(options = {})
467
- options = options.merge(subnet_id: @id)
468
- resp = @client.create_network_interface(options)
469
- NetworkInterface.new(
470
- id: resp.data.network_interface.network_interface_id,
471
- data: resp.data.network_interface,
137
+ # @example Request syntax with placeholder values
138
+ #
139
+ # instance = subnet.create_instances({
140
+ # dry_run: false,
141
+ # image_id: "String", # required
142
+ # min_count: 1, # required
143
+ # max_count: 1, # required
144
+ # key_name: "String",
145
+ # security_groups: ["String"],
146
+ # security_group_ids: ["String"],
147
+ # user_data: "String",
148
+ # instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, 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, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, 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, f1.2xlarge, f1.16xlarge
149
+ # placement: {
150
+ # availability_zone: "String",
151
+ # group_name: "String",
152
+ # tenancy: "default", # accepts default, dedicated, host
153
+ # host_id: "String",
154
+ # affinity: "String",
155
+ # },
156
+ # kernel_id: "String",
157
+ # ramdisk_id: "String",
158
+ # block_device_mappings: [
159
+ # {
160
+ # virtual_name: "String",
161
+ # device_name: "String",
162
+ # ebs: {
163
+ # snapshot_id: "String",
164
+ # volume_size: 1,
165
+ # delete_on_termination: false,
166
+ # volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
167
+ # iops: 1,
168
+ # encrypted: false,
169
+ # },
170
+ # no_device: "String",
171
+ # },
172
+ # ],
173
+ # monitoring: {
174
+ # enabled: false, # required
175
+ # },
176
+ # disable_api_termination: false,
177
+ # instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
178
+ # private_ip_address: "String",
179
+ # ipv_6_addresses: [
180
+ # {
181
+ # ipv_6_address: "String",
182
+ # },
183
+ # ],
184
+ # ipv_6_address_count: 1,
185
+ # client_token: "String",
186
+ # additional_info: "String",
187
+ # network_interfaces: [
188
+ # {
189
+ # network_interface_id: "String",
190
+ # device_index: 1,
191
+ # subnet_id: "String",
192
+ # description: "String",
193
+ # private_ip_address: "String",
194
+ # groups: ["String"],
195
+ # delete_on_termination: false,
196
+ # private_ip_addresses: [
197
+ # {
198
+ # private_ip_address: "String", # required
199
+ # primary: false,
200
+ # },
201
+ # ],
202
+ # secondary_private_ip_address_count: 1,
203
+ # associate_public_ip_address: false,
204
+ # ipv_6_addresses: [
205
+ # {
206
+ # ipv_6_address: "String",
207
+ # },
208
+ # ],
209
+ # ipv_6_address_count: 1,
210
+ # },
211
+ # ],
212
+ # iam_instance_profile: {
213
+ # arn: "String",
214
+ # name: "String",
215
+ # },
216
+ # ebs_optimized: false,
217
+ # })
218
+ # @param [Hash] options ({})
219
+ # @option options [Boolean] :dry_run
220
+ # Checks whether you have the required permissions for the action,
221
+ # without actually making the request, and provides an error response.
222
+ # If you have the required permissions, the error response is
223
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
224
+ # @option options [required, String] :image_id
225
+ # The ID of the AMI, which you can get by calling DescribeImages.
226
+ # @option options [required, Integer] :min_count
227
+ # The minimum number of instances to launch. If you specify a minimum
228
+ # that is more instances than Amazon EC2 can launch in the target
229
+ # Availability Zone, Amazon EC2 launches no instances.
230
+ #
231
+ # Constraints: Between 1 and the maximum number you're allowed for the
232
+ # specified instance type. For more information about the default
233
+ # limits, and how to request an increase, see [How many instances can I
234
+ # run in Amazon EC2][1] in the Amazon EC2 General FAQ.
235
+ #
236
+ #
237
+ #
238
+ # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
239
+ # @option options [required, Integer] :max_count
240
+ # The maximum number of instances to launch. If you specify more
241
+ # instances than Amazon EC2 can launch in the target Availability Zone,
242
+ # Amazon EC2 launches the largest possible number of instances above
243
+ # `MinCount`.
244
+ #
245
+ # Constraints: Between 1 and the maximum number you're allowed for the
246
+ # specified instance type. For more information about the default
247
+ # limits, and how to request an increase, see [How many instances can I
248
+ # run in Amazon EC2][1] in the Amazon EC2 FAQ.
249
+ #
250
+ #
251
+ #
252
+ # [1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
253
+ # @option options [String] :key_name
254
+ # The name of the key pair. You can create a key pair using
255
+ # CreateKeyPair or ImportKeyPair.
256
+ #
257
+ # If you do not specify a key pair, you can't connect to the instance
258
+ # unless you choose an AMI that is configured to allow users another way
259
+ # to log in.
260
+ # @option options [Array<String>] :security_groups
261
+ # \[EC2-Classic, default VPC\] One or more security group names. For a
262
+ # nondefault VPC, you must use security group IDs instead.
263
+ #
264
+ # Default: Amazon EC2 uses the default security group.
265
+ # @option options [Array<String>] :security_group_ids
266
+ # One or more security group IDs. You can create a security group using
267
+ # CreateSecurityGroup.
268
+ #
269
+ # Default: Amazon EC2 uses the default security group.
270
+ # @option options [String] :user_data
271
+ # The user data to make available to the instance. For more information,
272
+ # see [Running Commands on Your Linux Instance at Launch][1] (Linux) and
273
+ # [Adding User Data][2] (Windows). If you are using an AWS SDK or
274
+ # command line tool, Base64-encoding is performed for you, and you can
275
+ # load the text from a file. Otherwise, you must provide Base64-encoded
276
+ # text.
277
+ #
278
+ #
279
+ #
280
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
281
+ # [2]: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data
282
+ # @option options [String] :instance_type
283
+ # The instance type. For more information, see [Instance Types][1] in
284
+ # the *Amazon Elastic Compute Cloud User Guide*.
285
+ #
286
+ # Default: `m1.small`
287
+ #
288
+ #
289
+ #
290
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
291
+ # @option options [Types::Placement] :placement
292
+ # The placement for the instance.
293
+ # @option options [String] :kernel_id
294
+ # The ID of the kernel.
295
+ #
296
+ # We recommend that you use PV-GRUB instead of kernels and RAM disks.
297
+ # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
298
+ # Cloud User Guide*.
299
+ #
300
+ #
301
+ #
302
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
303
+ # @option options [String] :ramdisk_id
304
+ # The ID of the RAM disk.
305
+ #
306
+ # We recommend that you use PV-GRUB instead of kernels and RAM disks.
307
+ # For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
308
+ # Cloud User Guide*.
309
+ #
310
+ #
311
+ #
312
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
313
+ # @option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
314
+ # The block device mapping.
315
+ #
316
+ # Supplying both a snapshot ID and an encryption value as arguments for
317
+ # block-device mapping results in an error. This is because only blank
318
+ # volumes can be encrypted on start, and these are not created from a
319
+ # snapshot. If a snapshot is the basis for the volume, it contains data
320
+ # by definition and its encryption status cannot be changed using this
321
+ # action.
322
+ # @option options [Types::RunInstancesMonitoringEnabled] :monitoring
323
+ # The monitoring for the instance.
324
+ # @option options [Boolean] :disable_api_termination
325
+ # If you set this parameter to `true`, you can't terminate the instance
326
+ # using the Amazon EC2 console, CLI, or API; otherwise, you can. To
327
+ # change this attribute to `false` after launch, use
328
+ # ModifyInstanceAttribute. Alternatively, if you set
329
+ # `InstanceInitiatedShutdownBehavior` to `terminate`, you can terminate
330
+ # the instance by running the shutdown command from the instance.
331
+ #
332
+ # Default: `false`
333
+ # @option options [String] :instance_initiated_shutdown_behavior
334
+ # Indicates whether an instance stops or terminates when you initiate
335
+ # shutdown from the instance (using the operating system command for
336
+ # system shutdown).
337
+ #
338
+ # Default: `stop`
339
+ # @option options [String] :private_ip_address
340
+ # \[EC2-VPC\] The primary IPv4 address. You must specify a value from
341
+ # the IPv4 address range of the subnet.
342
+ #
343
+ # Only one private IP address can be designated as primary. You can't
344
+ # specify this option if you've specified the option to designate a
345
+ # private IP address as the primary IP address in a network interface
346
+ # specification. You cannot specify this option if you're launching
347
+ # more than one instance in the request.
348
+ # @option options [Array<Types::InstanceIpv6Address>] :ipv_6_addresses
349
+ # \[EC2-VPC\] Specify one or more IPv6 addresses from the range of the
350
+ # subnet to associate with the primary network interface. You cannot
351
+ # specify this option and the option to assign a number of IPv6
352
+ # addresses in the same request. You cannot specify this option if
353
+ # you've specified a minimum number of instances to launch.
354
+ # @option options [Integer] :ipv_6_address_count
355
+ # \[EC2-VPC\] A number of IPv6 addresses to associate with the primary
356
+ # network interface. Amazon EC2 chooses the IPv6 addresses from the
357
+ # range of your subnet. You cannot specify this option and the option to
358
+ # assign specific IPv6 addresses in the same request. You can specify
359
+ # this option if you've specified a minimum number of instances to
360
+ # launch.
361
+ # @option options [String] :client_token
362
+ # Unique, case-sensitive identifier you provide to ensure the
363
+ # idempotency of the request. For more information, see [Ensuring
364
+ # Idempotency][1].
365
+ #
366
+ # Constraints: Maximum 64 ASCII characters
367
+ #
368
+ #
369
+ #
370
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html
371
+ # @option options [String] :additional_info
372
+ # Reserved.
373
+ # @option options [Array<Types::InstanceNetworkInterfaceSpecification>] :network_interfaces
374
+ # One or more network interfaces.
375
+ # @option options [Types::IamInstanceProfileSpecification] :iam_instance_profile
376
+ # The IAM instance profile.
377
+ # @option options [Boolean] :ebs_optimized
378
+ # Indicates whether the instance is optimized for EBS I/O. This
379
+ # optimization provides dedicated throughput to Amazon EBS and an
380
+ # optimized configuration stack to provide optimal EBS I/O performance.
381
+ # This optimization isn't available with all instance types. Additional
382
+ # usage charges apply when using an EBS-optimized instance.
383
+ #
384
+ # Default: `false`
385
+ # @return [Instance::Collection]
386
+ def create_instances(options = {})
387
+ batch = []
388
+ options = options.merge(subnet_id: @id)
389
+ resp = @client.run_instances(options)
390
+ resp.data.instances.each do |i|
391
+ batch << Instance.new(
392
+ id: i.instance_id,
393
+ data: i,
472
394
  client: @client
473
395
  )
474
396
  end
397
+ Instance::Collection.new([batch], size: batch.size)
398
+ end
475
399
 
476
- # @example Request syntax with placeholder values
477
- #
478
- # tag = subnet.create_tags({
479
- # dry_run: false,
480
- # tags: [ # required
481
- # {
482
- # key: "String",
483
- # value: "String",
484
- # },
485
- # ],
486
- # })
487
- # @param [Hash] options ({})
488
- # @option options [Boolean] :dry_run
489
- # Checks whether you have the required permissions for the action,
490
- # without actually making the request, and provides an error response.
491
- # If you have the required permissions, the error response is
492
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
493
- # @option options [required, Array<Types::Tag>] :tags
494
- # One or more tags. The `value` parameter is required, but if you don't
495
- # want the tag to have a value, specify the parameter with no value, and
496
- # we set the value to an empty string.
497
- # @return [Tag::Collection]
498
- def create_tags(options = {})
499
- batch = []
500
- options = Aws::Util.deep_merge(options, resources: [@id])
501
- resp = @client.create_tags(options)
502
- options[:tags].each do |t|
503
- batch << Tag.new(
504
- resource_id: @id,
505
- key: t[:key],
506
- value: t[:value],
507
- client: @client
508
- )
509
- end
510
- Tag::Collection.new([batch], size: batch.size)
511
- end
400
+ # @example Request syntax with placeholder values
401
+ #
402
+ # networkinterface = subnet.create_network_interface({
403
+ # description: "String",
404
+ # private_ip_address: "String",
405
+ # groups: ["String"],
406
+ # private_ip_addresses: [
407
+ # {
408
+ # private_ip_address: "String", # required
409
+ # primary: false,
410
+ # },
411
+ # ],
412
+ # secondary_private_ip_address_count: 1,
413
+ # ipv_6_addresses: [
414
+ # {
415
+ # ipv_6_address: "String",
416
+ # },
417
+ # ],
418
+ # ipv_6_address_count: 1,
419
+ # dry_run: false,
420
+ # })
421
+ # @param [Hash] options ({})
422
+ # @option options [String] :description
423
+ # A description for the network interface.
424
+ # @option options [String] :private_ip_address
425
+ # The primary private IPv4 address of the network interface. If you
426
+ # don't specify an IPv4 address, Amazon EC2 selects one for you from
427
+ # the subnet's IPv4 CIDR range. If you specify an IP address, you
428
+ # cannot indicate any IP addresses specified in `privateIpAddresses` as
429
+ # primary (only one IP address can be designated as primary).
430
+ # @option options [Array<String>] :groups
431
+ # The IDs of one or more security groups.
432
+ # @option options [Array<Types::PrivateIpAddressSpecification>] :private_ip_addresses
433
+ # One or more private IPv4 addresses.
434
+ # @option options [Integer] :secondary_private_ip_address_count
435
+ # The number of secondary private IPv4 addresses to assign to a network
436
+ # interface. When you specify a number of secondary IPv4 addresses,
437
+ # Amazon EC2 selects these IP addresses within the subnet's IPv4 CIDR
438
+ # range. You can't specify this option and specify more than one
439
+ # private IP address using `privateIpAddresses`.
440
+ #
441
+ # The number of IP addresses you can assign to a network interface
442
+ # varies by instance type. For more information, see [IP Addresses Per
443
+ # ENI Per Instance Type][1] in the *Amazon Virtual Private Cloud User
444
+ # Guide*.
445
+ #
446
+ #
447
+ #
448
+ # [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI
449
+ # @option options [Array<Types::InstanceIpv6Address>] :ipv_6_addresses
450
+ # One or more specific IPv6 addresses from the IPv6 CIDR block range of
451
+ # your subnet. You can't use this option if you're specifying a number
452
+ # of IPv6 addresses.
453
+ # @option options [Integer] :ipv_6_address_count
454
+ # The number of IPv6 addresses to assign to a network interface. Amazon
455
+ # EC2 automatically selects the IPv6 addresses from the subnet range.
456
+ # You can't use this option if specifying specific IPv6 addresses. If
457
+ # your subnet has the `AssignIpv6AddressOnCreation` attribute set to
458
+ # `true`, you can specify `0` to override this setting.
459
+ # @option options [Boolean] :dry_run
460
+ # Checks whether you have the required permissions for the action,
461
+ # without actually making the request, and provides an error response.
462
+ # If you have the required permissions, the error response is
463
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
464
+ # @return [NetworkInterface]
465
+ def create_network_interface(options = {})
466
+ options = options.merge(subnet_id: @id)
467
+ resp = @client.create_network_interface(options)
468
+ NetworkInterface.new(
469
+ id: resp.data.network_interface.network_interface_id,
470
+ data: resp.data.network_interface,
471
+ client: @client
472
+ )
473
+ end
512
474
 
513
- # @example Request syntax with placeholder values
514
- #
515
- # subnet.delete({
516
- # dry_run: false,
517
- # })
518
- # @param [Hash] options ({})
519
- # @option options [Boolean] :dry_run
520
- # Checks whether you have the required permissions for the action,
521
- # without actually making the request, and provides an error response.
522
- # If you have the required permissions, the error response is
523
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
524
- # @return [EmptyStructure]
525
- def delete(options = {})
526
- options = options.merge(subnet_id: @id)
527
- resp = @client.delete_subnet(options)
528
- resp.data
475
+ # @example Request syntax with placeholder values
476
+ #
477
+ # tag = subnet.create_tags({
478
+ # dry_run: false,
479
+ # tags: [ # required
480
+ # {
481
+ # key: "String",
482
+ # value: "String",
483
+ # },
484
+ # ],
485
+ # })
486
+ # @param [Hash] options ({})
487
+ # @option options [Boolean] :dry_run
488
+ # Checks whether you have the required permissions for the action,
489
+ # without actually making the request, and provides an error response.
490
+ # If you have the required permissions, the error response is
491
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
492
+ # @option options [required, Array<Types::Tag>] :tags
493
+ # One or more tags. The `value` parameter is required, but if you don't
494
+ # want the tag to have a value, specify the parameter with no value, and
495
+ # we set the value to an empty string.
496
+ # @return [Tag::Collection]
497
+ def create_tags(options = {})
498
+ batch = []
499
+ options = Aws::Util.deep_merge(options, resources: [@id])
500
+ resp = @client.create_tags(options)
501
+ options[:tags].each do |t|
502
+ batch << Tag.new(
503
+ resource_id: @id,
504
+ key: t[:key],
505
+ value: t[:value],
506
+ client: @client
507
+ )
529
508
  end
509
+ Tag::Collection.new([batch], size: batch.size)
510
+ end
530
511
 
531
- # @!group Associations
512
+ # @example Request syntax with placeholder values
513
+ #
514
+ # subnet.delete({
515
+ # dry_run: false,
516
+ # })
517
+ # @param [Hash] options ({})
518
+ # @option options [Boolean] :dry_run
519
+ # Checks whether you have the required permissions for the action,
520
+ # without actually making the request, and provides an error response.
521
+ # If you have the required permissions, the error response is
522
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
523
+ # @return [EmptyStructure]
524
+ def delete(options = {})
525
+ options = options.merge(subnet_id: @id)
526
+ resp = @client.delete_subnet(options)
527
+ resp.data
528
+ end
532
529
 
533
- # @example Request syntax with placeholder values
534
- #
535
- # instances = subnet.instances({
536
- # dry_run: false,
537
- # instance_ids: ["String"],
538
- # filters: [
539
- # {
540
- # name: "String",
541
- # values: ["String"],
542
- # },
543
- # ],
544
- # })
545
- # @param [Hash] options ({})
546
- # @option options [Boolean] :dry_run
547
- # Checks whether you have the required permissions for the action,
548
- # without actually making the request, and provides an error response.
549
- # If you have the required permissions, the error response is
550
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
551
- # @option options [Array<String>] :instance_ids
552
- # One or more instance IDs.
553
- #
554
- # Default: Describes all your instances.
555
- # @option options [Array<Types::Filter>] :filters
556
- # One or more filters.
557
- #
558
- # * `affinity` - The affinity setting for an instance running on a
559
- # Dedicated Host (`default` \| `host`).
560
- #
561
- # * `architecture` - The instance architecture (`i386` \| `x86_64`).
562
- #
563
- # * `association.public-ip` - The address of the Elastic IP address
564
- # (IPv4) bound to the network interface.
565
- #
566
- # * `association.ip-owner-id` - The owner of the Elastic IP address
567
- # (IPv4) associated with the network interface.
568
- #
569
- # * `association.allocation-id` - The allocation ID returned when you
570
- # allocated the Elastic IP address (IPv4) for your network interface.
571
- #
572
- # * `association.association-id` - The association ID returned when the
573
- # network interface was associated with an IPv4 address.
574
- #
575
- # * `availability-zone` - The Availability Zone of the instance.
576
- #
577
- # * `block-device-mapping.attach-time` - The attach time for an EBS
578
- # volume mapped to the instance, for example,
579
- # `2010-09-15T17:15:20.000Z`.
580
- #
581
- # * `block-device-mapping.delete-on-termination` - A Boolean that
582
- # indicates whether the EBS volume is deleted on instance termination.
583
- #
584
- # * `block-device-mapping.device-name` - The device name for the EBS
585
- # volume (for example, `/dev/sdh` or `xvdh`).
586
- #
587
- # * `block-device-mapping.status` - The status for the EBS volume
588
- # (`attaching` \| `attached` \| `detaching` \| `detached`).
589
- #
590
- # * `block-device-mapping.volume-id` - The volume ID of the EBS volume.
591
- #
592
- # * `client-token` - The idempotency token you provided when you
593
- # launched the instance.
594
- #
595
- # * `dns-name` - The public DNS name of the instance.
596
- #
597
- # * `group-id` - The ID of the security group for the instance.
598
- # EC2-Classic only.
599
- #
600
- # * `group-name` - The name of the security group for the instance.
601
- # EC2-Classic only.
602
- #
603
- # * `host-id` - The ID of the Dedicated Host on which the instance is
604
- # running, if applicable.
605
- #
606
- # * `hypervisor` - The hypervisor type of the instance (`ovm` \| `xen`).
607
- #
608
- # * `iam-instance-profile.arn` - The instance profile associated with
609
- # the instance. Specified as an ARN.
610
- #
611
- # * `image-id` - The ID of the image used to launch the instance.
612
- #
613
- # * `instance-id` - The ID of the instance.
614
- #
615
- # * `instance-lifecycle` - Indicates whether this is a Spot Instance or
616
- # a Scheduled Instance (`spot` \| `scheduled`).
617
- #
618
- # * `instance-state-code` - The state of the instance, as a 16-bit
619
- # unsigned integer. The high byte is an opaque internal value and
620
- # should be ignored. The low byte is set based on the state
621
- # represented. The valid values are: 0 (pending), 16 (running), 32
622
- # (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).
623
- #
624
- # * `instance-state-name` - The state of the instance (`pending` \|
625
- # `running` \| `shutting-down` \| `terminated` \| `stopping` \|
626
- # `stopped`).
627
- #
628
- # * `instance-type` - The type of instance (for example, `t2.micro`).
629
- #
630
- # * `instance.group-id` - The ID of the security group for the instance.
631
- #
632
- # * `instance.group-name` - The name of the security group for the
633
- # instance.
634
- #
635
- # * `ip-address` - The public IPv4 address of the instance.
636
- #
637
- # * `kernel-id` - The kernel ID.
638
- #
639
- # * `key-name` - The name of the key pair used when the instance was
640
- # launched.
641
- #
642
- # * `launch-index` - When launching multiple instances, this is the
643
- # index for the instance in the launch group (for example, 0, 1, 2,
644
- # and so on).
645
- #
646
- # * `launch-time` - The time when the instance was launched.
647
- #
648
- # * `monitoring-state` - Indicates whether detailed monitoring is
649
- # enabled (`disabled` \| `enabled`).
650
- #
651
- # * `network-interface.addresses.private-ip-address` - The private IPv4
652
- # address associated with the network interface.
653
- #
654
- # * `network-interface.addresses.primary` - Specifies whether the IPv4
655
- # address of the network interface is the primary private IPv4
656
- # address.
657
- #
658
- # * `network-interface.addresses.association.public-ip` - The ID of the
659
- # association of an Elastic IP address (IPv4) with a network
660
- # interface.
661
- #
662
- # * `network-interface.addresses.association.ip-owner-id` - The owner ID
663
- # of the private IPv4 address associated with the network interface.
664
- #
665
- # * `network-interface.attachment.attachment-id` - The ID of the
666
- # interface attachment.
667
- #
668
- # * `network-interface.attachment.instance-id` - The ID of the instance
669
- # to which the network interface is attached.
670
- #
671
- # * `network-interface.attachment.instance-owner-id` - The owner ID of
672
- # the instance to which the network interface is attached.
673
- #
674
- # * `network-interface.attachment.device-index` - The device index to
675
- # which the network interface is attached.
676
- #
677
- # * `network-interface.attachment.status` - The status of the attachment
678
- # (`attaching` \| `attached` \| `detaching` \| `detached`).
679
- #
680
- # * `network-interface.attachment.attach-time` - The time that the
681
- # network interface was attached to an instance.
682
- #
683
- # * `network-interface.attachment.delete-on-termination` - Specifies
684
- # whether the attachment is deleted when an instance is terminated.
685
- #
686
- # * `network-interface.availability-zone` - The Availability Zone for
687
- # the network interface.
688
- #
689
- # * `network-interface.description` - The description of the network
690
- # interface.
691
- #
692
- # * `network-interface.group-id` - The ID of a security group associated
693
- # with the network interface.
694
- #
695
- # * `network-interface.group-name` - The name of a security group
696
- # associated with the network interface.
697
- #
698
- # * `network-interface.ipv6-addresses.ipv6-address` - The IPv6 address
699
- # associated with the network interface.
700
- #
701
- # * `network-interface.mac-address` - The MAC address of the network
702
- # interface.
703
- #
704
- # * `network-interface.network-interface-id` - The ID of the network
705
- # interface.
706
- #
707
- # * `network-interface.owner-id` - The ID of the owner of the network
708
- # interface.
709
- #
710
- # * `network-interface.private-dns-name` - The private DNS name of the
711
- # network interface.
712
- #
713
- # * `network-interface.requester-id` - The requester ID for the network
714
- # interface.
715
- #
716
- # * `network-interface.requester-managed` - Indicates whether the
717
- # network interface is being managed by AWS.
718
- #
719
- # * `network-interface.status` - The status of the network interface
720
- # (`available`) \| `in-use`).
721
- #
722
- # * `network-interface.source-dest-check` - Whether the network
723
- # interface performs source/destination checking. A value of `true`
724
- # means checking is enabled, and `false` means checking is disabled.
725
- # The value must be `false` for the network interface to perform
726
- # network address translation (NAT) in your VPC.
727
- #
728
- # * `network-interface.subnet-id` - The ID of the subnet for the network
729
- # interface.
730
- #
731
- # * `network-interface.vpc-id` - The ID of the VPC for the network
732
- # interface.
733
- #
734
- # * `owner-id` - The AWS account ID of the instance owner.
735
- #
736
- # * `placement-group-name` - The name of the placement group for the
737
- # instance.
738
- #
739
- # * `platform` - The platform. Use `windows` if you have Windows
740
- # instances; otherwise, leave blank.
741
- #
742
- # * `private-dns-name` - The private IPv4 DNS name of the instance.
743
- #
744
- # * `private-ip-address` - The private IPv4 address of the instance.
745
- #
746
- # * `product-code` - The product code associated with the AMI used to
747
- # launch the instance.
748
- #
749
- # * `product-code.type` - The type of product code (`devpay` \|
750
- # `marketplace`).
751
- #
752
- # * `ramdisk-id` - The RAM disk ID.
753
- #
754
- # * `reason` - The reason for the current state of the instance (for
755
- # example, shows "User Initiated \[date\]" when you stop or
756
- # terminate the instance). Similar to the state-reason-code filter.
757
- #
758
- # * `requester-id` - The ID of the entity that launched the instance on
759
- # your behalf (for example, AWS Management Console, Auto Scaling, and
760
- # so on).
761
- #
762
- # * `reservation-id` - The ID of the instance's reservation. A
763
- # reservation ID is created any time you launch an instance. A
764
- # reservation ID has a one-to-one relationship with an instance launch
765
- # request, but can be associated with more than one instance if you
766
- # launch multiple instances using the same launch request. For
767
- # example, if you launch one instance, you'll get one reservation ID.
768
- # If you launch ten instances using the same launch request, you'll
769
- # also get one reservation ID.
770
- #
771
- # * `root-device-name` - The name of the root device for the instance
772
- # (for example, `/dev/sda1` or `/dev/xvda`).
773
- #
774
- # * `root-device-type` - The type of root device that the instance uses
775
- # (`ebs` \| `instance-store`).
776
- #
777
- # * `source-dest-check` - Indicates whether the instance performs
778
- # source/destination checking. A value of `true` means that checking
779
- # is enabled, and `false` means checking is disabled. The value must
780
- # be `false` for the instance to perform network address translation
781
- # (NAT) in your VPC.
782
- #
783
- # * `spot-instance-request-id` - The ID of the Spot instance request.
784
- #
785
- # * `state-reason-code` - The reason code for the state change.
786
- #
787
- # * `state-reason-message` - A message that describes the state change.
788
- #
789
- # * `subnet-id` - The ID of the subnet for the instance.
790
- #
791
- # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
792
- # to the resource, where `tag`\:*key* is the tag's key.
793
- #
794
- # * `tag-key` - The key of a tag assigned to the resource. This filter
795
- # is independent of the `tag-value` filter. For example, if you use
796
- # both the filter "tag-key=Purpose" and the filter "tag-value=X",
797
- # you get any resources assigned both the tag key Purpose (regardless
798
- # of what the tag's value is), and the tag value X (regardless of
799
- # what the tag's key is). If you want to list only resources where
800
- # Purpose is X, see the `tag`\:*key*=*value* filter.
801
- #
802
- # * `tag-value` - The value of a tag assigned to the resource. This
803
- # filter is independent of the `tag-key` filter.
804
- #
805
- # * `tenancy` - The tenancy of an instance (`dedicated` \| `default` \|
806
- # `host`).
807
- #
808
- # * `virtualization-type` - The virtualization type of the instance
809
- # (`paravirtual` \| `hvm`).
810
- #
811
- # * `vpc-id` - The ID of the VPC that the instance is running in.
812
- # @return [Instance::Collection]
813
- def instances(options = {})
814
- batches = Enumerator.new do |y|
815
- options = Aws::Util.deep_merge(options, filters: [{
816
- name: "subnet-id",
817
- values: [@id]
818
- }])
819
- resp = @client.describe_instances(options)
820
- resp.each_page do |page|
821
- batch = []
822
- page.data.reservations.each do |r|
823
- r.instances.each do |i|
824
- batch << Instance.new(
825
- id: i.instance_id,
826
- data: i,
827
- client: @client
828
- )
829
- end
830
- end
831
- y.yield(batch)
832
- end
833
- end
834
- Instance::Collection.new(batches)
835
- end
530
+ # @!group Associations
836
531
 
837
- # @example Request syntax with placeholder values
838
- #
839
- # networkinterfaces = subnet.network_interfaces({
840
- # dry_run: false,
841
- # network_interface_ids: ["String"],
842
- # filters: [
843
- # {
844
- # name: "String",
845
- # values: ["String"],
846
- # },
847
- # ],
848
- # })
849
- # @param [Hash] options ({})
850
- # @option options [Boolean] :dry_run
851
- # Checks whether you have the required permissions for the action,
852
- # without actually making the request, and provides an error response.
853
- # If you have the required permissions, the error response is
854
- # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
855
- # @option options [Array<String>] :network_interface_ids
856
- # One or more network interface IDs.
857
- #
858
- # Default: Describes all your network interfaces.
859
- # @option options [Array<Types::Filter>] :filters
860
- # One or more filters.
861
- #
862
- # * `addresses.private-ip-address` - The private IPv4 addresses
863
- # associated with the network interface.
864
- #
865
- # * `addresses.primary` - Whether the private IPv4 address is the
866
- # primary IP address associated with the network interface.
867
- #
868
- # * `addresses.association.public-ip` - The association ID returned when
869
- # the network interface was associated with the Elastic IP address
870
- # (IPv4).
871
- #
872
- # * `addresses.association.owner-id` - The owner ID of the addresses
873
- # associated with the network interface.
874
- #
875
- # * `association.association-id` - The association ID returned when the
876
- # network interface was associated with an IPv4 address.
877
- #
878
- # * `association.allocation-id` - The allocation ID returned when you
879
- # allocated the Elastic IP address (IPv4) for your network interface.
880
- #
881
- # * `association.ip-owner-id` - The owner of the Elastic IP address
882
- # (IPv4) associated with the network interface.
883
- #
884
- # * `association.public-ip` - The address of the Elastic IP address
885
- # (IPv4) bound to the network interface.
886
- #
887
- # * `association.public-dns-name` - The public DNS name for the network
888
- # interface (IPv4).
889
- #
890
- # * `attachment.attachment-id` - The ID of the interface attachment.
891
- #
892
- # * `attachment.attach.time` - The time that the network interface was
893
- # attached to an instance.
894
- #
895
- # * `attachment.delete-on-termination` - Indicates whether the
896
- # attachment is deleted when an instance is terminated.
897
- #
898
- # * `attachment.device-index` - The device index to which the network
899
- # interface is attached.
900
- #
901
- # * `attachment.instance-id` - The ID of the instance to which the
902
- # network interface is attached.
903
- #
904
- # * `attachment.instance-owner-id` - The owner ID of the instance to
905
- # which the network interface is attached.
906
- #
907
- # * `attachment.nat-gateway-id` - The ID of the NAT gateway to which the
908
- # network interface is attached.
909
- #
910
- # * `attachment.status` - The status of the attachment (`attaching` \|
911
- # `attached` \| `detaching` \| `detached`).
912
- #
913
- # * `availability-zone` - The Availability Zone of the network
914
- # interface.
915
- #
916
- # * `description` - The description of the network interface.
917
- #
918
- # * `group-id` - The ID of a security group associated with the network
919
- # interface.
920
- #
921
- # * `group-name` - The name of a security group associated with the
922
- # network interface.
923
- #
924
- # * `ipv6-addresses.ipv6-address` - An IPv6 address associated with the
925
- # network interface.
926
- #
927
- # * `mac-address` - The MAC address of the network interface.
928
- #
929
- # * `network-interface-id` - The ID of the network interface.
930
- #
931
- # * `owner-id` - The AWS account ID of the network interface owner.
932
- #
933
- # * `private-ip-address` - The private IPv4 address or addresses of the
934
- # network interface.
935
- #
936
- # * `private-dns-name` - The private DNS name of the network interface
937
- # (IPv4).
938
- #
939
- # * `requester-id` - The ID of the entity that launched the instance on
940
- # your behalf (for example, AWS Management Console, Auto Scaling, and
941
- # so on).
942
- #
943
- # * `requester-managed` - Indicates whether the network interface is
944
- # being managed by an AWS service (for example, AWS Management
945
- # Console, Auto Scaling, and so on).
946
- #
947
- # * `source-desk-check` - Indicates whether the network interface
948
- # performs source/destination checking. A value of `true` means
949
- # checking is enabled, and `false` means checking is disabled. The
950
- # value must be `false` for the network interface to perform network
951
- # address translation (NAT) in your VPC.
952
- #
953
- # * `status` - The status of the network interface. If the network
954
- # interface is not attached to an instance, the status is `available`;
955
- # if a network interface is attached to an instance the status is
956
- # `in-use`.
957
- #
958
- # * `subnet-id` - The ID of the subnet for the network interface.
959
- #
960
- # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
961
- # to the resource.
962
- #
963
- # * `tag-key` - The key of a tag assigned to the resource. This filter
964
- # is independent of the `tag-value` filter. For example, if you use
965
- # both the filter "tag-key=Purpose" and the filter "tag-value=X",
966
- # you get any resources assigned both the tag key Purpose (regardless
967
- # of what the tag's value is), and the tag value X (regardless of
968
- # what the tag's key is). If you want to list only resources where
969
- # Purpose is X, see the `tag`\:*key*=*value* filter.
970
- #
971
- # * `tag-value` - The value of a tag assigned to the resource. This
972
- # filter is independent of the `tag-key` filter.
973
- #
974
- # * `vpc-id` - The ID of the VPC for the network interface.
975
- # @return [NetworkInterface::Collection]
976
- def network_interfaces(options = {})
977
- batches = Enumerator.new do |y|
532
+ # @example Request syntax with placeholder values
533
+ #
534
+ # instances = subnet.instances({
535
+ # dry_run: false,
536
+ # instance_ids: ["String"],
537
+ # filters: [
538
+ # {
539
+ # name: "String",
540
+ # values: ["String"],
541
+ # },
542
+ # ],
543
+ # })
544
+ # @param [Hash] options ({})
545
+ # @option options [Boolean] :dry_run
546
+ # Checks whether you have the required permissions for the action,
547
+ # without actually making the request, and provides an error response.
548
+ # If you have the required permissions, the error response is
549
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
550
+ # @option options [Array<String>] :instance_ids
551
+ # One or more instance IDs.
552
+ #
553
+ # Default: Describes all your instances.
554
+ # @option options [Array<Types::Filter>] :filters
555
+ # One or more filters.
556
+ #
557
+ # * `affinity` - The affinity setting for an instance running on a
558
+ # Dedicated Host (`default` \| `host`).
559
+ #
560
+ # * `architecture` - The instance architecture (`i386` \| `x86_64`).
561
+ #
562
+ # * `association.public-ip` - The address of the Elastic IP address
563
+ # (IPv4) bound to the network interface.
564
+ #
565
+ # * `association.ip-owner-id` - The owner of the Elastic IP address
566
+ # (IPv4) associated with the network interface.
567
+ #
568
+ # * `association.allocation-id` - The allocation ID returned when you
569
+ # allocated the Elastic IP address (IPv4) for your network interface.
570
+ #
571
+ # * `association.association-id` - The association ID returned when the
572
+ # network interface was associated with an IPv4 address.
573
+ #
574
+ # * `availability-zone` - The Availability Zone of the instance.
575
+ #
576
+ # * `block-device-mapping.attach-time` - The attach time for an EBS
577
+ # volume mapped to the instance, for example,
578
+ # `2010-09-15T17:15:20.000Z`.
579
+ #
580
+ # * `block-device-mapping.delete-on-termination` - A Boolean that
581
+ # indicates whether the EBS volume is deleted on instance termination.
582
+ #
583
+ # * `block-device-mapping.device-name` - The device name for the EBS
584
+ # volume (for example, `/dev/sdh` or `xvdh`).
585
+ #
586
+ # * `block-device-mapping.status` - The status for the EBS volume
587
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
588
+ #
589
+ # * `block-device-mapping.volume-id` - The volume ID of the EBS volume.
590
+ #
591
+ # * `client-token` - The idempotency token you provided when you
592
+ # launched the instance.
593
+ #
594
+ # * `dns-name` - The public DNS name of the instance.
595
+ #
596
+ # * `group-id` - The ID of the security group for the instance.
597
+ # EC2-Classic only.
598
+ #
599
+ # * `group-name` - The name of the security group for the instance.
600
+ # EC2-Classic only.
601
+ #
602
+ # * `host-id` - The ID of the Dedicated Host on which the instance is
603
+ # running, if applicable.
604
+ #
605
+ # * `hypervisor` - The hypervisor type of the instance (`ovm` \| `xen`).
606
+ #
607
+ # * `iam-instance-profile.arn` - The instance profile associated with
608
+ # the instance. Specified as an ARN.
609
+ #
610
+ # * `image-id` - The ID of the image used to launch the instance.
611
+ #
612
+ # * `instance-id` - The ID of the instance.
613
+ #
614
+ # * `instance-lifecycle` - Indicates whether this is a Spot Instance or
615
+ # a Scheduled Instance (`spot` \| `scheduled`).
616
+ #
617
+ # * `instance-state-code` - The state of the instance, as a 16-bit
618
+ # unsigned integer. The high byte is an opaque internal value and
619
+ # should be ignored. The low byte is set based on the state
620
+ # represented. The valid values are: 0 (pending), 16 (running), 32
621
+ # (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).
622
+ #
623
+ # * `instance-state-name` - The state of the instance (`pending` \|
624
+ # `running` \| `shutting-down` \| `terminated` \| `stopping` \|
625
+ # `stopped`).
626
+ #
627
+ # * `instance-type` - The type of instance (for example, `t2.micro`).
628
+ #
629
+ # * `instance.group-id` - The ID of the security group for the instance.
630
+ #
631
+ # * `instance.group-name` - The name of the security group for the
632
+ # instance.
633
+ #
634
+ # * `ip-address` - The public IPv4 address of the instance.
635
+ #
636
+ # * `kernel-id` - The kernel ID.
637
+ #
638
+ # * `key-name` - The name of the key pair used when the instance was
639
+ # launched.
640
+ #
641
+ # * `launch-index` - When launching multiple instances, this is the
642
+ # index for the instance in the launch group (for example, 0, 1, 2,
643
+ # and so on).
644
+ #
645
+ # * `launch-time` - The time when the instance was launched.
646
+ #
647
+ # * `monitoring-state` - Indicates whether detailed monitoring is
648
+ # enabled (`disabled` \| `enabled`).
649
+ #
650
+ # * `network-interface.addresses.private-ip-address` - The private IPv4
651
+ # address associated with the network interface.
652
+ #
653
+ # * `network-interface.addresses.primary` - Specifies whether the IPv4
654
+ # address of the network interface is the primary private IPv4
655
+ # address.
656
+ #
657
+ # * `network-interface.addresses.association.public-ip` - The ID of the
658
+ # association of an Elastic IP address (IPv4) with a network
659
+ # interface.
660
+ #
661
+ # * `network-interface.addresses.association.ip-owner-id` - The owner ID
662
+ # of the private IPv4 address associated with the network interface.
663
+ #
664
+ # * `network-interface.attachment.attachment-id` - The ID of the
665
+ # interface attachment.
666
+ #
667
+ # * `network-interface.attachment.instance-id` - The ID of the instance
668
+ # to which the network interface is attached.
669
+ #
670
+ # * `network-interface.attachment.instance-owner-id` - The owner ID of
671
+ # the instance to which the network interface is attached.
672
+ #
673
+ # * `network-interface.attachment.device-index` - The device index to
674
+ # which the network interface is attached.
675
+ #
676
+ # * `network-interface.attachment.status` - The status of the attachment
677
+ # (`attaching` \| `attached` \| `detaching` \| `detached`).
678
+ #
679
+ # * `network-interface.attachment.attach-time` - The time that the
680
+ # network interface was attached to an instance.
681
+ #
682
+ # * `network-interface.attachment.delete-on-termination` - Specifies
683
+ # whether the attachment is deleted when an instance is terminated.
684
+ #
685
+ # * `network-interface.availability-zone` - The Availability Zone for
686
+ # the network interface.
687
+ #
688
+ # * `network-interface.description` - The description of the network
689
+ # interface.
690
+ #
691
+ # * `network-interface.group-id` - The ID of a security group associated
692
+ # with the network interface.
693
+ #
694
+ # * `network-interface.group-name` - The name of a security group
695
+ # associated with the network interface.
696
+ #
697
+ # * `network-interface.ipv6-addresses.ipv6-address` - The IPv6 address
698
+ # associated with the network interface.
699
+ #
700
+ # * `network-interface.mac-address` - The MAC address of the network
701
+ # interface.
702
+ #
703
+ # * `network-interface.network-interface-id` - The ID of the network
704
+ # interface.
705
+ #
706
+ # * `network-interface.owner-id` - The ID of the owner of the network
707
+ # interface.
708
+ #
709
+ # * `network-interface.private-dns-name` - The private DNS name of the
710
+ # network interface.
711
+ #
712
+ # * `network-interface.requester-id` - The requester ID for the network
713
+ # interface.
714
+ #
715
+ # * `network-interface.requester-managed` - Indicates whether the
716
+ # network interface is being managed by AWS.
717
+ #
718
+ # * `network-interface.status` - The status of the network interface
719
+ # (`available`) \| `in-use`).
720
+ #
721
+ # * `network-interface.source-dest-check` - Whether the network
722
+ # interface performs source/destination checking. A value of `true`
723
+ # means checking is enabled, and `false` means checking is disabled.
724
+ # The value must be `false` for the network interface to perform
725
+ # network address translation (NAT) in your VPC.
726
+ #
727
+ # * `network-interface.subnet-id` - The ID of the subnet for the network
728
+ # interface.
729
+ #
730
+ # * `network-interface.vpc-id` - The ID of the VPC for the network
731
+ # interface.
732
+ #
733
+ # * `owner-id` - The AWS account ID of the instance owner.
734
+ #
735
+ # * `placement-group-name` - The name of the placement group for the
736
+ # instance.
737
+ #
738
+ # * `platform` - The platform. Use `windows` if you have Windows
739
+ # instances; otherwise, leave blank.
740
+ #
741
+ # * `private-dns-name` - The private IPv4 DNS name of the instance.
742
+ #
743
+ # * `private-ip-address` - The private IPv4 address of the instance.
744
+ #
745
+ # * `product-code` - The product code associated with the AMI used to
746
+ # launch the instance.
747
+ #
748
+ # * `product-code.type` - The type of product code (`devpay` \|
749
+ # `marketplace`).
750
+ #
751
+ # * `ramdisk-id` - The RAM disk ID.
752
+ #
753
+ # * `reason` - The reason for the current state of the instance (for
754
+ # example, shows "User Initiated \[date\]" when you stop or
755
+ # terminate the instance). Similar to the state-reason-code filter.
756
+ #
757
+ # * `requester-id` - The ID of the entity that launched the instance on
758
+ # your behalf (for example, AWS Management Console, Auto Scaling, and
759
+ # so on).
760
+ #
761
+ # * `reservation-id` - The ID of the instance's reservation. A
762
+ # reservation ID is created any time you launch an instance. A
763
+ # reservation ID has a one-to-one relationship with an instance launch
764
+ # request, but can be associated with more than one instance if you
765
+ # launch multiple instances using the same launch request. For
766
+ # example, if you launch one instance, you'll get one reservation ID.
767
+ # If you launch ten instances using the same launch request, you'll
768
+ # also get one reservation ID.
769
+ #
770
+ # * `root-device-name` - The name of the root device for the instance
771
+ # (for example, `/dev/sda1` or `/dev/xvda`).
772
+ #
773
+ # * `root-device-type` - The type of root device that the instance uses
774
+ # (`ebs` \| `instance-store`).
775
+ #
776
+ # * `source-dest-check` - Indicates whether the instance performs
777
+ # source/destination checking. A value of `true` means that checking
778
+ # is enabled, and `false` means checking is disabled. The value must
779
+ # be `false` for the instance to perform network address translation
780
+ # (NAT) in your VPC.
781
+ #
782
+ # * `spot-instance-request-id` - The ID of the Spot instance request.
783
+ #
784
+ # * `state-reason-code` - The reason code for the state change.
785
+ #
786
+ # * `state-reason-message` - A message that describes the state change.
787
+ #
788
+ # * `subnet-id` - The ID of the subnet for the instance.
789
+ #
790
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
791
+ # to the resource. Specify the key of the tag in the filter name and
792
+ # the value of the tag in the filter value. For example, for the tag
793
+ # Purpose=X, specify `tag:Purpose` for the filter name and `X` for the
794
+ # filter value.
795
+ #
796
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
797
+ # is independent of the `tag-value` filter. For example, if you use
798
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
799
+ # you get any resources assigned both the tag key Purpose (regardless
800
+ # of what the tag's value is), and the tag value X (regardless of
801
+ # what the tag's key is). If you want to list only resources where
802
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
803
+ #
804
+ # * `tag-value` - The value of a tag assigned to the resource. This
805
+ # filter is independent of the `tag-key` filter.
806
+ #
807
+ # * `tenancy` - The tenancy of an instance (`dedicated` \| `default` \|
808
+ # `host`).
809
+ #
810
+ # * `virtualization-type` - The virtualization type of the instance
811
+ # (`paravirtual` \| `hvm`).
812
+ #
813
+ # * `vpc-id` - The ID of the VPC that the instance is running in.
814
+ # @return [Instance::Collection]
815
+ def instances(options = {})
816
+ batches = Enumerator.new do |y|
817
+ options = Aws::Util.deep_merge(options, filters: [{
818
+ name: "subnet-id",
819
+ values: [@id]
820
+ }])
821
+ resp = @client.describe_instances(options)
822
+ resp.each_page do |page|
978
823
  batch = []
979
- options = Aws::Util.deep_merge(options, filters: [{
980
- name: "subnet-id",
981
- values: [@id]
982
- }])
983
- resp = @client.describe_network_interfaces(options)
984
- resp.data.network_interfaces.each do |n|
985
- batch << NetworkInterface.new(
986
- id: n.network_interface_id,
987
- data: n,
988
- client: @client
989
- )
824
+ page.data.reservations.each do |r|
825
+ r.instances.each do |i|
826
+ batch << Instance.new(
827
+ id: i.instance_id,
828
+ data: i,
829
+ client: @client
830
+ )
831
+ end
990
832
  end
991
833
  y.yield(batch)
992
834
  end
993
- NetworkInterface::Collection.new(batches)
994
835
  end
836
+ Instance::Collection.new(batches)
837
+ end
995
838
 
996
- # @return [Vpc, nil]
997
- def vpc
998
- if data.vpc_id
999
- Vpc.new(
1000
- id: data.vpc_id,
839
+ # @example Request syntax with placeholder values
840
+ #
841
+ # network_interfaces = subnet.network_interfaces({
842
+ # dry_run: false,
843
+ # network_interface_ids: ["String"],
844
+ # filters: [
845
+ # {
846
+ # name: "String",
847
+ # values: ["String"],
848
+ # },
849
+ # ],
850
+ # })
851
+ # @param [Hash] options ({})
852
+ # @option options [Boolean] :dry_run
853
+ # Checks whether you have the required permissions for the action,
854
+ # without actually making the request, and provides an error response.
855
+ # If you have the required permissions, the error response is
856
+ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
857
+ # @option options [Array<String>] :network_interface_ids
858
+ # One or more network interface IDs.
859
+ #
860
+ # Default: Describes all your network interfaces.
861
+ # @option options [Array<Types::Filter>] :filters
862
+ # One or more filters.
863
+ #
864
+ # * `addresses.private-ip-address` - The private IPv4 addresses
865
+ # associated with the network interface.
866
+ #
867
+ # * `addresses.primary` - Whether the private IPv4 address is the
868
+ # primary IP address associated with the network interface.
869
+ #
870
+ # * `addresses.association.public-ip` - The association ID returned when
871
+ # the network interface was associated with the Elastic IP address
872
+ # (IPv4).
873
+ #
874
+ # * `addresses.association.owner-id` - The owner ID of the addresses
875
+ # associated with the network interface.
876
+ #
877
+ # * `association.association-id` - The association ID returned when the
878
+ # network interface was associated with an IPv4 address.
879
+ #
880
+ # * `association.allocation-id` - The allocation ID returned when you
881
+ # allocated the Elastic IP address (IPv4) for your network interface.
882
+ #
883
+ # * `association.ip-owner-id` - The owner of the Elastic IP address
884
+ # (IPv4) associated with the network interface.
885
+ #
886
+ # * `association.public-ip` - The address of the Elastic IP address
887
+ # (IPv4) bound to the network interface.
888
+ #
889
+ # * `association.public-dns-name` - The public DNS name for the network
890
+ # interface (IPv4).
891
+ #
892
+ # * `attachment.attachment-id` - The ID of the interface attachment.
893
+ #
894
+ # * `attachment.attach.time` - The time that the network interface was
895
+ # attached to an instance.
896
+ #
897
+ # * `attachment.delete-on-termination` - Indicates whether the
898
+ # attachment is deleted when an instance is terminated.
899
+ #
900
+ # * `attachment.device-index` - The device index to which the network
901
+ # interface is attached.
902
+ #
903
+ # * `attachment.instance-id` - The ID of the instance to which the
904
+ # network interface is attached.
905
+ #
906
+ # * `attachment.instance-owner-id` - The owner ID of the instance to
907
+ # which the network interface is attached.
908
+ #
909
+ # * `attachment.nat-gateway-id` - The ID of the NAT gateway to which the
910
+ # network interface is attached.
911
+ #
912
+ # * `attachment.status` - The status of the attachment (`attaching` \|
913
+ # `attached` \| `detaching` \| `detached`).
914
+ #
915
+ # * `availability-zone` - The Availability Zone of the network
916
+ # interface.
917
+ #
918
+ # * `description` - The description of the network interface.
919
+ #
920
+ # * `group-id` - The ID of a security group associated with the network
921
+ # interface.
922
+ #
923
+ # * `group-name` - The name of a security group associated with the
924
+ # network interface.
925
+ #
926
+ # * `ipv6-addresses.ipv6-address` - An IPv6 address associated with the
927
+ # network interface.
928
+ #
929
+ # * `mac-address` - The MAC address of the network interface.
930
+ #
931
+ # * `network-interface-id` - The ID of the network interface.
932
+ #
933
+ # * `owner-id` - The AWS account ID of the network interface owner.
934
+ #
935
+ # * `private-ip-address` - The private IPv4 address or addresses of the
936
+ # network interface.
937
+ #
938
+ # * `private-dns-name` - The private DNS name of the network interface
939
+ # (IPv4).
940
+ #
941
+ # * `requester-id` - The ID of the entity that launched the instance on
942
+ # your behalf (for example, AWS Management Console, Auto Scaling, and
943
+ # so on).
944
+ #
945
+ # * `requester-managed` - Indicates whether the network interface is
946
+ # being managed by an AWS service (for example, AWS Management
947
+ # Console, Auto Scaling, and so on).
948
+ #
949
+ # * `source-desk-check` - Indicates whether the network interface
950
+ # performs source/destination checking. A value of `true` means
951
+ # checking is enabled, and `false` means checking is disabled. The
952
+ # value must be `false` for the network interface to perform network
953
+ # address translation (NAT) in your VPC.
954
+ #
955
+ # * `status` - The status of the network interface. If the network
956
+ # interface is not attached to an instance, the status is `available`;
957
+ # if a network interface is attached to an instance the status is
958
+ # `in-use`.
959
+ #
960
+ # * `subnet-id` - The ID of the subnet for the network interface.
961
+ #
962
+ # * `tag`\:*key*=*value* - The key/value combination of a tag assigned
963
+ # to the resource. Specify the key of the tag in the filter name and
964
+ # the value of the tag in the filter value. For example, for the tag
965
+ # Purpose=X, specify `tag:Purpose` for the filter name and `X` for the
966
+ # filter value.
967
+ #
968
+ # * `tag-key` - The key of a tag assigned to the resource. This filter
969
+ # is independent of the `tag-value` filter. For example, if you use
970
+ # both the filter "tag-key=Purpose" and the filter "tag-value=X",
971
+ # you get any resources assigned both the tag key Purpose (regardless
972
+ # of what the tag's value is), and the tag value X (regardless of
973
+ # what the tag's key is). If you want to list only resources where
974
+ # Purpose is X, see the `tag`\:*key*=*value* filter.
975
+ #
976
+ # * `tag-value` - The value of a tag assigned to the resource. This
977
+ # filter is independent of the `tag-key` filter.
978
+ #
979
+ # * `vpc-id` - The ID of the VPC for the network interface.
980
+ # @return [NetworkInterface::Collection]
981
+ def network_interfaces(options = {})
982
+ batches = Enumerator.new do |y|
983
+ batch = []
984
+ options = Aws::Util.deep_merge(options, filters: [{
985
+ name: "subnet-id",
986
+ values: [@id]
987
+ }])
988
+ resp = @client.describe_network_interfaces(options)
989
+ resp.data.network_interfaces.each do |n|
990
+ batch << NetworkInterface.new(
991
+ id: n.network_interface_id,
992
+ data: n,
1001
993
  client: @client
1002
994
  )
1003
- else
1004
- nil
1005
995
  end
996
+ y.yield(batch)
1006
997
  end
998
+ NetworkInterface::Collection.new(batches)
999
+ end
1007
1000
 
1008
- # @deprecated
1009
- # @api private
1010
- def identifiers
1011
- { id: @id }
1001
+ # @return [Vpc, nil]
1002
+ def vpc
1003
+ if data.vpc_id
1004
+ Vpc.new(
1005
+ id: data.vpc_id,
1006
+ client: @client
1007
+ )
1008
+ else
1009
+ nil
1012
1010
  end
1013
- deprecated(:identifiers)
1011
+ end
1012
+
1013
+ # @deprecated
1014
+ # @api private
1015
+ def identifiers
1016
+ { id: @id }
1017
+ end
1018
+ deprecated(:identifiers)
1014
1019
 
1015
- private
1020
+ private
1016
1021
 
1017
- def extract_id(args, options)
1018
- value = args[0] || options.delete(:id)
1019
- case value
1020
- when String then value
1021
- when nil then raise ArgumentError, "missing required option :id"
1022
- else
1023
- msg = "expected :id to be a String, got #{value.class}"
1024
- raise ArgumentError, msg
1025
- end
1022
+ def extract_id(args, options)
1023
+ value = args[0] || options.delete(:id)
1024
+ case value
1025
+ when String then value
1026
+ when nil then raise ArgumentError, "missing required option :id"
1027
+ else
1028
+ msg = "expected :id to be a String, got #{value.class}"
1029
+ raise ArgumentError, msg
1026
1030
  end
1027
-
1028
- class Collection < Aws::Resources::Collection; end
1029
1031
  end
1032
+
1033
+ class Collection < Aws::Resources::Collection; end
1030
1034
  end
1031
1035
  end