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,474 @@
|
|
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 NetworkInterface
|
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 :network_interface_id :id
|
34
|
+
|
35
|
+
# The ID of the subnet.
|
36
|
+
# @return [String]
|
37
|
+
def subnet_id
|
38
|
+
data.subnet_id
|
39
|
+
end
|
40
|
+
|
41
|
+
# The ID of the VPC.
|
42
|
+
# @return [String]
|
43
|
+
def vpc_id
|
44
|
+
data.vpc_id
|
45
|
+
end
|
46
|
+
|
47
|
+
# The Availability Zone.
|
48
|
+
# @return [String]
|
49
|
+
def availability_zone
|
50
|
+
data.availability_zone
|
51
|
+
end
|
52
|
+
|
53
|
+
# A description.
|
54
|
+
# @return [String]
|
55
|
+
def description
|
56
|
+
data.description
|
57
|
+
end
|
58
|
+
|
59
|
+
# The AWS account ID of the owner of the network interface.
|
60
|
+
# @return [String]
|
61
|
+
def owner_id
|
62
|
+
data.owner_id
|
63
|
+
end
|
64
|
+
|
65
|
+
# The ID of the entity that launched the instance on your behalf (for
|
66
|
+
# example, AWS Management Console or Auto Scaling).
|
67
|
+
# @return [String]
|
68
|
+
def requester_id
|
69
|
+
data.requester_id
|
70
|
+
end
|
71
|
+
|
72
|
+
# Indicates whether the network interface is being managed by AWS.
|
73
|
+
# @return [Boolean]
|
74
|
+
def requester_managed
|
75
|
+
data.requester_managed
|
76
|
+
end
|
77
|
+
|
78
|
+
# The status of the network interface.
|
79
|
+
# @return [String]
|
80
|
+
def status
|
81
|
+
data.status
|
82
|
+
end
|
83
|
+
|
84
|
+
# The MAC address.
|
85
|
+
# @return [String]
|
86
|
+
def mac_address
|
87
|
+
data.mac_address
|
88
|
+
end
|
89
|
+
|
90
|
+
# The IP address of the network interface within the subnet.
|
91
|
+
# @return [String]
|
92
|
+
def private_ip_address
|
93
|
+
data.private_ip_address
|
94
|
+
end
|
95
|
+
|
96
|
+
# The private DNS name.
|
97
|
+
# @return [String]
|
98
|
+
def private_dns_name
|
99
|
+
data.private_dns_name
|
100
|
+
end
|
101
|
+
|
102
|
+
# Indicates whether traffic to or from the instance is validated.
|
103
|
+
# @return [Boolean]
|
104
|
+
def source_dest_check
|
105
|
+
data.source_dest_check
|
106
|
+
end
|
107
|
+
|
108
|
+
# Any security groups for the network interface.
|
109
|
+
# @return [Array<Types::GroupIdentifier>]
|
110
|
+
def groups
|
111
|
+
data.groups
|
112
|
+
end
|
113
|
+
|
114
|
+
# The network interface attachment.
|
115
|
+
# @return [Types::NetworkInterfaceAttachment]
|
116
|
+
def attachment
|
117
|
+
data.attachment
|
118
|
+
end
|
119
|
+
|
120
|
+
# Any tags assigned to the network interface.
|
121
|
+
# @return [Array<Types::Tag>]
|
122
|
+
def tag_set
|
123
|
+
data.tag_set
|
124
|
+
end
|
125
|
+
|
126
|
+
# The private IP addresses associated with the network interface.
|
127
|
+
# @return [Array<Types::NetworkInterfacePrivateIpAddress>]
|
128
|
+
def private_ip_addresses
|
129
|
+
data.private_ip_addresses
|
130
|
+
end
|
131
|
+
|
132
|
+
# The type of interface.
|
133
|
+
# @return [String]
|
134
|
+
def interface_type
|
135
|
+
data.interface_type
|
136
|
+
end
|
137
|
+
|
138
|
+
# @!endgroup
|
139
|
+
|
140
|
+
# @return [Client]
|
141
|
+
def client
|
142
|
+
@client
|
143
|
+
end
|
144
|
+
|
145
|
+
# Loads, or reloads {#data} for the current {NetworkInterface}.
|
146
|
+
# Returns `self` making it possible to chain methods.
|
147
|
+
#
|
148
|
+
# network_interface.reload.data
|
149
|
+
#
|
150
|
+
# @return [self]
|
151
|
+
def load
|
152
|
+
resp = @client.describe_network_interfaces(network_interface_ids: [@id])
|
153
|
+
@data = resp.networkinterfaces[0]
|
154
|
+
self
|
155
|
+
end
|
156
|
+
alias :reload :load
|
157
|
+
|
158
|
+
# @return [Types::NetworkInterface]
|
159
|
+
# Returns the data for this {NetworkInterface}. Calls
|
160
|
+
# {Client#describe_network_interfaces} if {#data_loaded?} is `false`.
|
161
|
+
def data
|
162
|
+
load unless @data
|
163
|
+
@data
|
164
|
+
end
|
165
|
+
|
166
|
+
# @return [Boolean]
|
167
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
168
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
169
|
+
def data_loaded?
|
170
|
+
!!@data
|
171
|
+
end
|
172
|
+
|
173
|
+
# @!group Actions
|
174
|
+
|
175
|
+
# @example Request syntax with placeholder values
|
176
|
+
#
|
177
|
+
# network_interface.assign_private_ip_addresses({
|
178
|
+
# private_ip_addresses: ["String"],
|
179
|
+
# secondary_private_ip_address_count: 1,
|
180
|
+
# allow_reassignment: false,
|
181
|
+
# })
|
182
|
+
# @param [Hash] options ({})
|
183
|
+
# @option options [Array<String>] :private_ip_addresses
|
184
|
+
# One or more IP addresses to be assigned as a secondary private IP
|
185
|
+
# address to the network interface. You can't specify this parameter
|
186
|
+
# when also specifying a number of secondary IP addresses.
|
187
|
+
#
|
188
|
+
# If you don't specify an IP address, Amazon EC2 automatically selects
|
189
|
+
# an IP address within the subnet range.
|
190
|
+
# @option options [Integer] :secondary_private_ip_address_count
|
191
|
+
# The number of secondary IP addresses to assign to the network
|
192
|
+
# interface. You can't specify this parameter when also specifying
|
193
|
+
# private IP addresses.
|
194
|
+
# @option options [Boolean] :allow_reassignment
|
195
|
+
# Indicates whether to allow an IP address that is already assigned to
|
196
|
+
# another network interface or instance to be reassigned to the
|
197
|
+
# specified network interface.
|
198
|
+
# @return [EmptyStructure]
|
199
|
+
def assign_private_ip_addresses(options = {})
|
200
|
+
options = options.merge(network_interface_id: @id)
|
201
|
+
resp = @client.assign_private_ip_addresses(options)
|
202
|
+
resp.data
|
203
|
+
end
|
204
|
+
|
205
|
+
# @example Request syntax with placeholder values
|
206
|
+
#
|
207
|
+
# network_interface.attach({
|
208
|
+
# dry_run: false,
|
209
|
+
# instance_id: "String", # required
|
210
|
+
# device_index: 1, # required
|
211
|
+
# })
|
212
|
+
# @param [Hash] options ({})
|
213
|
+
# @option options [Boolean] :dry_run
|
214
|
+
# Checks whether you have the required permissions for the action,
|
215
|
+
# without actually making the request, and provides an error response.
|
216
|
+
# If you have the required permissions, the error response is
|
217
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
218
|
+
# @option options [required, String] :instance_id
|
219
|
+
# The ID of the instance.
|
220
|
+
# @option options [required, Integer] :device_index
|
221
|
+
# The index of the device for the network interface attachment.
|
222
|
+
# @return [Types::AttachNetworkInterfaceResult]
|
223
|
+
def attach(options = {})
|
224
|
+
options = options.merge(network_interface_id: @id)
|
225
|
+
resp = @client.attach_network_interface(options)
|
226
|
+
resp.data
|
227
|
+
end
|
228
|
+
|
229
|
+
# @example Request syntax with placeholder values
|
230
|
+
#
|
231
|
+
# tag = network_interface.create_tags({
|
232
|
+
# dry_run: false,
|
233
|
+
# tags: [ # required
|
234
|
+
# {
|
235
|
+
# key: "String",
|
236
|
+
# value: "String",
|
237
|
+
# },
|
238
|
+
# ],
|
239
|
+
# })
|
240
|
+
# @param [Hash] options ({})
|
241
|
+
# @option options [Boolean] :dry_run
|
242
|
+
# Checks whether you have the required permissions for the action,
|
243
|
+
# without actually making the request, and provides an error response.
|
244
|
+
# If you have the required permissions, the error response is
|
245
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
246
|
+
# @option options [required, Array<Types::Tag>] :tags
|
247
|
+
# One or more tags. The `value` parameter is required, but if you don't
|
248
|
+
# want the tag to have a value, specify the parameter with no value, and
|
249
|
+
# we set the value to an empty string.
|
250
|
+
# @return [Tag::Collection]
|
251
|
+
def create_tags(options = {})
|
252
|
+
batch = []
|
253
|
+
options = Aws::Util.deep_merge(options, resources: [@id])
|
254
|
+
resp = @client.create_tags(options)
|
255
|
+
options[:tags].each do |t|
|
256
|
+
batch << Tag.new(
|
257
|
+
resource_id: @id,
|
258
|
+
key: t[:key],
|
259
|
+
value: t[:value],
|
260
|
+
client: @client
|
261
|
+
)
|
262
|
+
end
|
263
|
+
Tag::Collection.new([batch], size: batch.size)
|
264
|
+
end
|
265
|
+
|
266
|
+
# @example Request syntax with placeholder values
|
267
|
+
#
|
268
|
+
# network_interface.delete({
|
269
|
+
# dry_run: false,
|
270
|
+
# })
|
271
|
+
# @param [Hash] options ({})
|
272
|
+
# @option options [Boolean] :dry_run
|
273
|
+
# Checks whether you have the required permissions for the action,
|
274
|
+
# without actually making the request, and provides an error response.
|
275
|
+
# If you have the required permissions, the error response is
|
276
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
277
|
+
# @return [EmptyStructure]
|
278
|
+
def delete(options = {})
|
279
|
+
options = options.merge(network_interface_id: @id)
|
280
|
+
resp = @client.delete_network_interface(options)
|
281
|
+
resp.data
|
282
|
+
end
|
283
|
+
|
284
|
+
# @example Request syntax with placeholder values
|
285
|
+
#
|
286
|
+
# network_interface.describe_attribute({
|
287
|
+
# dry_run: false,
|
288
|
+
# attribute: "description", # accepts description, groupSet, sourceDestCheck, attachment
|
289
|
+
# })
|
290
|
+
# @param [Hash] options ({})
|
291
|
+
# @option options [Boolean] :dry_run
|
292
|
+
# Checks whether you have the required permissions for the action,
|
293
|
+
# without actually making the request, and provides an error response.
|
294
|
+
# If you have the required permissions, the error response is
|
295
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
296
|
+
# @option options [String] :attribute
|
297
|
+
# The attribute of the network interface.
|
298
|
+
# @return [Types::DescribeNetworkInterfaceAttributeResult]
|
299
|
+
def describe_attribute(options = {})
|
300
|
+
options = options.merge(network_interface_id: @id)
|
301
|
+
resp = @client.describe_network_interface_attribute(options)
|
302
|
+
resp.data
|
303
|
+
end
|
304
|
+
|
305
|
+
# @example Request syntax with placeholder values
|
306
|
+
#
|
307
|
+
# network_interface.detach({
|
308
|
+
# dry_run: false,
|
309
|
+
# force: false,
|
310
|
+
# })
|
311
|
+
# @param [Hash] options ({})
|
312
|
+
# @option options [Boolean] :dry_run
|
313
|
+
# Checks whether you have the required permissions for the action,
|
314
|
+
# without actually making the request, and provides an error response.
|
315
|
+
# If you have the required permissions, the error response is
|
316
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
317
|
+
# @option options [Boolean] :force
|
318
|
+
# Specifies whether to force a detachment.
|
319
|
+
# @return [EmptyStructure]
|
320
|
+
def detach(options = {})
|
321
|
+
options = options.merge(attachment_id: data.attachment.attachment_id)
|
322
|
+
resp = @client.detach_network_interface(options)
|
323
|
+
resp.data
|
324
|
+
end
|
325
|
+
|
326
|
+
# @example Request syntax with placeholder values
|
327
|
+
#
|
328
|
+
# network_interface.modify_attribute({
|
329
|
+
# dry_run: false,
|
330
|
+
# description: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
331
|
+
# source_dest_check: {
|
332
|
+
# value: false,
|
333
|
+
# },
|
334
|
+
# groups: ["String"],
|
335
|
+
# attachment: {
|
336
|
+
# attachment_id: "String",
|
337
|
+
# delete_on_termination: false,
|
338
|
+
# },
|
339
|
+
# })
|
340
|
+
# @param [Hash] options ({})
|
341
|
+
# @option options [Boolean] :dry_run
|
342
|
+
# Checks whether you have the required permissions for the action,
|
343
|
+
# without actually making the request, and provides an error response.
|
344
|
+
# If you have the required permissions, the error response is
|
345
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
346
|
+
# @option options [Types::AttributeValue] :description
|
347
|
+
# A description for the network interface.
|
348
|
+
# @option options [Types::AttributeBooleanValue] :source_dest_check
|
349
|
+
# Indicates whether source/destination checking is enabled. A value of
|
350
|
+
# `true` means checking is enabled, and `false` means checking is
|
351
|
+
# disabled. This value must be `false` for a NAT instance to perform
|
352
|
+
# NAT. For more information, see [NAT Instances][1] in the *Amazon
|
353
|
+
# Virtual Private Cloud User Guide*.
|
354
|
+
#
|
355
|
+
#
|
356
|
+
#
|
357
|
+
# [1]: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html
|
358
|
+
# @option options [Array<String>] :groups
|
359
|
+
# Changes the security groups for the network interface. The new set of
|
360
|
+
# groups you specify replaces the current set. You must specify at least
|
361
|
+
# one group, even if it's just the default security group in the VPC.
|
362
|
+
# You must specify the ID of the security group, not the name.
|
363
|
+
# @option options [Types::NetworkInterfaceAttachmentChanges] :attachment
|
364
|
+
# Information about the interface attachment. If modifying the 'delete
|
365
|
+
# on termination' attribute, you must specify the ID of the interface
|
366
|
+
# attachment.
|
367
|
+
# @return [EmptyStructure]
|
368
|
+
def modify_attribute(options = {})
|
369
|
+
options = options.merge(network_interface_id: @id)
|
370
|
+
resp = @client.modify_network_interface_attribute(options)
|
371
|
+
resp.data
|
372
|
+
end
|
373
|
+
|
374
|
+
# @example Request syntax with placeholder values
|
375
|
+
#
|
376
|
+
# network_interface.reset_attribute({
|
377
|
+
# dry_run: false,
|
378
|
+
# source_dest_check: "String",
|
379
|
+
# })
|
380
|
+
# @param [Hash] options ({})
|
381
|
+
# @option options [Boolean] :dry_run
|
382
|
+
# Checks whether you have the required permissions for the action,
|
383
|
+
# without actually making the request, and provides an error response.
|
384
|
+
# If you have the required permissions, the error response is
|
385
|
+
# `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
|
386
|
+
# @option options [String] :source_dest_check
|
387
|
+
# The source/destination checking attribute. Resets the value to `true`.
|
388
|
+
# @return [EmptyStructure]
|
389
|
+
def reset_attribute(options = {})
|
390
|
+
options = options.merge(network_interface_id: @id)
|
391
|
+
resp = @client.reset_network_interface_attribute(options)
|
392
|
+
resp.data
|
393
|
+
end
|
394
|
+
|
395
|
+
# @example Request syntax with placeholder values
|
396
|
+
#
|
397
|
+
# network_interface.unassign_private_ip_addresses({
|
398
|
+
# private_ip_addresses: ["String"], # required
|
399
|
+
# })
|
400
|
+
# @param [Hash] options ({})
|
401
|
+
# @option options [required, Array<String>] :private_ip_addresses
|
402
|
+
# The secondary private IP addresses to unassign from the network
|
403
|
+
# interface. You can specify this option multiple times to unassign more
|
404
|
+
# than one IP address.
|
405
|
+
# @return [EmptyStructure]
|
406
|
+
def unassign_private_ip_addresses(options = {})
|
407
|
+
options = options.merge(network_interface_id: @id)
|
408
|
+
resp = @client.unassign_private_ip_addresses(options)
|
409
|
+
resp.data
|
410
|
+
end
|
411
|
+
|
412
|
+
# @!group Associations
|
413
|
+
|
414
|
+
# @return [NetworkInterfaceAssociation, nil]
|
415
|
+
def association
|
416
|
+
if data.association.association_id
|
417
|
+
NetworkInterfaceAssociation.new(
|
418
|
+
id: data.association.association_id,
|
419
|
+
data: data.association,
|
420
|
+
client: @client
|
421
|
+
)
|
422
|
+
else
|
423
|
+
nil
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
# @return [Subnet, nil]
|
428
|
+
def subnet
|
429
|
+
if data.subnet_id
|
430
|
+
Subnet.new(
|
431
|
+
id: data.subnet_id,
|
432
|
+
client: @client
|
433
|
+
)
|
434
|
+
else
|
435
|
+
nil
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
# @return [Vpc, nil]
|
440
|
+
def vpc
|
441
|
+
if data.vpc_id
|
442
|
+
Vpc.new(
|
443
|
+
id: data.vpc_id,
|
444
|
+
client: @client
|
445
|
+
)
|
446
|
+
else
|
447
|
+
nil
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
451
|
+
# @deprecated
|
452
|
+
# @api private
|
453
|
+
def identifiers
|
454
|
+
{ id: @id }
|
455
|
+
end
|
456
|
+
deprecated(:identifiers)
|
457
|
+
|
458
|
+
private
|
459
|
+
|
460
|
+
def extract_id(args, options)
|
461
|
+
value = args[0] || options.delete(:id)
|
462
|
+
case value
|
463
|
+
when String then value
|
464
|
+
when nil then raise ArgumentError, "missing required option :id"
|
465
|
+
else
|
466
|
+
msg = "expected :id to be a String, got #{value.class}"
|
467
|
+
raise ArgumentError, msg
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
class Collection < Aws::Resources::Collection; end
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|