fog 0.3.31 → 0.3.32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +3 -0
- data/.gitignore +10 -0
- data/Gemfile.lock +1 -4
- data/README.rdoc +29 -37
- data/Rakefile +5 -25
- data/bin/fog +1 -3
- data/examples/dns_methods.rb +389 -0
- data/examples/storage.rb +103 -0
- data/fog.gemspec +4 -778
- data/lib/fog.rb +5 -66
- data/lib/fog/aws.rb +3 -0
- data/lib/fog/aws/bin.rb +7 -2
- data/lib/fog/aws/cdn.rb +2 -2
- data/lib/fog/aws/compute.rb +2 -2
- data/lib/fog/aws/dns.rb +101 -0
- data/lib/fog/aws/elb.rb +2 -2
- data/lib/fog/aws/iam.rb +2 -2
- data/lib/fog/aws/models/compute/image.rb +1 -0
- data/lib/fog/aws/models/compute/server.rb +1 -1
- data/lib/fog/aws/models/compute/servers.rb +1 -13
- data/lib/fog/aws/parsers/compute/describe_images.rb +36 -34
- data/lib/fog/aws/parsers/dns/change_resource_record_sets.rb +26 -0
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +55 -0
- data/lib/fog/aws/parsers/dns/delete_hosted_zone.rb +25 -0
- data/lib/fog/aws/parsers/dns/get_change.rb +26 -0
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +43 -0
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +35 -0
- data/lib/fog/aws/parsers/dns/list_resource_record_sets.rb +46 -0
- data/lib/fog/aws/requests/compute/describe_images.rb +1 -0
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +90 -0
- data/lib/fog/aws/requests/dns/create_hosted_zone.rb +68 -0
- data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +48 -0
- data/lib/fog/aws/requests/dns/get_change.rb +47 -0
- data/lib/fog/aws/requests/dns/get_hosted_zone.rb +51 -0
- data/lib/fog/aws/requests/dns/list_hosted_zones.rb +63 -0
- data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +68 -0
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/sync_clock.rb +28 -0
- data/lib/fog/aws/simpledb.rb +2 -2
- data/lib/fog/aws/storage.rb +5 -3
- data/lib/fog/bluebox.rb +2 -0
- data/lib/fog/bluebox/compute.rb +2 -2
- data/lib/fog/brightbox.rb +2 -0
- data/lib/fog/brightbox/compute.rb +2 -2
- data/lib/fog/core.rb +21 -1
- data/lib/fog/core/bin.rb +3 -1
- data/lib/fog/core/compute.rb +1 -0
- data/lib/fog/core/credentials.rb +72 -50
- data/lib/fog/core/deprecation.rb +11 -5
- data/lib/fog/core/mock.rb +34 -0
- data/lib/fog/core/model.rb +9 -1
- data/lib/fog/core/service.rb +40 -26
- data/lib/fog/core/storage.rb +1 -0
- data/lib/fog/core/time.rb +21 -0
- data/lib/fog/core/wait_for.rb +17 -0
- data/lib/fog/go_grid.rb +2 -0
- data/lib/fog/go_grid/compute.rb +2 -2
- data/lib/fog/google.rb +2 -0
- data/lib/fog/google/requests/storage/get_bucket.rb +6 -5
- data/lib/fog/google/requests/storage/get_object_url.rb +4 -4
- data/lib/fog/google/requests/storage/put_object_url.rb +4 -4
- data/lib/fog/google/storage.rb +4 -3
- data/lib/fog/linode.rb +3 -0
- data/lib/fog/linode/bin.rb +5 -3
- data/lib/fog/linode/compute.rb +6 -2
- data/lib/fog/linode/dns.rb +80 -0
- data/lib/fog/linode/requests/dns/domain_create.rb +52 -0
- data/lib/fog/linode/requests/dns/domain_delete.rb +35 -0
- data/lib/fog/linode/requests/dns/domain_list.rb +50 -0
- data/lib/fog/linode/requests/dns/domain_resource_create.rb +53 -0
- data/lib/fog/linode/requests/dns/domain_resource_delete.rb +36 -0
- data/lib/fog/linode/requests/dns/domain_resource_list.rb +48 -0
- data/lib/fog/linode/requests/dns/domain_resource_update.rb +54 -0
- data/lib/fog/linode/requests/dns/domain_update.rb +48 -0
- data/lib/fog/local.rb +2 -0
- data/lib/fog/local/storage.rb +3 -3
- data/lib/fog/new_servers.rb +2 -0
- data/lib/fog/new_servers/compute.rb +2 -2
- data/lib/fog/rackspace.rb +2 -0
- data/lib/fog/rackspace/cdn.rb +2 -2
- data/lib/fog/rackspace/compute.rb +2 -2
- data/lib/fog/rackspace/storage.rb +2 -2
- data/lib/fog/slicehost.rb +3 -0
- data/lib/fog/slicehost/bin.rb +2 -0
- data/lib/fog/slicehost/compute.rb +2 -2
- data/lib/fog/slicehost/dns.rb +84 -0
- data/lib/fog/slicehost/parsers/dns/create_record.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/create_zone.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_record.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_records.rb +30 -0
- data/lib/fog/slicehost/parsers/dns/get_zone.rb +26 -0
- data/lib/fog/slicehost/parsers/dns/get_zones.rb +30 -0
- data/lib/fog/slicehost/requests/compute/create_slice.rb +2 -2
- data/lib/fog/slicehost/requests/compute/delete_slice.rb +3 -17
- data/lib/fog/slicehost/requests/dns/create_record.rb +61 -0
- data/lib/fog/slicehost/requests/dns/create_zone.rb +54 -0
- data/lib/fog/slicehost/requests/dns/delete_record.rb +31 -0
- data/lib/fog/slicehost/requests/dns/delete_zone.rb +31 -0
- data/lib/fog/slicehost/requests/dns/get_record.rb +40 -0
- data/lib/fog/slicehost/requests/dns/get_records.rb +41 -0
- data/lib/fog/slicehost/requests/dns/get_zone.rb +40 -0
- data/lib/fog/slicehost/requests/dns/get_zones.rb +38 -0
- data/lib/fog/terremark.rb +2 -0
- data/lib/fog/terremark/ecloud.rb +2 -4
- data/lib/fog/vcloud.rb +4 -2
- data/lib/fog/vcloud/bin.rb +3 -1
- data/lib/fog/vcloud/mock_data_classes.rb +77 -11
- data/lib/fog/vcloud/terremark/ecloud.rb +22 -7
- data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb +60 -0
- data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_services.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +28 -13
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +2 -2
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +4 -1
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +5 -5
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +6 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/add_backup_internet_service.rb +111 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +2 -4
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +1 -3
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +39 -27
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +1 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +21 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +2 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +34 -17
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +12 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +15 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +1 -12
- data/lib/fog/zerigo.rb +15 -0
- data/lib/fog/zerigo/bin.rb +25 -0
- data/lib/fog/zerigo/dns.rb +96 -0
- data/lib/fog/zerigo/parsers/dns/count_hosts.rb +24 -0
- data/lib/fog/zerigo/parsers/dns/count_zones.rb +24 -0
- data/lib/fog/zerigo/parsers/dns/create_host.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/create_zone.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/find_hosts.rb +30 -0
- data/lib/fog/zerigo/parsers/dns/get_host.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/get_zone.rb +56 -0
- data/lib/fog/zerigo/parsers/dns/get_zone_stats.rb +26 -0
- data/lib/fog/zerigo/parsers/dns/list_hosts.rb +30 -0
- data/lib/fog/zerigo/parsers/dns/list_zones.rb +30 -0
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +36 -0
- data/lib/fog/zerigo/requests/dns/count_zones.rb +36 -0
- data/lib/fog/zerigo/requests/dns/create_host.rb +70 -0
- data/lib/fog/zerigo/requests/dns/create_zone.rb +97 -0
- data/lib/fog/zerigo/requests/dns/delete_host.rb +32 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +33 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +63 -0
- data/lib/fog/zerigo/requests/dns/get_host.rb +47 -0
- data/lib/fog/zerigo/requests/dns/get_zone.rb +57 -0
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +44 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +48 -0
- data/lib/fog/zerigo/requests/dns/list_zones.rb +53 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +60 -0
- data/lib/fog/zerigo/requests/dns/update_zone.rb +78 -0
- data/spec/spec_helper.rb +0 -5
- data/spec/vcloud/spec_helper.rb +3 -2
- data/spec/vcloud/terremark/ecloud/models/backup_internet_service_spec.rb +49 -0
- data/spec/vcloud/terremark/ecloud/models/backup_internet_services_spec.rb +29 -0
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +32 -13
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +7 -4
- data/spec/vcloud/terremark/ecloud/models/server_spec.rb +20 -0
- data/spec/vcloud/terremark/ecloud/requests/add_backup_internet_service_spec.rb +60 -0
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +3 -0
- data/spec/vcloud/terremark/ecloud/requests/configure_network_ip_spec.rb +55 -0
- data/spec/vcloud/terremark/ecloud/requests/delete_vapp_spec.rb +9 -0
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +60 -14
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +2 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +3 -3
- data/tests/aws/requests/compute/image_tests.rb +15 -14
- data/tests/aws/requests/dns/dns_tests.rb +276 -0
- data/tests/brightbox/requests/compute/account_tests.rb +20 -9
- data/tests/brightbox/requests/compute/api_client_tests.rb +12 -4
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +20 -6
- data/tests/brightbox/requests/compute/image_tests.rb +9 -4
- data/tests/brightbox/requests/compute/interface_tests.rb +8 -2
- data/tests/brightbox/requests/compute/server_tests.rb +17 -5
- data/tests/brightbox/requests/compute/server_type_tests.rb +8 -4
- data/tests/brightbox/requests/compute/user_tests.rb +13 -5
- data/tests/brightbox/requests/compute/zone_tests.rb +8 -4
- data/tests/core/attribute_tests.rb +45 -0
- data/tests/helper.rb +0 -2
- data/tests/linode/requests/dns/dns_tests.rb +262 -0
- data/tests/rackspace/requests/compute/address_tests.rb +1 -1
- data/tests/rackspace/requests/compute/image_tests.rb +1 -1
- data/tests/slicehost/requests/dns_tests/dns_tests.rb +279 -0
- data/tests/zerigo/helper.rb +0 -0
- data/tests/zerigo/requests/dns/dns_tests.rb +374 -0
- metadata +280 -36
- data/spec/compact_progress_bar_formatter.rb +0 -195
- data/spec/core/attributes_spec.rb +0 -52
- data/spec/lorem.txt +0 -1
@@ -0,0 +1,51 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class DNS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/dns/get_hosted_zone'
|
7
|
+
|
8
|
+
# retrieve information about a hosted zone
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * zone_id<~String> - The ID of the hosted zone
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * 'HostedZone'<~Hash>:
|
17
|
+
# * 'Id'<~String> -
|
18
|
+
# * 'Name'<~String> -
|
19
|
+
# * 'CallerReference'<~String>
|
20
|
+
# * 'Comment'<~String> -
|
21
|
+
# * 'NameServers'<~Array>
|
22
|
+
# * 'NameServer'<~String>
|
23
|
+
# * status<~Integer> - 201 when successful
|
24
|
+
def get_hosted_zone(zone_id)
|
25
|
+
|
26
|
+
# AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use
|
27
|
+
# that form or just the actual id (which is what this request needs)
|
28
|
+
zone_id = zone_id.sub('/hostedzone/', '')
|
29
|
+
|
30
|
+
request({
|
31
|
+
:expects => 200,
|
32
|
+
:parser => Fog::Parsers::AWS::DNS::GetHostedZone.new,
|
33
|
+
:method => 'GET',
|
34
|
+
:path => "hostedzone/#{zone_id}"
|
35
|
+
})
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
class Mock
|
42
|
+
|
43
|
+
def get_hosted_zone(zone_id)
|
44
|
+
Fog::Mock.not_implemented
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class DNS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/dns/list_hosted_zones'
|
7
|
+
|
8
|
+
# Describe all or specified instances
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * options<~Hash>
|
12
|
+
# * marker<~String> - Indicates where to begin in your list of hosted zones.
|
13
|
+
# * max_items<~Integer> - The maximum number of hosted zones to be included in the response body
|
14
|
+
#
|
15
|
+
# ==== Returns
|
16
|
+
# * response<~Excon::Response>:
|
17
|
+
# * body<~Hash>:
|
18
|
+
# * 'HostedZones'<~Array>:
|
19
|
+
# * 'HostedZone'<~Hash>:
|
20
|
+
# * 'Id'<~String> -
|
21
|
+
# * 'Name'<~String> -
|
22
|
+
# * 'CallerReference'<~String>
|
23
|
+
# * 'Comment'<~String> -
|
24
|
+
# * 'Marker'<~String> -
|
25
|
+
# * 'MaxItems'<~Integer> -
|
26
|
+
# * 'IsTruncated'<~String> -
|
27
|
+
# * 'NextMarket'<~String>
|
28
|
+
# * status<~Integer> - 200 when successful
|
29
|
+
def list_hosted_zones(options = {})
|
30
|
+
|
31
|
+
parameters = {}
|
32
|
+
options.each { |option, value|
|
33
|
+
case option
|
34
|
+
when :marker
|
35
|
+
parameters[option] = value
|
36
|
+
when :max_items
|
37
|
+
parameters[:maxitems] = value
|
38
|
+
end
|
39
|
+
}
|
40
|
+
|
41
|
+
request({
|
42
|
+
:query => parameters,
|
43
|
+
:parser => Fog::Parsers::AWS::DNS::ListHostedZones.new,
|
44
|
+
:expects => 200,
|
45
|
+
:method => 'GET',
|
46
|
+
:path => "hostedzone"
|
47
|
+
})
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
class Mock
|
55
|
+
|
56
|
+
def list_hosted_zones(options = {})
|
57
|
+
Fog::Mock.not_implemented
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class DNS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
require 'fog/aws/parsers/dns/list_resource_record_sets'
|
7
|
+
|
8
|
+
# list your resource record sets
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# * zone_id<~String> -
|
12
|
+
# * options<~Hash>
|
13
|
+
# * type<~String> -
|
14
|
+
# * name<~String> -
|
15
|
+
# * max_items<~Integer> -
|
16
|
+
#
|
17
|
+
# ==== Returns
|
18
|
+
# * response<~Excon::Response>:
|
19
|
+
# * body<~Hash>:
|
20
|
+
# * 'ResourceRecordSet'<~Array>:
|
21
|
+
# * 'Name'<~String> -
|
22
|
+
# * 'Type'<~String> -
|
23
|
+
# * 'TTL'<~Integer> -
|
24
|
+
# * 'ResourceRecords'<~Array>
|
25
|
+
# * 'Value'<~String> -
|
26
|
+
# * 'IsTruncated'<~String> -
|
27
|
+
# * 'MaxItems'<~String> -
|
28
|
+
# * 'NextRecordName'<~String>
|
29
|
+
# * 'NexRecordType'<~String>
|
30
|
+
# * status<~Integer> - 201 when successful
|
31
|
+
def list_resource_record_sets(zone_id, options = {})
|
32
|
+
|
33
|
+
# AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use
|
34
|
+
# that form or just the actual id (which is what this request needs)
|
35
|
+
zone_id = zone_id.sub('/hostedzone/', '')
|
36
|
+
|
37
|
+
parameters = {}
|
38
|
+
options.each { |option, value|
|
39
|
+
case option
|
40
|
+
when :type, :name
|
41
|
+
parameters[option]= "#{value}"
|
42
|
+
when :max_items
|
43
|
+
parameters['maxitems']= "#{value}"
|
44
|
+
end
|
45
|
+
}
|
46
|
+
|
47
|
+
request({
|
48
|
+
:query => parameters,
|
49
|
+
:parser => Fog::Parsers::AWS::DNS::ListResourceRecordSets.new,
|
50
|
+
:expects => 200,
|
51
|
+
:method => 'GET',
|
52
|
+
:path => "hostedzone/#{zone_id}/rrset"
|
53
|
+
})
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class Mock
|
60
|
+
|
61
|
+
def list_resource_record_sets(zone_id, options = {})
|
62
|
+
Fog::Mock.not_implemented
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
:headers => {},
|
29
29
|
:host => @host,
|
30
30
|
:method => 'GET',
|
31
|
-
:path =>
|
31
|
+
:path => "#{bucket_name}/#{object_name}"
|
32
32
|
}, expires)
|
33
33
|
end
|
34
34
|
|
@@ -47,7 +47,7 @@ module Fog
|
|
47
47
|
:headers => {},
|
48
48
|
:host => @host,
|
49
49
|
:method => 'GET',
|
50
|
-
:path =>
|
50
|
+
:path => "#{bucket_name}/#{object_name}"
|
51
51
|
}, expires)
|
52
52
|
end
|
53
53
|
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
:headers => {},
|
29
29
|
:host => @host,
|
30
30
|
:method => 'PUT',
|
31
|
-
:path =>
|
31
|
+
:path => "#{bucket_name}/#{object_name}"
|
32
32
|
}, expires)
|
33
33
|
end
|
34
34
|
|
@@ -47,7 +47,7 @@ module Fog
|
|
47
47
|
:headers => {},
|
48
48
|
:host => @host,
|
49
49
|
:method => 'PUT',
|
50
|
-
:path =>
|
50
|
+
:path => "#{bucket_name}/#{object_name}"
|
51
51
|
}, expires)
|
52
52
|
end
|
53
53
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class Storage
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Sync clock against S3 to avoid skew errors
|
7
|
+
#
|
8
|
+
def sync_clock
|
9
|
+
response = begin
|
10
|
+
get_service
|
11
|
+
rescue => error
|
12
|
+
error.response
|
13
|
+
end
|
14
|
+
Fog::Time.now = Time.parse(response.headers['Date'])
|
15
|
+
end
|
16
|
+
|
17
|
+
end # Real
|
18
|
+
|
19
|
+
class Mock # :nodoc:all
|
20
|
+
|
21
|
+
def sync_clock
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
end # Mock
|
26
|
+
end # Storage
|
27
|
+
end # AWS
|
28
|
+
end # Fog
|
data/lib/fog/aws/simpledb.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class SimpleDB < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :host, :nil_string, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
+
recognizes :host, :nil_string, :path, :port, :scheme, :persistent
|
7
7
|
|
8
8
|
request_path 'fog/aws/requests/simpledb'
|
9
9
|
request :batch_put_attributes
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class Storage < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
+
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
|
7
7
|
|
8
8
|
model_path 'fog/aws/models/storage'
|
9
9
|
collection :directories
|
@@ -42,6 +42,7 @@ module Fog
|
|
42
42
|
request :put_object_acl
|
43
43
|
request :put_object_url
|
44
44
|
request :put_request_payment
|
45
|
+
request :sync_clock
|
45
46
|
request :upload_part
|
46
47
|
|
47
48
|
module Utils
|
@@ -81,7 +82,8 @@ module Fog
|
|
81
82
|
query << "Signature=#{CGI.escape(signature(params))}"
|
82
83
|
query << "Expires=#{params[:headers]['Date']}"
|
83
84
|
bucket = params[:host].split('.').first
|
84
|
-
|
85
|
+
path = CGI.escape(params[:path]).gsub('%2F', '/')
|
86
|
+
"https://#{@host}/#{path}?#{query.join('&')}"
|
85
87
|
end
|
86
88
|
|
87
89
|
end
|
data/lib/fog/bluebox.rb
CHANGED
data/lib/fog/bluebox/compute.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Bluebox
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :bluebox_api_key, :bluebox_customer_id
|
6
|
-
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
5
|
+
requires :bluebox_api_key, :bluebox_customer_id
|
6
|
+
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
7
7
|
|
8
8
|
model_path 'fog/bluebox/models/compute'
|
9
9
|
model :flavor
|
data/lib/fog/brightbox.rb
CHANGED
@@ -4,8 +4,8 @@ module Fog
|
|
4
4
|
|
5
5
|
API_URL = "https://api.gb1.brightbox.com/"
|
6
6
|
|
7
|
-
requires :brightbox_client_id, :brightbox_secret
|
8
|
-
recognizes :brightbox_auth_url, :brightbox_api_url
|
7
|
+
requires :brightbox_client_id, :brightbox_secret
|
8
|
+
recognizes :brightbox_auth_url, :brightbox_api_url
|
9
9
|
|
10
10
|
model_path 'fog/brightbox/models/compute'
|
11
11
|
model :account # Singular resource, no collection
|
data/lib/fog/core.rb
CHANGED
@@ -1,13 +1,33 @@
|
|
1
|
+
__LIB_DIR__ = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift __LIB_DIR__ unless
|
4
|
+
$LOAD_PATH.include?(__LIB_DIR__) ||
|
5
|
+
$LOAD_PATH.include?(File.expand_path(__LIB_DIR__))
|
6
|
+
|
7
|
+
# external core dependencies
|
8
|
+
require 'rubygems'
|
9
|
+
require 'base64'
|
10
|
+
require 'cgi'
|
11
|
+
require 'excon'
|
12
|
+
require 'formatador'
|
13
|
+
require 'time'
|
14
|
+
require 'timeout'
|
15
|
+
|
16
|
+
# internal core dependencies
|
1
17
|
require 'fog/core/attributes'
|
2
18
|
require 'fog/core/collection'
|
3
19
|
require 'fog/core/compute'
|
4
20
|
require 'fog/core/connection'
|
21
|
+
require 'fog/core/credentials'
|
5
22
|
require 'fog/core/deprecation'
|
6
23
|
require 'fog/core/errors'
|
7
24
|
require 'fog/core/hmac'
|
8
25
|
require 'fog/core/model'
|
26
|
+
require 'fog/core/mock'
|
9
27
|
# require 'fog/core/parser'
|
10
28
|
require 'fog/core/provider'
|
11
29
|
require 'fog/core/service'
|
12
30
|
require 'fog/core/ssh'
|
13
|
-
require 'fog/core/storage'
|
31
|
+
require 'fog/core/storage'
|
32
|
+
require 'fog/core/time'
|
33
|
+
require 'fog/core/wait_for'
|
data/lib/fog/core/bin.rb
CHANGED
@@ -15,7 +15,8 @@ module Fog
|
|
15
15
|
::NewServers,
|
16
16
|
::Rackspace,
|
17
17
|
::Slicehost,
|
18
|
-
::Terremark
|
18
|
+
::Terremark,
|
19
|
+
::Zerigo
|
19
20
|
].select {|provider| provider.available?}
|
20
21
|
end
|
21
22
|
|
@@ -83,3 +84,4 @@ require 'fog/rackspace/bin'
|
|
83
84
|
require 'fog/slicehost/bin'
|
84
85
|
require 'fog/terremark/bin'
|
85
86
|
require 'fog/vcloud/bin'
|
87
|
+
require 'fog/zerigo/bin'
|
data/lib/fog/core/compute.rb
CHANGED
data/lib/fog/core/credentials.rb
CHANGED
@@ -1,61 +1,83 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
|
2
3
|
module Fog
|
3
|
-
|
4
|
+
require 'fog/core/deprecation'
|
5
|
+
extend Fog::Deprecation
|
6
|
+
self_deprecate(:config_path, :credentials_path)
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
# Assign a new credential to use from configuration file
|
9
|
+
# @param [String, Symbol] new_credential name of new credential to use
|
10
|
+
# @ return [String, Symbol] name of the new credential
|
11
|
+
def self.credential=(new_credential)
|
12
|
+
@credential = new_credential
|
13
|
+
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
15
|
+
# @return [String, Symbol] The credential to use in Fog
|
16
|
+
def self.credential
|
17
|
+
@credential ||= :default
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [String] The path for configuration_file
|
21
|
+
def self.credentials_path
|
22
|
+
@credential_path ||= File.expand_path(ENV["FOG_RC"] || '~/.fog')
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String] The new path for credentials file
|
26
|
+
def self.credentials_path=(new_credentials_path)
|
27
|
+
@credential_path = new_credentials_path
|
28
|
+
end
|
13
29
|
|
14
|
-
|
15
|
-
|
30
|
+
# @return [Hash] The credentials pulled from the configuration file
|
31
|
+
# @raise [LoadError] Configuration unavailable in configuration file
|
32
|
+
def self.credentials
|
33
|
+
@credentials ||= begin
|
34
|
+
credentials = YAML.load_file(credentials_path)
|
35
|
+
(credentials && credentials[credential]) or raise LoadError.new missing_credentials
|
16
36
|
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# @return [String] The error message that will be raised, if credentials cannot be found
|
42
|
+
def self.missing_credentials
|
43
|
+
<<-YML
|
44
|
+
Missing Credentials
|
17
45
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
unless credentials && credentials[credential]
|
29
|
-
print("\n To run as '#{credential}', add the following to #{config_path}\n")
|
30
|
-
yml = <<-YML
|
46
|
+
To run as '#{credential}', add the following to your resource config file: #{config_path}
|
47
|
+
An alternate file may be used by placing its path in the FOG_RC environment variable
|
48
|
+
|
49
|
+
#######################################################
|
50
|
+
# Fog Credentials File
|
51
|
+
#
|
52
|
+
# Key-value pairs should look like:
|
53
|
+
# :aws_access_key_id: 022QF06E7MXBSAMPLE
|
31
54
|
:#{credential}:
|
32
|
-
:aws_access_key_id:
|
33
|
-
:aws_secret_access_key:
|
34
|
-
:bluebox_api_key:
|
35
|
-
:bluebox_customer_id:
|
36
|
-
:brightbox_client_id:
|
37
|
-
:brightbox_secret:
|
38
|
-
:go_grid_api_key:
|
39
|
-
:go_grid_shared_secret:
|
40
|
-
:google_storage_access_key_id:
|
41
|
-
:google_storage_secret_access_key:
|
42
|
-
:local_root:
|
43
|
-
:new_servers_password:
|
44
|
-
:new_servers_username:
|
45
|
-
:public_key_path:
|
46
|
-
:private_key_path:
|
47
|
-
:rackspace_api_key:
|
48
|
-
:rackspace_username:
|
49
|
-
:slicehost_password:
|
50
|
-
:terremark_username:
|
51
|
-
:terremark_password:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
55
|
+
:aws_access_key_id:
|
56
|
+
:aws_secret_access_key:
|
57
|
+
:bluebox_api_key:
|
58
|
+
:bluebox_customer_id:
|
59
|
+
:brightbox_client_id:
|
60
|
+
:brightbox_secret:
|
61
|
+
:go_grid_api_key:
|
62
|
+
:go_grid_shared_secret:
|
63
|
+
:google_storage_access_key_id:
|
64
|
+
:google_storage_secret_access_key:
|
65
|
+
:local_root:
|
66
|
+
:new_servers_password:
|
67
|
+
:new_servers_username:
|
68
|
+
:public_key_path:
|
69
|
+
:private_key_path:
|
70
|
+
:rackspace_api_key:
|
71
|
+
:rackspace_username:
|
72
|
+
:slicehost_password:
|
73
|
+
:terremark_username:
|
74
|
+
:terremark_password:
|
75
|
+
:zerigo_email:
|
76
|
+
:zerigo_token:
|
77
|
+
#
|
78
|
+
# End of Fog Credentials File
|
79
|
+
#######################################################
|
59
80
|
|
81
|
+
YML
|
60
82
|
end
|
61
83
|
end
|