aws-sdk 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/aws/api_config/EC2-2012-06-01.yml +0 -1
- data/lib/aws/core.rb +1 -1
- data/lib/aws/ec2/client.rb +1 -1
- data/lib/aws/ec2/elastic_ip.rb +59 -8
- data/lib/aws/ec2/instance_collection.rb +1 -1
- metadata +3 -3
data/lib/aws/core.rb
CHANGED
data/lib/aws/ec2/client.rb
CHANGED
@@ -103,7 +103,7 @@ module AWS
|
|
103
103
|
#
|
104
104
|
# === Options:
|
105
105
|
#
|
106
|
-
# * +:instance_id+ -
|
106
|
+
# * +:instance_id+ - (String) The instance to associate with
|
107
107
|
# the IP address.
|
108
108
|
# * +:public_ip+ - (String) IP address that you are assigning to the
|
109
109
|
# instance.
|
data/lib/aws/ec2/elastic_ip.rb
CHANGED
@@ -21,13 +21,14 @@ module AWS
|
|
21
21
|
# The ID representing the allocation of the address for use with Amazon
|
22
22
|
# VPC.
|
23
23
|
#
|
24
|
-
# @attr_reader [String] Indicates whether this elastic ip address
|
25
|
-
# EC2 instances ('standard') or VPC instances ('vpc').
|
24
|
+
# @attr_reader [String] domain Indicates whether this elastic ip address
|
25
|
+
# is for EC2 instances ('standard') or VPC instances ('vpc').
|
26
26
|
#
|
27
|
-
# @attr_reader [String,nil] The ID of the association
|
28
|
-
# ip address and an EC2 VPC instance (VPC only).
|
27
|
+
# @attr_reader [String,nil] association_id The ID of the association
|
28
|
+
# between this elastic ip address and an EC2 VPC instance (VPC only).
|
29
29
|
#
|
30
|
-
# @attr_reader [String,nil] The ID of the network
|
30
|
+
# @attr_reader [String,nil] network_interface_id The ID of the network
|
31
|
+
# interface (VPC only).
|
31
32
|
#
|
32
33
|
# @attr_reader [String,nil] network_interface_owner_id
|
33
34
|
# The ID of the AWS account that owns the network interface (VPC only).
|
@@ -67,10 +68,10 @@ module AWS
|
|
67
68
|
domain == 'vpc'
|
68
69
|
end
|
69
70
|
|
70
|
-
# @return [Boolean] Returns true if this IP address is
|
71
|
-
# an EC2 instance.
|
71
|
+
# @return [Boolean] Returns true if this IP address is associated
|
72
|
+
# with an EC2 instance or a network interface.
|
72
73
|
def associated?
|
73
|
-
!!instance_id
|
74
|
+
!!(instance_id || association_id)
|
74
75
|
end
|
75
76
|
|
76
77
|
alias_method :attached?, :associated?
|
@@ -83,6 +84,15 @@ module AWS
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
87
|
+
# @return [NetworkInterface,nil] Returns the network interface this
|
88
|
+
# elastic ip is associated with. Returns +nil+ if this is not
|
89
|
+
# associated with an elastic ip address.
|
90
|
+
def network_interface
|
91
|
+
if nid = network_interface_id
|
92
|
+
NetworkInterface.new(nid, :config => config)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
86
96
|
# Releases the elastic IP address.
|
87
97
|
#
|
88
98
|
# (For non-VPC elastic ips) Releasing an IP address automatically
|
@@ -99,6 +109,47 @@ module AWS
|
|
99
109
|
end
|
100
110
|
alias_method :release, :delete
|
101
111
|
|
112
|
+
# Associates this elastic IP address with an instance or a network
|
113
|
+
# interface. You may provide +:instance+ or +:network_interface+
|
114
|
+
# but not both options.
|
115
|
+
#
|
116
|
+
# # associate with an instance
|
117
|
+
# eip.associate :instance => 'i-12345678'
|
118
|
+
#
|
119
|
+
# # associate with a network interface
|
120
|
+
# eip.associate :network_interface => 'ni-12345678'
|
121
|
+
#
|
122
|
+
# @param [Hash] options
|
123
|
+
#
|
124
|
+
# @option options [String,Instance] :instance The id of an instance
|
125
|
+
# or an {Instance} object.
|
126
|
+
#
|
127
|
+
# @option options [String,NetworkInterface] :network_interface The id
|
128
|
+
# of a network interface or a {NetworkInterface} object.
|
129
|
+
#
|
130
|
+
# @return [String] Returns the resulting association id.
|
131
|
+
#
|
132
|
+
def associate options
|
133
|
+
|
134
|
+
client_opts = {}
|
135
|
+
|
136
|
+
[:instance,:network_interface].each do |opt|
|
137
|
+
if value = options[opt]
|
138
|
+
client_opts[:"#{opt}_id"] = value.is_a?(Resource) ? value.id : value
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
if vpc?
|
143
|
+
client_opts[:allocation_id] = allocation_id
|
144
|
+
else
|
145
|
+
client_opts[:public_ip] = public_ip
|
146
|
+
end
|
147
|
+
|
148
|
+
resp = client.associate_address(client_opts)
|
149
|
+
resp.data[:association_id]
|
150
|
+
|
151
|
+
end
|
152
|
+
|
102
153
|
# Disassociates this elastic IP address from an EC2 instance.
|
103
154
|
# Raises an exception if this elastic IP is not currently
|
104
155
|
# associated with an instance.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuidtools
|
@@ -490,7 +490,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
490
490
|
version: '0'
|
491
491
|
segments:
|
492
492
|
- 0
|
493
|
-
hash: -
|
493
|
+
hash: -1968762056350445253
|
494
494
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
495
495
|
none: false
|
496
496
|
requirements:
|