Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master', remote-tracking branch 'fog/master'

  • Loading branch information...
commit 54913507fac15b8aba92a228c556943a33d2fe65 2 parents eb55451 + 1886bde
Ming Jin authored
View
3  lib/fog/aws/models/compute/address.rb
@@ -9,6 +9,7 @@ class Address < Fog::Model
identity :public_ip, :aliases => 'publicIp'
attribute :server_id, :aliases => 'instanceId'
+ attribute :domain
def initialize(attributes = {})
# assign server first to prevent race condition with new_record?
@@ -33,7 +34,7 @@ def server=(new_server)
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
- data = connection.allocate_address.body
+ data = connection.allocate_address(domain).body
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
if @server
View
2  lib/fog/aws/parsers/compute/allocate_address.rb
@@ -7,7 +7,7 @@ class AllocateAddress < Fog::Parsers::Base
def end_element(name)
case name
- when 'publicIp', 'requestId'
+ when 'publicIp', 'requestId', 'domain', 'allocationId'
@response[name] = value
end
end
View
2  lib/fog/aws/parsers/compute/describe_addresses.rb
@@ -12,7 +12,7 @@ def reset
def end_element(name)
case name
- when 'instanceId', 'publicIp'
+ when 'instanceId', 'publicIp', 'domain', 'allocationId'
@address[name] = value
when 'item'
@response['addressesSet'] << @address
View
9 lib/fog/aws/requests/compute/allocate_address.rb
@@ -7,6 +7,8 @@ class Real
# Acquire an elastic IP address.
#
+ # ==== Parameters
+ # * domain<~String> - Type of EIP, either standard or vpc
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
@@ -14,9 +16,11 @@ class Real
# * 'requestId'<~String> - Id of the request
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html]
- def allocate_address
+ def allocate_address(domain='standard')
+ domain = domain == 'vpc' ? 'vpc' : 'standard'
request(
'Action' => 'AllocateAddress',
+ 'Domain' => domain,
:parser => Fog::Parsers::Compute::AWS::AllocateAddress.new
)
end
@@ -25,7 +29,7 @@ def allocate_address
class Mock
- def allocate_address
+ def allocate_address(domain = 'standard')
response = Excon::Response.new
if describe_addresses.body['addressesSet'].size < self.data[:limits][:addresses]
response.status = 200
@@ -36,6 +40,7 @@ def allocate_address
}
self.data[:addresses][public_ip] = data
response.body = {
+ 'domain' => standard,
'publicIp' => public_ip,
'requestId' => Fog::AWS::Mock.request_id
}
View
13 lib/fog/aws/requests/storage/head_object.rb
@@ -43,12 +43,13 @@ def head_object(bucket_name, object_name, options={})
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
headers.merge!(options)
request({
- :expects => 200,
- :headers => headers,
- :host => "#{bucket_name}.#{@host}",
- :method => 'HEAD',
- :path => CGI.escape(object_name),
- :query => query
+ :expects => 200,
+ :headers => headers,
+ :host => "#{bucket_name}.#{@host}",
+ :idempotent => true,
+ :method => 'HEAD',
+ :path => CGI.escape(object_name),
+ :query => query
})
end
View
11 lib/fog/rackspace/requests/storage/put_object.rb
@@ -15,11 +15,12 @@ def put_object(container, object, data, options = {})
data = Fog::Storage.parse_data(data)
headers = data[:headers].merge!(options)
request(
- :body => data[:body],
- :expects => 201,
- :headers => headers,
- :method => 'PUT',
- :path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
+ :body => data[:body],
+ :expects => 201,
+ :idempotent => true,
+ :headers => headers,
+ :method => 'PUT',
+ :path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
)
end
View
8 tests/aws/requests/compute/address_tests.rb
@@ -2,8 +2,10 @@
@addresses_format = {
'addressesSet' => [{
- 'instanceId' => NilClass,
- 'publicIp' => String
+ 'allocationId' => Fog::Nullable::String,
+ 'domain' => String,
+ 'instanceId' => Fog::Nullable::String,
+ 'publicIp' => String
}],
'requestId' => String
}
@@ -16,7 +18,7 @@
@public_ip = nil
- tests('#allocate_address').formats({'publicIp' => String, 'requestId' => String}) do
+ tests('#allocate_address').formats({'domain' => String, 'publicIp' => String, 'requestId' => String}) do
data = Fog::Compute[:aws].allocate_address.body
@public_ip = data['publicIp']
data
Please sign in to comment.
Something went wrong with that request. Please try again.