fog 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +5 -0
- data/Rakefile +14 -4
- data/bin/fog +22 -0
- data/changelog.txt +262 -0
- data/fog.gemspec +8 -4
- data/lib/fog/aws.rb +11 -0
- data/lib/fog/aws/auto_scaling.rb +15 -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/auto_scaling/group.rb +6 -3
- data/lib/fog/aws/models/compute/spot_request.rb +1 -11
- data/lib/fog/aws/models/rds/log_file.rb +26 -0
- data/lib/fog/aws/models/rds/log_files.rb +50 -0
- data/lib/fog/aws/models/rds/server.rb +3 -1
- data/lib/fog/aws/models/rds/snapshot.rb +1 -0
- data/lib/fog/aws/models/rds/snapshots.rb +20 -13
- data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
- data/lib/fog/aws/parsers/rds/describe_db_log_files.rb +44 -0
- data/lib/fog/aws/parsers/rds/download_db_logfile_portion.rb +26 -0
- data/lib/fog/aws/parsers/ses/verify_domain_identity.rb +26 -0
- data/lib/fog/aws/parsers/storage/complete_multipart_upload.rb +1 -1
- data/lib/fog/aws/parsers/sts/assume_role.rb +30 -0
- data/lib/fog/aws/rds.rb +27 -14
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +8 -0
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +8 -1
- 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/rds/describe_db_log_files.rb +67 -0
- data/lib/fog/aws/requests/rds/download_db_logfile_portion.rb +63 -0
- data/lib/fog/aws/requests/ses/send_raw_email.rb +1 -1
- data/lib/fog/aws/requests/ses/verify_domain_identity.rb +30 -0
- data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +6 -2
- data/lib/fog/aws/requests/storage/get_object.rb +1 -1
- data/lib/fog/aws/requests/sts/assume_role.rb +46 -0
- data/lib/fog/aws/ses.rb +26 -9
- data/lib/fog/aws/storage.rb +2 -1
- data/lib/fog/aws/sts.rb +31 -21
- data/lib/fog/bin.rb +0 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/brightbox/compute.rb +20 -212
- data/lib/fog/brightbox/compute/shared.rb +232 -0
- data/lib/fog/brightbox/models/compute/collaboration.rb +43 -0
- data/lib/fog/brightbox/models/compute/collaborations.rb +23 -0
- data/lib/fog/brightbox/models/compute/user_collaboration.rb +29 -0
- data/lib/fog/brightbox/models/compute/user_collaborations.rb +23 -0
- data/lib/fog/brightbox/requests/compute/accept_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/create_collaboration.rb +23 -0
- data/lib/fog/brightbox/requests/compute/delete_collaboration.rb +28 -0
- data/lib/fog/brightbox/requests/compute/delete_user_collaboration.rb +28 -0
- data/lib/fog/brightbox/requests/compute/destroy_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/get_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/get_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/list_collaborations.rb +19 -0
- data/lib/fog/brightbox/requests/compute/list_user_collaborations.rb +19 -0
- data/lib/fog/brightbox/requests/compute/reject_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/resend_collaboration.rb +21 -0
- data/lib/fog/cloudsigma/docs/getting_started.md +59 -0
- 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/digitalocean/examples/getting_started.md +1 -1
- data/lib/fog/digitalocean/models/compute/server.rb +2 -2
- 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/google/requests/storage/get_object.rb +1 -1
- data/lib/fog/hp/requests/storage/get_object.rb +1 -1
- data/lib/fog/hp/storage.rb +26 -9
- data/lib/fog/ibm/requests/compute/create_instance.rb +20 -15
- data/lib/fog/internet_archive/requests/storage/get_object.rb +1 -1
- data/lib/fog/{core/json.rb → json.rb} +13 -2
- data/lib/fog/metering.rb +25 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/metering.rb +215 -0
- data/lib/fog/openstack/models/compute/flavors.rb +2 -2
- data/lib/fog/openstack/models/compute/metadata.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -2
- data/lib/fog/openstack/models/image/images.rb +1 -1
- data/lib/fog/openstack/models/metering/meter.rb +0 -0
- data/lib/fog/openstack/models/metering/meters.rb +0 -0
- data/lib/fog/openstack/models/metering/resource.rb +24 -0
- data/lib/fog/openstack/models/metering/resources.rb +25 -0
- data/lib/fog/openstack/models/volume/volume.rb +3 -1
- data/lib/fog/openstack/models/volume/volumes.rb +2 -1
- data/lib/fog/openstack/network.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +19 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +2 -1
- data/lib/fog/openstack/requests/compute/list_flavors_detail.rb +4 -3
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_tenant.rb +2 -2
- data/lib/fog/openstack/requests/metering/get_resource.rb +32 -0
- data/lib/fog/openstack/requests/metering/get_samples.rb +55 -0
- data/lib/fog/openstack/requests/metering/get_statistics.rb +56 -0
- data/lib/fog/openstack/requests/metering/list_meters.rb +50 -0
- data/lib/fog/openstack/requests/metering/list_resources.rb +32 -0
- data/lib/fog/openstack/requests/volume/create_volume.rb +4 -2
- data/lib/fog/rackspace.rb +16 -1
- 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 +27 -23
- 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/dns/zones.rb +34 -21
- 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/dns/list_domains.rb +2 -2
- data/lib/fog/rackspace/requests/storage/delete_multiple_objects.rb +75 -0
- data/lib/fog/rackspace/requests/storage/delete_static_large_object.rb +50 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +3 -1
- data/lib/fog/rackspace/requests/storage/put_dynamic_obj_manifest.rb +44 -0
- data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +3 -30
- data/lib/fog/rackspace/requests/storage/put_static_obj_manifest.rb +60 -0
- data/lib/fog/rackspace/service.rb +43 -1
- data/lib/fog/rackspace/storage.rb +25 -43
- data/lib/fog/riakcs/provisioning.rb +2 -1
- data/lib/fog/riakcs/usage.rb +2 -1
- data/lib/fog/vcloud/requests/compute/configure_vm_cpus.rb +1 -1
- data/lib/fog/vcloud/requests/compute/configure_vm_memory.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_folder.rb +1 -1
- 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/lib/tasks/changelog_task.rb +1 -0
- data/tests/aws/models/auto_scaling/groups_test.rb +22 -0
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/helper.rb +14 -0
- data/tests/aws/requests/rds/log_file_tests.rb +19 -0
- data/tests/aws/requests/ses/verified_domain_identity_tests.rb +16 -0
- data/tests/aws/requests/sts/assume_role_tests.rb +19 -0
- data/tests/brightbox/requests/compute/collaboration_tests.rb +41 -0
- data/tests/brightbox/requests/compute/helper.rb +46 -2
- data/tests/brightbox/requests/compute/user_collaboration_tests.rb +67 -0
- data/tests/core/connection_tests.rb +26 -0
- data/tests/helper.rb +13 -0
- data/tests/openstack/requests/metering/meter_tests.rb +52 -0
- data/tests/openstack/requests/metering/resource_tests.rb +19 -0
- data/tests/openvz/helper.rb +14 -8
- 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 +20 -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/dns/zones_tests.rb +19 -5
- 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/requests/storage/large_object_tests.rb +303 -59
- data/tests/rackspace/requests/storage/object_tests.rb +73 -18
- 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 +89 -19
- data/tests/core/user_agent_tests.rb +0 -6
@@ -3,38 +3,11 @@ module Fog
|
|
3
3
|
class Rackspace
|
4
4
|
class Real
|
5
5
|
|
6
|
-
# Create a new
|
6
|
+
# Create a new dynamic large object manifest
|
7
7
|
#
|
8
|
-
#
|
9
|
-
# for all uploaded segments. Retrieving the manifest object streams all segments matching this prefix.
|
10
|
-
# Segments must sort in the order they should be concatenated. Note that any future objects stored in the container
|
11
|
-
# along with the segments that match the prefix will be included when retrieving the manifest object.
|
12
|
-
#
|
13
|
-
# All segments must be stored in the same container, but may be in a different container than the manifest object.
|
14
|
-
# The default +X-Object-Manifest+ header is set to "+container+/+object+", but may be overridden in +options+
|
15
|
-
# to specify the prefix and/or the container where segments were stored.
|
16
|
-
# If overridden, names should be CGI escaped (excluding spaces) if needed (see {Fog::Rackspace.escape}).
|
17
|
-
#
|
18
|
-
# @param container [String] Name for container where +object+ will be stored. Should be < 256 bytes and must not contain '/'
|
19
|
-
# @param object [String] Name for manifest object.
|
20
|
-
# @param options [Hash] Config headers for +object+.
|
21
|
-
# @option options [String] 'X-Object-Manifest' ("container/object") "<container>/<prefix>" for segment objects.
|
22
|
-
#
|
23
|
-
# @raise [Fog::Storage::Rackspace::NotFound] HTTP 404
|
24
|
-
# @raise [Fog::Storage::Rackspace::BadRequest] HTTP 400
|
25
|
-
# @raise [Fog::Storage::Rackspace::InternalServerError] HTTP 500
|
26
|
-
# @raise [Fog::Storage::Rackspace::ServiceError]
|
27
|
-
#
|
28
|
-
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Large_Object_Creation-d1e2019.html
|
8
|
+
# This is an alias for {#put_dynamic_obj_manifest} for backward compatibility.
|
29
9
|
def put_object_manifest(container, object, options = {})
|
30
|
-
|
31
|
-
headers = {'X-Object-Manifest' => path}.merge(options)
|
32
|
-
request(
|
33
|
-
:expects => 201,
|
34
|
-
:headers => headers,
|
35
|
-
:method => 'PUT',
|
36
|
-
:path => path
|
37
|
-
)
|
10
|
+
put_dynamic_obj_manifest(container, object, options)
|
38
11
|
end
|
39
12
|
|
40
13
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class Rackspace
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Create a new static large object manifest.
|
7
|
+
#
|
8
|
+
# A static large object is similar to a dynamic large object. Whereas a GET for a dynamic large object manifest
|
9
|
+
# will stream segments based on the manifest's +X-Object-Manifest+ object name prefix, a static large object
|
10
|
+
# manifest streams segments which are defined by the user within the manifest. Information about each segment is
|
11
|
+
# provided in +segments+ as an Array of Hash objects, ordered in the sequence which the segments should be streamed.
|
12
|
+
#
|
13
|
+
# When the SLO manifest is received, each segment's +etag+ and +size_bytes+ will be verified.
|
14
|
+
# The +etag+ for each segment is returned in the response to {#put_object}, but may also be calculated.
|
15
|
+
# e.g. +Digest::MD5.hexdigest(segment_data)+
|
16
|
+
#
|
17
|
+
# The maximum number of segments for a static large object is 1000, and all segments (except the last) must be
|
18
|
+
# at least 1 MiB in size. Unlike a dynamic large object, segments are not required to be in the same container.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# segments = [
|
22
|
+
# { :path => 'segments_container/first_segment',
|
23
|
+
# :etag => 'md5 for first_segment',
|
24
|
+
# :size_bytes => 'byte size of first_segment' },
|
25
|
+
# { :path => 'segments_container/second_segment',
|
26
|
+
# :etag => 'md5 for second_segment',
|
27
|
+
# :size_bytes => 'byte size of second_segment' }
|
28
|
+
# ]
|
29
|
+
# put_static_obj_manifest('my_container', 'my_large_object', segments)
|
30
|
+
#
|
31
|
+
# @param container [String] Name for container where +object+ will be stored.
|
32
|
+
# Should be < 256 bytes and must not contain '/'
|
33
|
+
# @param object [String] Name for manifest object.
|
34
|
+
# @param segments [Array<Hash>] Segment data for the object.
|
35
|
+
# @param options [Hash] Config headers for +object+.
|
36
|
+
#
|
37
|
+
# @raise [Fog::Storage::Rackspace::NotFound] HTTP 404
|
38
|
+
# @raise [Fog::Storage::Rackspace::BadRequest] HTTP 400
|
39
|
+
# @raise [Fog::Storage::Rackspace::InternalServerError] HTTP 500
|
40
|
+
# @raise [Fog::Storage::Rackspace::ServiceError]
|
41
|
+
# @raise [Excon::Errors::Unauthorized] HTTP 401
|
42
|
+
#
|
43
|
+
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Uploading_the_Manifext-d1e2227.html
|
44
|
+
def put_static_obj_manifest(container, object, segments, options = {})
|
45
|
+
request(
|
46
|
+
:expects => 201,
|
47
|
+
:method => 'PUT',
|
48
|
+
:headers => options,
|
49
|
+
:body => Fog::JSON.encode(segments),
|
50
|
+
:path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}",
|
51
|
+
:query => { 'multipart-manifest' => 'put' }
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
@@ -26,12 +26,54 @@ module Fog
|
|
26
26
|
@uri = URI.parse url
|
27
27
|
end
|
28
28
|
|
29
|
-
def authenticate(options)
|
29
|
+
def authenticate(options={})
|
30
30
|
self.send authentication_method, options
|
31
31
|
end
|
32
32
|
|
33
|
+
def request(params, parse_json = true, &block)
|
34
|
+
first_attempt = true
|
35
|
+
begin
|
36
|
+
response = @connection.request(request_params(params), &block)
|
37
|
+
rescue Excon::Errors::Unauthorized => error
|
38
|
+
raise error unless first_attempt
|
39
|
+
first_attempt = false
|
40
|
+
authenticate
|
41
|
+
retry
|
42
|
+
end
|
43
|
+
|
44
|
+
process_response(response) if parse_json
|
45
|
+
response
|
46
|
+
end
|
47
|
+
|
33
48
|
private
|
34
49
|
|
50
|
+
def process_response(response)
|
51
|
+
if response && response.body && response.body.is_a?(String) && Fog::Rackspace.json_response?(response)
|
52
|
+
begin
|
53
|
+
response.body = Fog::JSON.decode(response.body)
|
54
|
+
rescue MultiJson::DecodeError => e
|
55
|
+
Fog::Logger.warning("Error Parsing response json - #{e}")
|
56
|
+
response.body = {}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def headers(options={})
|
62
|
+
h = {
|
63
|
+
'Content-Type' => 'application/json',
|
64
|
+
'Accept' => 'application/json',
|
65
|
+
'X-Auth-Token' => auth_token
|
66
|
+
}.merge(options[:headers] || {})
|
67
|
+
end
|
68
|
+
|
69
|
+
def request_params(params)
|
70
|
+
params.merge({
|
71
|
+
:headers => headers(params),
|
72
|
+
:host => endpoint_uri.host,
|
73
|
+
:path => "#{endpoint_uri.path}/#{params[:path]}"
|
74
|
+
})
|
75
|
+
end
|
76
|
+
|
35
77
|
def authentication_method
|
36
78
|
if v2_authentication?
|
37
79
|
:authenticate_v2
|
@@ -25,6 +25,8 @@ module Fog
|
|
25
25
|
request :copy_object
|
26
26
|
request :delete_container
|
27
27
|
request :delete_object
|
28
|
+
request :delete_static_large_object
|
29
|
+
request :delete_multiple_objects
|
28
30
|
request :get_container
|
29
31
|
request :get_containers
|
30
32
|
request :get_object
|
@@ -35,6 +37,8 @@ module Fog
|
|
35
37
|
request :put_container
|
36
38
|
request :put_object
|
37
39
|
request :put_object_manifest
|
40
|
+
request :put_dynamic_obj_manifest
|
41
|
+
request :put_static_obj_manifest
|
38
42
|
request :post_set_meta_temp_url_key
|
39
43
|
|
40
44
|
module Utils
|
@@ -54,7 +58,7 @@ module Fog
|
|
54
58
|
end
|
55
59
|
end
|
56
60
|
|
57
|
-
end
|
61
|
+
end
|
58
62
|
|
59
63
|
class Mock < Fog::Rackspace::Service
|
60
64
|
include Utils
|
@@ -107,7 +111,7 @@ module Fog
|
|
107
111
|
@rackspace_servicenet = options[:rackspace_servicenet]
|
108
112
|
@rackspace_auth_token = options[:rackspace_auth_token]
|
109
113
|
@rackspace_storage_url = options[:rackspace_storage_url]
|
110
|
-
@rackspace_cdn_url = options[:rackspace_cdn_url]
|
114
|
+
@rackspace_cdn_url = options[:rackspace_cdn_url]
|
111
115
|
@rackspace_region = options[:rackspace_region] || :dfw
|
112
116
|
@rackspace_temp_url_key = options[:rackspace_temp_url_key]
|
113
117
|
@rackspace_must_reauthenticate = false
|
@@ -117,8 +121,8 @@ module Fog
|
|
117
121
|
@persistent = options[:persistent] || false
|
118
122
|
Excon.defaults[:ssl_verify_peer] = false if service_net?
|
119
123
|
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
120
|
-
end
|
121
|
-
|
124
|
+
end
|
125
|
+
|
122
126
|
# Return Account Details
|
123
127
|
# @return [Fog::Storage::Rackspace::Account] account details object
|
124
128
|
def account
|
@@ -139,43 +143,21 @@ module Fog
|
|
139
143
|
end
|
140
144
|
|
141
145
|
def request(params, parse_json = true, &block)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
}), &block)
|
152
|
-
rescue Excon::Errors::Unauthorized => error
|
153
|
-
if error.response.body != 'Bad username or password' # token expiration
|
154
|
-
@rackspace_must_reauthenticate = true
|
155
|
-
authenticate
|
156
|
-
retry
|
157
|
-
else # bad credentials
|
158
|
-
raise error
|
159
|
-
end
|
160
|
-
rescue Excon::Errors::NotFound => error
|
161
|
-
raise NotFound.slurp(error, region)
|
162
|
-
rescue Excon::Errors::BadRequest => error
|
163
|
-
raise BadRequest.slurp error
|
164
|
-
rescue Excon::Errors::InternalServerError => error
|
165
|
-
raise InternalServerError.slurp error
|
166
|
-
rescue Excon::Errors::HTTPStatusError => error
|
167
|
-
raise ServiceError.slurp error
|
168
|
-
end
|
169
|
-
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
|
170
|
-
response.body = Fog::JSON.decode(response.body)
|
171
|
-
end
|
172
|
-
response
|
146
|
+
super(params, parse_json, &block)
|
147
|
+
rescue Excon::Errors::NotFound => error
|
148
|
+
raise NotFound.slurp(error, region)
|
149
|
+
rescue Excon::Errors::BadRequest => error
|
150
|
+
raise BadRequest.slurp error
|
151
|
+
rescue Excon::Errors::InternalServerError => error
|
152
|
+
raise InternalServerError.slurp error
|
153
|
+
rescue Excon::Errors::HTTPStatusError => error
|
154
|
+
raise ServiceError.slurp error
|
173
155
|
end
|
174
156
|
|
175
157
|
def service_net?
|
176
158
|
@rackspace_servicenet == true
|
177
|
-
end
|
178
|
-
|
159
|
+
end
|
160
|
+
|
179
161
|
def authenticate
|
180
162
|
if @rackspace_must_reauthenticate || @rackspace_auth_token.nil?
|
181
163
|
options = {
|
@@ -183,14 +165,14 @@ module Fog
|
|
183
165
|
:rackspace_username => @rackspace_username,
|
184
166
|
:rackspace_auth_url => @rackspace_auth_url,
|
185
167
|
:connection_options => @connection_options
|
186
|
-
}
|
168
|
+
}
|
187
169
|
super(options)
|
188
170
|
else
|
189
171
|
@auth_token = @rackspace_auth_token
|
190
172
|
@uri = URI.parse(@rackspace_storage_url)
|
191
173
|
end
|
192
174
|
end
|
193
|
-
|
175
|
+
|
194
176
|
def service_name
|
195
177
|
:cloudFiles
|
196
178
|
end
|
@@ -206,15 +188,15 @@ module Fog
|
|
206
188
|
@uri.host = "snet-#{@uri.host}" if service_net?
|
207
189
|
@uri
|
208
190
|
end
|
209
|
-
|
210
|
-
private
|
211
|
-
|
191
|
+
|
192
|
+
private
|
193
|
+
|
212
194
|
def authenticate_v1(options)
|
213
195
|
credentials = Fog::Rackspace.authenticate(options, @connection_options)
|
214
196
|
endpoint_uri credentials['X-Storage-Url']
|
215
197
|
@auth_token = credentials['X-Auth-Token']
|
216
198
|
end
|
217
|
-
|
199
|
+
|
218
200
|
end
|
219
201
|
end
|
220
202
|
end
|
data/lib/fog/riakcs/usage.rb
CHANGED
@@ -24,7 +24,7 @@ EOF
|
|
24
24
|
request(
|
25
25
|
:body => body,
|
26
26
|
:expects => 202,
|
27
|
-
:headers => {'Content-Type' => vm_data[:"vcloud_type"] },
|
27
|
+
:headers => { 'Content-Type' => vm_data[:"vcloud_type"] || 'application/vnd.vmware.vcloud.rasdItem+xml' },
|
28
28
|
:method => 'PUT',
|
29
29
|
:uri => "#{edit_uri}",
|
30
30
|
:parse => true
|
@@ -25,7 +25,7 @@ EOF
|
|
25
25
|
request(
|
26
26
|
:body => body,
|
27
27
|
:expects => 202,
|
28
|
-
:headers => {'Content-Type' => vm_data[:"vcloud_type"] },
|
28
|
+
:headers => { 'Content-Type' => vm_data[:"vcloud_type"] || 'application/vnd.vmware.vcloud.rasdItem+xml' },
|
29
29
|
:method => 'PUT',
|
30
30
|
:uri => edit_uri,
|
31
31
|
:parse => true
|
data/lib/fog/version.rb
CHANGED
@@ -31,7 +31,7 @@ module Fog
|
|
31
31
|
dc_root_folder = dc.vmFolder
|
32
32
|
# Filter the root path for this datacenter not to be used."
|
33
33
|
dc_root_folder_path=dc_root_folder.path.map { | id, name | name }.join("/")
|
34
|
-
paths = path.sub(/^\/?#{
|
34
|
+
paths = path.sub(/^\/?#{Regexp.quote(dc_root_folder_path)}\/?/, '').split('/')
|
35
35
|
|
36
36
|
return dc_root_folder if paths.empty?
|
37
37
|
# Walk the tree resetting the folder pointer as we go
|
@@ -50,6 +50,7 @@ module Fog
|
|
50
50
|
attribute :hvm_boot_policy, :aliases => :HVM_boot_policy
|
51
51
|
attribute :hvm_boot_params, :aliases => :HVM_boot_params
|
52
52
|
attribute :pci_bus, :aliases => :PCI_bus
|
53
|
+
attribute :snapshots
|
53
54
|
|
54
55
|
def initialize(attributes={})
|
55
56
|
super
|
@@ -198,14 +199,15 @@ module Fog
|
|
198
199
|
service.provision_server reference
|
199
200
|
end
|
200
201
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
202
|
+
def snapshot(name)
|
203
|
+
service.snapshot_server(reference, name)
|
204
|
+
end
|
205
|
+
|
206
|
+
def revert(snapshot_ref)
|
207
|
+
service.snapshot_revert(snapshot_ref)
|
208
|
+
end
|
207
209
|
end
|
208
210
|
|
209
211
|
end
|
210
212
|
end
|
211
|
-
end
|
213
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class XenServer
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
def snapshot_revert( snapshot_ref, extra_args = {})
|
8
|
+
@connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.revert'}, snapshot_ref)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
|
15
|
+
def snapshot_revert()
|
16
|
+
Fog::Mock.not_implemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class XenServer
|
4
|
+
|
5
|
+
class Real
|
6
|
+
|
7
|
+
def snapshot_server( vm_ref , name, extra_args = {})
|
8
|
+
@connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.snapshot'}, vm_ref, name)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Mock
|
14
|
+
|
15
|
+
def snapshot_server()
|
16
|
+
Fog::Mock.not_implemented
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/fog/xml.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
require "fog/core/parser"
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
|
6
|
+
# @note Extracting XML components out of core is a work in progress.
|
7
|
+
#
|
8
|
+
# The {XML} module includes functionality that is common between APIs using
|
9
|
+
# XML to send and receive data.
|
10
|
+
#
|
11
|
+
# The intent is to provide common code for provider APIs using XML but not
|
12
|
+
# require it for those using JSON.
|
13
|
+
#
|
14
|
+
# @todo Add +require "fog/xml"+ and/or +include Fog::XML+ to providers using
|
15
|
+
# its services
|
16
|
+
#
|
17
|
+
module XML
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
require "fog/xml/sax_parser_connection"
|