gapinc-fog 1.12.1.1 → 1.12.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -7
- data/bin/fog +22 -0
- data/fog.gemspec +1 -1
- data/lib/fog/aws.rb +11 -0
- data/lib/fog/aws/auto_scaling.rb +13 -18
- data/lib/fog/aws/beanstalk.rb +8 -10
- data/lib/fog/aws/cloud_formation.rb +9 -12
- data/lib/fog/aws/compute.rb +8 -10
- data/lib/fog/aws/credential_fetcher.rb +6 -6
- data/lib/fog/aws/elasticache.rb +13 -17
- data/lib/fog/aws/elb.rb +29 -31
- data/lib/fog/aws/iam.rb +10 -13
- data/lib/fog/aws/models/rds/server.rb +3 -1
- data/lib/fog/aws/models/rds/snapshot.rb +1 -0
- data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
- data/lib/fog/aws/parsers/ses/verify_domain_identity.rb +26 -0
- data/lib/fog/aws/rds.rb +19 -14
- data/lib/fog/aws/requests/compute/create_volume.rb +3 -3
- data/lib/fog/aws/requests/rds/create_db_instance.rb +3 -1
- data/lib/fog/aws/requests/ses/verify_domain_identity.rb +30 -0
- data/lib/fog/aws/ses.rb +1 -0
- data/lib/fog/aws/storage.rb +2 -1
- data/lib/fog/aws/sts.rb +9 -15
- data/lib/fog/core.rb +7 -2
- data/lib/fog/core/connection.rb +62 -29
- data/lib/fog/core/deprecated/connection.rb +24 -0
- data/lib/fog/core/parser.rb +1 -1
- data/lib/fog/google/compute.rb +31 -7
- data/lib/fog/google/models/compute/disk.rb +80 -0
- data/lib/fog/google/models/compute/disks.rb +28 -0
- data/lib/fog/google/models/compute/image.rb +36 -0
- data/lib/fog/google/models/compute/server.rb +46 -33
- data/lib/fog/google/models/compute/servers.rb +15 -8
- data/lib/fog/google/requests/compute/delete_server.rb +5 -2
- data/lib/fog/google/requests/compute/get_disk.rb +3 -0
- data/lib/fog/google/requests/compute/get_server.rb +7 -1
- data/lib/fog/google/requests/compute/insert_disk.rb +8 -2
- data/lib/fog/google/requests/compute/insert_server.rb +51 -22
- data/lib/fog/google/requests/compute/list_machine_types.rb +3 -2
- data/lib/fog/hp/storage.rb +26 -9
- data/lib/fog/{core/json.rb → json.rb} +13 -2
- data/lib/fog/openstack/models/compute/metadata.rb +1 -1
- data/lib/fog/openstack/models/image/images.rb +1 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +2 -1
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +1 -1
- data/lib/fog/rackspace.rb +5 -0
- data/lib/fog/rackspace/block_storage.rb +13 -28
- data/lib/fog/rackspace/cdn.rb +10 -24
- data/lib/fog/rackspace/compute.rb +17 -45
- data/lib/fog/rackspace/compute_v2.rb +13 -33
- data/lib/fog/rackspace/databases.rb +13 -29
- data/lib/fog/rackspace/dns.rb +20 -22
- data/lib/fog/rackspace/identity.rb +10 -26
- data/lib/fog/rackspace/load_balancers.rb +13 -29
- data/lib/fog/rackspace/mock_data.rb +3 -3
- data/lib/fog/rackspace/models/compute/server.rb +1 -1
- data/lib/fog/rackspace/models/identity/users.rb +2 -2
- data/lib/fog/rackspace/models/storage/file.rb +1 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +3 -1
- data/lib/fog/rackspace/service.rb +43 -1
- data/lib/fog/rackspace/storage.rb +9 -31
- data/lib/fog/xenserver/compute.rb +2 -0
- data/lib/fog/xenserver/models/compute/server.rb +9 -7
- data/lib/fog/xenserver/requests/compute/snapshot_revert.rb +22 -0
- data/lib/fog/xenserver/requests/compute/snapshot_server.rb +22 -0
- data/lib/fog/xml.rb +21 -0
- data/lib/fog/xml/sax_parser_connection.rb +43 -0
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/helper.rb +1 -0
- data/tests/aws/requests/ses/verified_domain_identity_tests.rb +16 -0
- data/tests/core/connection_tests.rb +26 -0
- data/tests/helper.rb +9 -7
- data/tests/rackspace/block_storage_tests.rb +9 -0
- data/tests/rackspace/compute_tests.rb +9 -0
- data/tests/rackspace/compute_v2_tests.rb +9 -0
- data/tests/rackspace/databases_tests.rb +9 -0
- data/tests/rackspace/dns_tests.rb +9 -0
- data/tests/rackspace/helper.rb +12 -1
- data/tests/rackspace/identity_tests.rb +25 -0
- data/tests/rackspace/load_balancer_tests.rb +10 -0
- data/tests/rackspace/models/block_storage/volume_tests.rb +2 -2
- data/tests/rackspace/models/compute_v2/metadata_tests.rb +2 -2
- data/tests/rackspace/models/compute_v2/server_tests.rb +22 -21
- data/tests/rackspace/models/storage/file_tests.rb +22 -6
- data/tests/rackspace/rackspace_tests.rb +35 -0
- data/tests/rackspace/requests/block_storage/snapshot_tests.rb +2 -3
- data/tests/rackspace/requests/block_storage/volume_type_tests.rb +4 -11
- data/tests/rackspace/requests/compute_v2/address_tests.rb +1 -1
- data/tests/rackspace/requests/compute_v2/attachment_tests.rb +8 -9
- data/tests/rackspace/requests/compute_v2/flavor_tests.rb +1 -1
- data/tests/rackspace/requests/compute_v2/metadata_tests.rb +4 -4
- data/tests/rackspace/requests/databases/database_tests.rb +23 -20
- data/tests/rackspace/requests/databases/user_tests.rb +6 -6
- data/tests/rackspace/requests/identity/user_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/usage_tests.rb +4 -2
- data/tests/rackspace/service_tests.rb +83 -0
- data/tests/rackspace/storage_tests.rb +9 -0
- data/tests/xenserver/models/compute/server_tests.rb +11 -1
- metadata +19 -4
- data/tests/core/user_agent_tests.rb +0 -6
@@ -12,10 +12,11 @@ module Fog
|
|
12
12
|
|
13
13
|
class Real
|
14
14
|
|
15
|
-
def list_machine_types
|
15
|
+
def list_machine_types(zone_name)
|
16
16
|
api_method = @compute.machine_types.list
|
17
17
|
parameters = {
|
18
|
-
'project' =>
|
18
|
+
'project' => @project,
|
19
|
+
'zone' => zone_name,
|
19
20
|
}
|
20
21
|
|
21
22
|
result = self.build_result(api_method, parameters)
|
data/lib/fog/hp/storage.rb
CHANGED
@@ -10,8 +10,11 @@ module Fog
|
|
10
10
|
recognizes :persistent, :connection_options
|
11
11
|
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
12
12
|
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
13
|
+
|
14
|
+
# :os_account_meta_temp_url_key is an OpenStack specific setting used to generate temporary urls.
|
15
|
+
recognizes :os_account_meta_temp_url_key
|
13
16
|
|
14
|
-
secrets :hp_secret_key
|
17
|
+
secrets :hp_secret_key, :os_account_meta_temp_url_key
|
15
18
|
|
16
19
|
model_path 'fog/hp/models/storage'
|
17
20
|
model :directory
|
@@ -167,14 +170,26 @@ module Fog
|
|
167
170
|
encoded_path = "#{path}/#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
168
171
|
|
169
172
|
string_to_sign = "#{method}\n#{expires}\n#{sig_path}"
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
173
|
+
|
174
|
+
signature = nil
|
175
|
+
|
176
|
+
# HP uses a different strategy to create the signature that is passed to swift than OpenStack.
|
177
|
+
# As the HP provider is broadly used by OpenStack users the OpenStack strategy is applied when
|
178
|
+
# the @os_account_meta_temp_url_key is given.
|
179
|
+
if @os_account_meta_temp_url_key then
|
180
|
+
hmac = OpenSSL::HMAC.new(@os_account_meta_temp_url_key, OpenSSL::Digest::SHA1.new)
|
181
|
+
signature= hmac.update(string_to_sign).hexdigest
|
182
|
+
else
|
183
|
+
# Only works with 1.9+ Not compatible with 1.8.7
|
184
|
+
#signed_string = Digest::HMAC.hexdigest(string_to_sign, @hp_secret_key, Digest::SHA1)
|
185
|
+
|
186
|
+
# Compatible with 1.8.7 onwards
|
187
|
+
hmac = OpenSSL::HMAC.new(@hp_secret_key, OpenSSL::Digest::SHA1.new)
|
188
|
+
signed_string = hmac.update(string_to_sign).hexdigest
|
189
|
+
|
190
|
+
signature = @hp_tenant_id.to_s + ":" + @hp_access_key.to_s + ":" + signed_string
|
191
|
+
signature = Fog::HP.escape(signature)
|
192
|
+
end
|
178
193
|
|
179
194
|
# generate the temp url using the signature and expiry
|
180
195
|
"#{scheme}://#{host}:#{port}#{encoded_path}?temp_url_sig=#{signature}&temp_url_expires=#{expires}"
|
@@ -217,6 +232,7 @@ module Fog
|
|
217
232
|
end
|
218
233
|
@hp_secret_key = options[:hp_secret_key]
|
219
234
|
@hp_tenant_id = options[:hp_tenant_id]
|
235
|
+
@os_account_meta_temp_url_key = options[:os_account_meta_temp_url_key]
|
220
236
|
end
|
221
237
|
|
222
238
|
def data
|
@@ -254,6 +270,7 @@ module Fog
|
|
254
270
|
options[:hp_service_type] = "Object Storage"
|
255
271
|
@hp_tenant_id = options[:hp_tenant_id]
|
256
272
|
@hp_avl_zone = options[:hp_avl_zone]
|
273
|
+
@os_account_meta_temp_url_key = options[:os_account_meta_temp_url_key]
|
257
274
|
|
258
275
|
### Make the authentication call
|
259
276
|
if (auth_version == :v2)
|
@@ -1,6 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require "multi_json"
|
2
2
|
|
3
3
|
module Fog
|
4
|
+
|
5
|
+
# @note Extracting JSON components out of core is a work in progress.
|
6
|
+
#
|
7
|
+
# The {JSON} module includes functionality that is common between APIs using
|
8
|
+
# JSON to send and receive data.
|
9
|
+
#
|
10
|
+
# The intent is to provide common code for provider APIs using JSON but not
|
11
|
+
# require it for those using XML.
|
12
|
+
#
|
13
|
+
# @todo Add +require "fog/json" and/or +include Fog::JSON+ to providers using
|
14
|
+
# its services
|
15
|
+
#
|
4
16
|
module JSON
|
5
17
|
|
6
18
|
def self.sanitize(data)
|
@@ -28,6 +40,5 @@ module Fog
|
|
28
40
|
def self.decode(obj)
|
29
41
|
MultiJson.decode(obj)
|
30
42
|
end
|
31
|
-
|
32
43
|
end
|
33
44
|
end
|
@@ -18,7 +18,7 @@ module Fog
|
|
18
18
|
requires :parent
|
19
19
|
metadata = service.list_metadata(collection_name, @parent.id).body['metadata']
|
20
20
|
metas = []
|
21
|
-
metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} }
|
21
|
+
metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} } unless metadata.nil?
|
22
22
|
load(metas)
|
23
23
|
end
|
24
24
|
|
@@ -17,7 +17,8 @@ module Fog
|
|
17
17
|
|
18
18
|
def detach_volume(server_id, attachment_id)
|
19
19
|
response = Excon::Response.new
|
20
|
-
if self.data[:volumes][attachment_id]
|
20
|
+
if self.data[:volumes][attachment_id] &&
|
21
|
+
self.data[:volumes][attachment_id]['attachments'].reject! { |attachment| attachment['serverId'] == server_id }
|
21
22
|
response.status = 202
|
22
23
|
response
|
23
24
|
else
|
data/lib/fog/rackspace.rb
CHANGED
@@ -96,6 +96,11 @@ module Fog
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
def self.json_response?(response)
|
100
|
+
return false unless response && response.headers
|
101
|
+
response.headers['Content-Type'] =~ %r{application/json}i ? true : false
|
102
|
+
end
|
103
|
+
|
99
104
|
def self.normalize_url(endpoint)
|
100
105
|
return nil unless endpoint
|
101
106
|
str = endpoint.chomp " "
|
@@ -87,40 +87,25 @@ module Fog
|
|
87
87
|
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
88
88
|
end
|
89
89
|
|
90
|
-
def request(params)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
}))
|
101
|
-
rescue Excon::Errors::NotFound => error
|
102
|
-
raise NotFound.slurp(error, region)
|
103
|
-
rescue Excon::Errors::BadRequest => error
|
104
|
-
raise BadRequest.slurp error
|
105
|
-
rescue Excon::Errors::InternalServerError => error
|
106
|
-
raise InternalServerError.slurp error
|
107
|
-
rescue Excon::Errors::HTTPStatusError => error
|
108
|
-
raise ServiceError.slurp error
|
109
|
-
end
|
110
|
-
unless response.body.empty?
|
111
|
-
response.body = Fog::JSON.decode(response.body)
|
112
|
-
end
|
113
|
-
response
|
90
|
+
def request(params, parse_json = true, &block)
|
91
|
+
super(params, parse_json, &block)
|
92
|
+
rescue Excon::Errors::NotFound => error
|
93
|
+
raise NotFound.slurp(error, region)
|
94
|
+
rescue Excon::Errors::BadRequest => error
|
95
|
+
raise BadRequest.slurp error
|
96
|
+
rescue Excon::Errors::InternalServerError => error
|
97
|
+
raise InternalServerError.slurp error
|
98
|
+
rescue Excon::Errors::HTTPStatusError => error
|
99
|
+
raise ServiceError.slurp error
|
114
100
|
end
|
115
101
|
|
116
|
-
def authenticate
|
117
|
-
|
102
|
+
def authenticate(options={})
|
103
|
+
super({
|
118
104
|
:rackspace_api_key => @rackspace_api_key,
|
119
105
|
:rackspace_username => @rackspace_username,
|
120
106
|
:rackspace_auth_url => @rackspace_auth_url,
|
121
107
|
:connection_options => @connection_options
|
122
|
-
}
|
123
|
-
super(options)
|
108
|
+
})
|
124
109
|
end
|
125
110
|
|
126
111
|
def service_name
|
data/lib/fog/rackspace/cdn.rb
CHANGED
@@ -152,30 +152,16 @@ module Fog
|
|
152
152
|
true
|
153
153
|
end
|
154
154
|
|
155
|
-
def request(params, parse_json = true)
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
}))
|
166
|
-
rescue Excon::Errors::NotFound => error
|
167
|
-
raise Fog::Storage::Rackspace::NotFound.slurp(error, region)
|
168
|
-
rescue Excon::Errors::BadRequest => error
|
169
|
-
raise Fog::Storage::Rackspace::BadRequest.slurp error
|
170
|
-
rescue Excon::Errors::InternalServerError => error
|
171
|
-
raise Fog::Storage::Rackspace::InternalServerError.slurp error
|
172
|
-
rescue Excon::Errors::HTTPStatusError => error
|
173
|
-
raise Fog::Storage::Rackspace::ServiceError.slurp error
|
174
|
-
end
|
175
|
-
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
176
|
-
response.body = Fog::JSON.decode(response.body)
|
177
|
-
end
|
178
|
-
response
|
155
|
+
def request(params, parse_json = true, &block)
|
156
|
+
super(params, parse_json, &block)
|
157
|
+
rescue Excon::Errors::NotFound => error
|
158
|
+
raise Fog::Storage::Rackspace::NotFound.slurp(error, region)
|
159
|
+
rescue Excon::Errors::BadRequest => error
|
160
|
+
raise Fog::Storage::Rackspace::BadRequest.slurp error
|
161
|
+
rescue Excon::Errors::InternalServerError => error
|
162
|
+
raise Fog::Storage::Rackspace::InternalServerError.slurp error
|
163
|
+
rescue Excon::Errors::HTTPStatusError => error
|
164
|
+
raise Fog::Storage::Rackspace::ServiceError.slurp error
|
179
165
|
end
|
180
166
|
|
181
167
|
private
|
@@ -190,7 +190,6 @@ module Fog
|
|
190
190
|
@rackspace_servicenet = options[:rackspace_servicenet]
|
191
191
|
@rackspace_auth_token = options[:rackspace_auth_token]
|
192
192
|
@rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_compute_v1_url] || options[:rackspace_management_url])
|
193
|
-
@rackspace_must_reauthenticate = false
|
194
193
|
@connection_options = options[:connection_options] || {}
|
195
194
|
authenticate
|
196
195
|
Excon.defaults[:ssl_verify_peer] = false if service_net?
|
@@ -202,56 +201,29 @@ module Fog
|
|
202
201
|
@connection.reset
|
203
202
|
end
|
204
203
|
|
205
|
-
def request(params)
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
rescue Excon::Errors::Unauthorized => error
|
216
|
-
if error.response.body != 'Bad username or password' # token expiration
|
217
|
-
@rackspace_must_reauthenticate = true
|
218
|
-
authenticate
|
219
|
-
retry
|
220
|
-
else # bad credentials
|
221
|
-
raise error
|
222
|
-
end
|
223
|
-
rescue Excon::Errors::HTTPStatusError => error
|
224
|
-
raise case error
|
225
|
-
when Excon::Errors::NotFound
|
226
|
-
NotFound.slurp(error, region)
|
227
|
-
else
|
228
|
-
error
|
229
|
-
end
|
230
|
-
end
|
231
|
-
unless response.body.empty?
|
232
|
-
response.body = Fog::JSON.decode(response.body)
|
233
|
-
end
|
234
|
-
response
|
204
|
+
def request(params, parse_json = true, &block)
|
205
|
+
super(params, parse_json, &block)
|
206
|
+
rescue Excon::Errors::NotFound => error
|
207
|
+
raise NotFound.slurp(error, region)
|
208
|
+
rescue Excon::Errors::BadRequest => error
|
209
|
+
raise BadRequest.slurp error
|
210
|
+
rescue Excon::Errors::InternalServerError => error
|
211
|
+
raise InternalServerError.slurp error
|
212
|
+
rescue Excon::Errors::HTTPStatusError => error
|
213
|
+
raise ServiceError.slurp error
|
235
214
|
end
|
236
215
|
|
237
|
-
|
238
216
|
def service_net?
|
239
217
|
@rackspace_servicenet == true
|
240
218
|
end
|
241
219
|
|
242
|
-
def authenticate
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
}
|
250
|
-
super(options)
|
251
|
-
else
|
252
|
-
@auth_token = @rackspace_auth_token
|
253
|
-
@uri = URI.parse(@rackspace_endpoint)
|
254
|
-
end
|
220
|
+
def authenticate(options={})
|
221
|
+
super({
|
222
|
+
:rackspace_api_key => @rackspace_api_key,
|
223
|
+
:rackspace_username => @rackspace_username,
|
224
|
+
:rackspace_auth_url => @rackspace_auth_url,
|
225
|
+
:connection_options => @connection_options
|
226
|
+
})
|
255
227
|
end
|
256
228
|
|
257
229
|
def service_name
|
@@ -139,45 +139,25 @@ module Fog
|
|
139
139
|
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
140
140
|
end
|
141
141
|
|
142
|
-
def request(params)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
}))
|
153
|
-
rescue Excon::Errors::NotFound => error
|
154
|
-
raise NotFound.slurp(error, region)
|
155
|
-
rescue Excon::Errors::BadRequest => error
|
156
|
-
raise BadRequest.slurp error
|
157
|
-
rescue Excon::Errors::InternalServerError => error
|
158
|
-
raise InternalServerError.slurp error
|
159
|
-
rescue Excon::Errors::HTTPStatusError => error
|
160
|
-
raise ServiceError.slurp error
|
161
|
-
end
|
162
|
-
|
163
|
-
unless response.body.empty?
|
164
|
-
begin
|
165
|
-
response.body = Fog::JSON.decode(response.body)
|
166
|
-
rescue MultiJson::DecodeError => e
|
167
|
-
response.body = {}
|
168
|
-
end
|
169
|
-
end
|
170
|
-
response
|
142
|
+
def request(params, parse_json = true, &block)
|
143
|
+
super(params, parse_json, &block)
|
144
|
+
rescue Excon::Errors::NotFound => error
|
145
|
+
raise NotFound.slurp(error, region)
|
146
|
+
rescue Excon::Errors::BadRequest => error
|
147
|
+
raise BadRequest.slurp error
|
148
|
+
rescue Excon::Errors::InternalServerError => error
|
149
|
+
raise InternalServerError.slurp error
|
150
|
+
rescue Excon::Errors::HTTPStatusError => error
|
151
|
+
raise ServiceError.slurp error
|
171
152
|
end
|
172
153
|
|
173
|
-
def authenticate
|
174
|
-
|
154
|
+
def authenticate(options={})
|
155
|
+
super({
|
175
156
|
:rackspace_api_key => @rackspace_api_key,
|
176
157
|
:rackspace_username => @rackspace_username,
|
177
158
|
:rackspace_auth_url => @rackspace_auth_url,
|
178
159
|
:connection_options => @connection_options
|
179
|
-
}
|
180
|
-
super(options)
|
160
|
+
})
|
181
161
|
end
|
182
162
|
|
183
163
|
def service_name
|
@@ -85,45 +85,29 @@ module Fog
|
|
85
85
|
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
86
86
|
end
|
87
87
|
|
88
|
-
def request(params)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}))
|
99
|
-
rescue Excon::Errors::NotFound => error
|
100
|
-
raise NotFound.slurp(error, region)
|
101
|
-
rescue Excon::Errors::BadRequest => error
|
102
|
-
raise BadRequest.slurp error
|
103
|
-
rescue Excon::Errors::InternalServerError => error
|
104
|
-
raise InternalServerError.slurp error
|
105
|
-
rescue Excon::Errors::HTTPStatusError => error
|
106
|
-
raise ServiceError.slurp error
|
107
|
-
end
|
108
|
-
unless response.body.empty?
|
109
|
-
response.body = Fog::JSON.decode(response.body)
|
110
|
-
end
|
111
|
-
response
|
88
|
+
def request(params, parse_json = true, &block)
|
89
|
+
super(params, parse_json, &block)
|
90
|
+
rescue Excon::Errors::NotFound => error
|
91
|
+
raise NotFound.slurp(error, region)
|
92
|
+
rescue Excon::Errors::BadRequest => error
|
93
|
+
raise BadRequest.slurp error
|
94
|
+
rescue Excon::Errors::InternalServerError => error
|
95
|
+
raise InternalServerError.slurp error
|
96
|
+
rescue Excon::Errors::HTTPStatusError => error
|
97
|
+
raise ServiceError.slurp error
|
112
98
|
end
|
113
99
|
|
114
100
|
def endpoint_uri(service_endpoint_url=nil)
|
115
101
|
@uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_database_url)
|
116
102
|
end
|
117
103
|
|
118
|
-
def authenticate
|
119
|
-
|
104
|
+
def authenticate(options={})
|
105
|
+
super({
|
120
106
|
:rackspace_api_key => @rackspace_api_key,
|
121
107
|
:rackspace_username => @rackspace_username,
|
122
108
|
:rackspace_auth_url => @rackspace_auth_url,
|
123
109
|
:connection_options => @connection_options
|
124
|
-
}
|
125
|
-
|
126
|
-
super(options)
|
110
|
+
})
|
127
111
|
end
|
128
112
|
|
129
113
|
private
|