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