fog 0.3.34 → 0.4.0
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/Gemfile.lock +6 -6
- data/README.rdoc +26 -7
- data/Rakefile +7 -1
- data/examples/dns_tests.rb +76 -0
- data/examples/{storage.rb → storage_tests.rb} +15 -15
- data/fog.gemspec +4 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +19 -54
- data/lib/fog/aws/dns.rb +5 -1
- data/lib/fog/aws/models/compute/security_group.rb +128 -0
- data/lib/fog/aws/models/dns/record.rb +64 -0
- data/lib/fog/aws/models/dns/records.rb +47 -0
- data/lib/fog/aws/models/dns/zone.rb +53 -0
- data/lib/fog/aws/models/dns/zones.rb +33 -0
- data/lib/fog/aws/models/storage/file.rb +14 -2
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +1 -1
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +3 -1
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -0
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +0 -2
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -0
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +1 -0
- data/lib/fog/aws/requests/simpledb/list_domains.rb +3 -2
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -0
- data/lib/fog/brightbox/compute.rb +9 -0
- data/lib/fog/brightbox/models/compute/load_balancer.rb +50 -0
- data/lib/fog/brightbox/models/compute/load_balancers.rb +28 -0
- data/lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/create_load_balancer.rb +27 -0
- data/lib/fog/brightbox/requests/compute/destroy_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/get_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/list_load_balancers.rb +27 -0
- data/lib/fog/brightbox/requests/compute/remove_nodes_load_balancer.rb +28 -0
- data/lib/fog/brightbox/requests/compute/update_load_balancer.rb +29 -0
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/dns.rb +25 -0
- data/lib/fog/core/mock.rb +34 -0
- data/lib/fog/google/models/storage/file.rb +14 -2
- data/lib/fog/linode/dns.rb +4 -0
- data/lib/fog/linode/models/dns/record.rb +69 -0
- data/lib/fog/linode/models/dns/records.rb +37 -0
- data/lib/fog/linode/models/dns/zone.rb +84 -0
- data/lib/fog/linode/models/dns/zones.rb +29 -0
- data/lib/fog/linode/requests/dns/domain_create.rb +2 -3
- data/lib/fog/linode/requests/dns/domain_resource_create.rb +3 -4
- data/lib/fog/linode/requests/dns/domain_resource_list.rb +5 -2
- data/lib/fog/linode/requests/dns/domain_resource_update.rb +2 -2
- data/lib/fog/linode/requests/dns/domain_update.rb +2 -2
- data/lib/fog/rackspace/requests/compute/create_image.rb +1 -1
- data/lib/fog/rackspace/requests/compute/create_server.rb +1 -1
- data/lib/fog/rackspace/requests/compute/get_flavor_details.rb +19 -1
- data/lib/fog/rackspace/requests/compute/list_flavors.rb +14 -1
- data/lib/fog/rackspace/requests/compute/list_flavors_detail.rb +14 -1
- data/lib/fog/slicehost/bin.rb +1 -1
- data/lib/fog/slicehost/dns.rb +4 -0
- data/lib/fog/slicehost/models/dns/record.rb +66 -0
- data/lib/fog/slicehost/models/dns/records.rb +36 -0
- data/lib/fog/slicehost/models/dns/zone.rb +69 -0
- data/lib/fog/slicehost/models/dns/zones.rb +28 -0
- data/lib/fog/slicehost/requests/dns/create_record.rb +2 -3
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud.rb +1 -1
- data/lib/fog/zerigo/models/dns/record.rb +14 -3
- data/lib/fog/zerigo/models/dns/records.rb +1 -1
- data/lib/fog/zerigo/models/dns/zone.rb +7 -1
- data/lib/fog/zerigo/models/dns/zones.rb +1 -1
- data/spec/spec_helper.rb +0 -24
- data/tests/aws/requests/iam/helper.rb +15 -0
- data/tests/aws/requests/simpledb/attributes_tests.rb +75 -0
- data/tests/aws/requests/simpledb/domain_tests.rb +51 -0
- data/tests/aws/requests/simpledb/helper.rb +16 -0
- data/tests/compute/helper.rb +36 -0
- data/tests/compute/models/flavors_tests.rb +9 -0
- data/tests/compute/models/server_tests.rb +9 -0
- data/tests/compute/models/servers_tests.rb +9 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/address_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/availability_zone_tests.rb +0 -0
- data/tests/{aws → compute/requests/aws}/helper.rb +0 -12
- data/tests/{aws/requests/compute → compute/requests/aws}/image_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/instance_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/key_pair_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/region_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/security_group_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/snapshot_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/tag_tests.rb +0 -0
- data/tests/{aws/requests/compute → compute/requests/aws}/volume_tests.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/block_tests.rb +0 -0
- data/tests/{bluebox → compute/requests/bluebox}/helper.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/product_tests.rb +0 -0
- data/tests/{bluebox/requests/compute → compute/requests/bluebox}/template_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/account_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/api_client_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/cloud_ip_tests.rb +15 -7
- data/tests/{brightbox → compute/requests/brightbox}/helper.rb +68 -22
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/image_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/interface_tests.rb +0 -0
- data/tests/compute/requests/brightbox/load_balancer_tests.rb +74 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/server_tests.rb +1 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/server_type_tests.rb +1 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/user_tests.rb +0 -0
- data/tests/{brightbox/requests/compute → compute/requests/brightbox}/zone_tests.rb +1 -0
- data/tests/{go_grid/requests/compute → compute/requests/go_grid}/image_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/datacenter_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/distribution_tests.rb +0 -0
- data/tests/{linode → compute/requests/linode}/helper.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/linode_tests.rb +0 -0
- data/tests/{linode/requests/compute → compute/requests/linode}/linodeplans_tests.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/address_tests.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/flavor_tests.rb +0 -0
- data/tests/{rackspace → compute/requests/rackspace}/helper.rb +0 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/image_tests.rb +7 -9
- data/tests/compute/requests/rackspace/resize_tests.rb +33 -0
- data/tests/{rackspace/requests/compute → compute/requests/rackspace}/server_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/backup_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/flavor_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/image_tests.rb +0 -0
- data/tests/{slicehost/requests/compute → compute/requests/slicehost}/slice_tests.rb +0 -0
- data/tests/dns/helper.rb +19 -0
- data/tests/dns/models/record_tests.rb +25 -0
- data/tests/dns/models/records_tests.rb +25 -0
- data/tests/dns/models/zone_tests.rb +13 -0
- data/tests/dns/models/zones_tests.rb +13 -0
- data/tests/{aws/requests/dns → dns/requests/aws}/dns_tests.rb +0 -0
- data/tests/{linode/requests/dns → dns/requests/linode}/dns_tests.rb +0 -0
- data/tests/{slicehost/requests/dns_tests → dns/requests/slicehost}/dns_tests.rb +0 -0
- data/tests/{zerigo/requests/dns → dns/requests/zerigo}/dns_tests.rb +0 -0
- data/tests/helper.rb +1 -100
- data/tests/helpers/{collection_tests.rb → collection_helper.rb} +0 -0
- data/tests/helpers/compute/{flavors_tests.rb → flavors_helper.rb} +0 -0
- data/tests/helpers/compute/{server_tests.rb → server_helper.rb} +0 -0
- data/tests/helpers/compute/{servers_tests.rb → servers_helper.rb} +0 -0
- data/tests/helpers/formats_helper.rb +68 -0
- data/tests/{helper_tests.rb → helpers/formats_helper_tests.rb} +0 -0
- data/tests/helpers/{model_tests.rb → model_helper.rb} +0 -0
- data/tests/helpers/responds_to_helper.rb +13 -0
- data/tests/helpers/succeeds_helper.rb +12 -0
- data/tests/storage/helper.rb +16 -0
- data/tests/storage/models/directories_tests.rb +13 -0
- data/tests/storage/models/directory_test.rb +24 -0
- data/tests/storage/models/file_tests.rb +41 -0
- data/tests/storage/models/files_tests.rb +26 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/bucket_tests.rb +0 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/multipart_upload_tests.rb +0 -0
- data/tests/{aws/requests/storage → storage/requests/aws}/object_tests.rb +0 -0
- data/tests/{google/requests/storage → storage/requests/google}/bucket_tests.rb +0 -0
- data/tests/{google/requests/storage → storage/requests/google}/object_tests.rb +0 -0
- data/tests/{rackspace/requests/storage → storage/requests/rackspace}/container_tests.rb +0 -0
- data/tests/{rackspace/requests/storage → storage/requests/rackspace}/object_tests.rb +0 -0
- metadata +195 -224
- data/examples/bluebox_create.rb +0 -33
- data/examples/dns_methods.rb +0 -389
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +0 -31
- data/spec/aws/requests/simpledb/create_domain_spec.rb +0 -29
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +0 -39
- data/spec/aws/requests/simpledb/delete_domain_spec.rb +0 -28
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +0 -52
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +0 -67
- data/spec/aws/requests/simpledb/list_domains_spec.rb +0 -30
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +0 -49
- data/spec/aws/requests/simpledb/select_spec.rb +0 -27
- data/tests/aws/models/compute/flavors_tests.rb +0 -5
- data/tests/aws/models/compute/server_tests.rb +0 -6
- data/tests/aws/models/compute/servers_tests.rb +0 -6
- data/tests/aws/models/storage/directories_tests.rb +0 -5
- data/tests/aws/models/storage/directory_tests.rb +0 -5
- data/tests/aws/models/storage/file_tests.rb +0 -5
- data/tests/aws/models/storage/files_tests.rb +0 -5
- data/tests/bluebox/models/compute/flavors_tests.rb +0 -5
- data/tests/bluebox/models/compute/server_tests.rb +0 -5
- data/tests/bluebox/models/compute/servers_tests.rb +0 -6
- data/tests/brightbox/models/compute/flavors_tests.rb +0 -5
- data/tests/brightbox/models/compute/server_tests.rb +0 -6
- data/tests/brightbox/models/compute/servers_tests.rb +0 -6
- data/tests/go_grid/helper.rb +0 -0
- data/tests/google/models/storage/directories_tests.rb +0 -5
- data/tests/google/models/storage/directory_tests.rb +0 -5
- data/tests/google/models/storage/file_tests.rb +0 -5
- data/tests/google/models/storage/files_tests.rb +0 -5
- data/tests/helpers/storage/directories_tests.rb +0 -7
- data/tests/helpers/storage/directory_tests.rb +0 -18
- data/tests/helpers/storage/file_tests.rb +0 -27
- data/tests/helpers/storage/files_tests.rb +0 -13
- data/tests/local/models/storage/directories_tests.rb +0 -5
- data/tests/local/models/storage/directory_tests.rb +0 -5
- data/tests/local/models/storage/file_tests.rb +0 -5
- data/tests/local/models/storage/files_tests.rb +0 -5
- data/tests/rackspace/models/compute/flavors_tests.rb +0 -5
- data/tests/rackspace/models/compute/server_tests.rb +0 -6
- data/tests/rackspace/models/compute/servers_tests.rb +0 -6
- data/tests/rackspace/models/storage/directories_tests.rb +0 -5
- data/tests/rackspace/models/storage/directory_tests.rb +0 -5
- data/tests/rackspace/models/storage/file_tests.rb +0 -5
- data/tests/rackspace/models/storage/files_tests.rb +0 -5
- data/tests/rackspace/requests/compute/resize_tests.rb +0 -47
- data/tests/slicehost/helper.rb +0 -1
- data/tests/slicehost/models/compute/flavors_tests.rb +0 -5
- data/tests/slicehost/models/compute/server_tests.rb +0 -6
- data/tests/slicehost/models/compute/servers_tests.rb +0 -6
- data/tests/zerigo/helper.rb +0 -0
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fog (0.
|
4
|
+
fog (0.4.0)
|
5
5
|
builder
|
6
|
-
excon (>= 0.3.
|
6
|
+
excon (>= 0.3.7)
|
7
7
|
formatador (>= 0.0.16)
|
8
8
|
json
|
9
9
|
mime-types
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
remote: http://rubygems.org/
|
16
16
|
specs:
|
17
17
|
builder (3.0.0)
|
18
|
-
excon (0.3.
|
18
|
+
excon (0.3.7)
|
19
19
|
formatador (0.0.16)
|
20
20
|
gestalt (0.0.11)
|
21
21
|
formatador (>= 0.0.12)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
rake (0.8.7)
|
27
27
|
rspec (1.3.1)
|
28
28
|
ruby-hmac (0.4.0)
|
29
|
-
shindo (0.1.
|
29
|
+
shindo (0.1.12)
|
30
30
|
formatador (>= 0.0.16)
|
31
31
|
gestalt (>= 0.0.11)
|
32
32
|
|
@@ -35,7 +35,7 @@ PLATFORMS
|
|
35
35
|
|
36
36
|
DEPENDENCIES
|
37
37
|
builder
|
38
|
-
excon (>= 0.3.
|
38
|
+
excon (>= 0.3.7)
|
39
39
|
fog!
|
40
40
|
formatador (>= 0.0.16)
|
41
41
|
json
|
@@ -45,4 +45,4 @@ DEPENDENCIES
|
|
45
45
|
rake
|
46
46
|
rspec (= 1.3.1)
|
47
47
|
ruby-hmac
|
48
|
-
shindo (= 0.1.
|
48
|
+
shindo (= 0.1.12)
|
data/README.rdoc
CHANGED
@@ -27,9 +27,13 @@ A high level interface to each cloud is provided through collections, such as `i
|
|
27
27
|
You can see a list of available collections by calling `collections` on the connection object. You can try it out using the `fog` command:
|
28
28
|
|
29
29
|
>> AWS.collections
|
30
|
-
[:addresses, :directories,
|
30
|
+
[:addresses, :directories, ..., :volumes, :zones]
|
31
31
|
|
32
|
-
Some collections are available across multiple providers
|
32
|
+
Some collections are available across multiple providers:
|
33
|
+
|
34
|
+
* compute providers have +flavors+, +images+ and +servers+
|
35
|
+
* dns providers have +zones+ and +records+
|
36
|
+
* storage providers have +directories+ and +files+
|
33
37
|
|
34
38
|
Collections share basic CRUD type operations, such as:
|
35
39
|
* +all+ - fetch every object of that type from the provider.
|
@@ -99,21 +103,28 @@ Play around and use the console to explore or check out the {getting started gui
|
|
99
103
|
|
100
104
|
geemus says: "That should give you everything you need to get started, but let me know if there is anything I can do to help!"
|
101
105
|
|
106
|
+
== Providers
|
107
|
+
|
102
108
|
You should try out the (varying) support fog has for:
|
103
109
|
* {AWS}[http://aws.amazon.com] [{Compute}[http://aws.amazon.com/ec2], {ELB}[http://aws.amazon.com/elasticloadbalancing], {Storage}[http://aws.amazon.com/s3], {SimpleDB}[http://aws.amazon.com/simpledb]]
|
104
|
-
* {Blue Box Group}[http://www.blueboxgrp.com] [{Compute}[http://www.blueboxgrp.com/blocks]]
|
105
|
-
* {Brightbox}[http://www.brightbox.co.uk] [{Compute}[http://beta.brightbox.com/]]
|
110
|
+
* <b><em>{Blue Box Group}[http://www.blueboxgrp.com]</em></b> [{Compute}[http://www.blueboxgrp.com/blocks]]
|
111
|
+
* <b><em>{Brightbox}[http://www.brightbox.co.uk]</em></b> [{Compute}[http://beta.brightbox.com/]]
|
106
112
|
* {Google}[http://www.google.com] [{Storage}[http://code.google.com/apis/storage]]
|
113
|
+
* {Linode}[http://www.linode.com] [{DNS}[http://www.linode.com]]
|
107
114
|
* Local [Storage]
|
108
115
|
* {Rackspace}[http://www.rackspace.com] [{Compute}[http://www.rackspacecloud.com/cloud_hosting_products/servers], {Storage}[http://www.rackspacecloud.com/cloud_hosting_products/files]]
|
109
116
|
* {Slicehost}[http://www.slicehost.com] [{Compute}[http://www.slicehost.com], {DNS}[http://www.slicehost.com]]
|
110
117
|
* {Terremark}[http://www.terremark.com] [{vCloud Express}[http://vcloudexpress.terremark.com]]
|
118
|
+
* {Zerigo}[http://www.zerigo.com] [{DNS}[http://www.zerigo.com/managed-dns]]
|
111
119
|
|
112
120
|
There are also the basics of these providers (that could use your love):
|
113
|
-
* {GoGrid}[http://www.gogrid.com] [{Compute}[http://www.gogrid.com]]
|
114
|
-
* {Linode}[http://www.linode.com] [{Compute}[http://www.linode.com]
|
121
|
+
* <b><em>{GoGrid}[http://www.gogrid.com]</b></em> [{Compute}[http://www.gogrid.com]]
|
122
|
+
* {Linode}[http://www.linode.com] [{Compute}[http://www.linode.com]]
|
115
123
|
* {New Servers}[http://www.newservers.com] [{Compute}[http://www.newservers.com]]
|
116
|
-
|
124
|
+
|
125
|
+
Special thanks to providers listed in <b><em>bold italics</em></b> for donating resources for fog tests!
|
126
|
+
|
127
|
+
== Additional Resources
|
117
128
|
|
118
129
|
Enjoy, and let me know what I can do to continue improving fog!
|
119
130
|
|
@@ -131,6 +142,14 @@ http://www.engineyard.com/images/logo.png
|
|
131
142
|
|
132
143
|
All new work on fog is sponsored by {Engine Yard}[http://engineyard.com]
|
133
144
|
|
145
|
+
== T-Shirts
|
146
|
+
|
147
|
+
Wonder how you can get a shirt? Look no further!
|
148
|
+
|
149
|
+
* Blue shirts go to people who have contributed indirectly, where contribution is a judgement call on geemus's part (but he is a pretty nice guy).
|
150
|
+
* Grey shirts and a follow from @fog go to people who have made it on to the {contributors list}[https://github.com/geemus/fog/contributors] by submitting code.
|
151
|
+
* Black shirts go to people who have made it on to the {collaborators list}[https://github.com/api/v2/json/repos/show/geemus/fog/collaborators] by coercing geemus into adding them (geemus is currently the only member of this list).
|
152
|
+
|
134
153
|
== Copyright
|
135
154
|
|
136
155
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -45,7 +45,13 @@ end
|
|
45
45
|
|
46
46
|
task :default => :test
|
47
47
|
|
48
|
-
task :
|
48
|
+
task :examples do
|
49
|
+
sh("export FOG_MOCK=false && bundle exec shindont examples")
|
50
|
+
# some don't provide mocks so we'll leave this out for now
|
51
|
+
# sh("export FOG_MOCK=true && bundle exec shindont examples")
|
52
|
+
end
|
53
|
+
|
54
|
+
task :test => :examples do
|
49
55
|
sh("export FOG_MOCK=true && bundle exec spec spec") &&
|
50
56
|
sh("export FOG_MOCK=true && bundle exec shindont tests") &&
|
51
57
|
sh("export FOG_MOCK=false && bundle exec spec spec") &&
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'shindo'
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
|
5
|
+
require File.join(File.dirname(__FILE__), '..', 'tests', 'helper')
|
6
|
+
|
7
|
+
Shindo.tests('dns tests', 'dns') do
|
8
|
+
|
9
|
+
# iterate over all the providers
|
10
|
+
Fog.providers.each do |provider|
|
11
|
+
|
12
|
+
# skip if provider does not have storage
|
13
|
+
next unless provider.respond_to?(:services) && provider.services.include?(:dns)
|
14
|
+
|
15
|
+
tests(provider, provider.to_s.downcase) do
|
16
|
+
|
17
|
+
# use shortcuts to instantiate connection
|
18
|
+
@dns = Fog::DNS.new(:provider => provider.to_s)
|
19
|
+
|
20
|
+
# create a zone
|
21
|
+
# domain should be the hostname
|
22
|
+
# email is only required for linode, but included for consistency
|
23
|
+
tests('@zone = @dns.zones.create').succeeds do
|
24
|
+
@zone = @dns.zones.create(
|
25
|
+
:domain => 'fogdnsexamples.com',
|
26
|
+
:email => 'tests@fogdnsexamples.com'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
# create a record in the zone
|
31
|
+
# ip is the address to route to
|
32
|
+
# name is the name for the record
|
33
|
+
# type is the type of record to create
|
34
|
+
tests('@record = @zone.records.create').succeeds do
|
35
|
+
@record = @zone.records.create(
|
36
|
+
:ip => '1.2.3.4',
|
37
|
+
:name => 'www.fogdnsexamples.com',
|
38
|
+
:type => 'A'
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# list zones
|
43
|
+
tests('@zones = @dns.zones').succeeds do
|
44
|
+
@zones = @dns.zones
|
45
|
+
end
|
46
|
+
|
47
|
+
# get a zone
|
48
|
+
tests('@dns.zones.get(@zone.identity)').succeeds do
|
49
|
+
@dns.zones.get(@zone.identity)
|
50
|
+
end
|
51
|
+
|
52
|
+
# list records
|
53
|
+
tests('@records = @zone.records').succeeds do
|
54
|
+
@records = @zone.records
|
55
|
+
end
|
56
|
+
|
57
|
+
# get a record
|
58
|
+
tests('@zone.records.get(@record.identity)').succeeds do
|
59
|
+
@zone.records.get(@record.identity)
|
60
|
+
end
|
61
|
+
|
62
|
+
# destroy the record
|
63
|
+
tests('@record.destroy').succeeds do
|
64
|
+
@record.destroy
|
65
|
+
end
|
66
|
+
|
67
|
+
# destroy the zone
|
68
|
+
tests('@zone.destroy').succeeds do
|
69
|
+
@zone.destroy
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -9,8 +9,8 @@ Shindo.tests('storage tests', 'storage') do
|
|
9
9
|
# iterate over all the providers
|
10
10
|
Fog.providers.each do |provider|
|
11
11
|
|
12
|
-
#
|
13
|
-
|
12
|
+
# skip if provider does not have storage
|
13
|
+
next unless provider.respond_to?(:services) && provider.services.include?(:storage)
|
14
14
|
|
15
15
|
tests(provider, provider.to_s.downcase) do
|
16
16
|
|
@@ -25,13 +25,23 @@ Shindo.tests('storage tests', 'storage') do
|
|
25
25
|
# create a directory
|
26
26
|
# key should be a unique string
|
27
27
|
# public should be a boolean
|
28
|
-
tests('@directory = @directories.create').succeeds do
|
28
|
+
tests('@directory = @storage.directories.create').succeeds do
|
29
29
|
@directory = @storage.directories.create(
|
30
30
|
:key => "fogstoragedirectory#{Time.now.to_i}",
|
31
31
|
:public => publicity
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
|
+
# list directories
|
36
|
+
tests('@directories = @storage.directories').succeeds do
|
37
|
+
@directories = @storage.directories
|
38
|
+
end
|
39
|
+
|
40
|
+
# get a directory
|
41
|
+
tests('@storage.directories.get(@directory.identity)').succeeds do
|
42
|
+
@storage.directories.get(@directory.identity)
|
43
|
+
end
|
44
|
+
|
35
45
|
# create a file in the directory
|
36
46
|
# key can be any string
|
37
47
|
# body can be a string or a file as File.open(path)
|
@@ -49,19 +59,9 @@ Shindo.tests('storage tests', 'storage') do
|
|
49
59
|
@files = @directory.files
|
50
60
|
end
|
51
61
|
|
52
|
-
# fetch the latest files data
|
53
|
-
tests('@files.reload').succeeds do
|
54
|
-
@files.reload
|
55
|
-
end
|
56
|
-
|
57
62
|
# get a file
|
58
|
-
tests('@directory.files.get(@file.
|
59
|
-
@directory.files.get(@file.
|
60
|
-
end
|
61
|
-
|
62
|
-
# fetch the latest file data
|
63
|
-
tests('@file.reload').succeeds do
|
64
|
-
@file.reload
|
63
|
+
tests('@directory.files.get(@file.identity)').succeeds do
|
64
|
+
@directory.files.get(@file.identity)
|
65
65
|
end
|
66
66
|
|
67
67
|
# test the publicity of files
|
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.
|
11
|
-
s.date = '
|
10
|
+
s.version = '0.4.0'
|
11
|
+
s.date = '2011-01-05'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
## List your runtime dependencies here. Runtime dependencies are those
|
44
44
|
## that are needed for an end user to actually USE your code.
|
45
45
|
s.add_dependency('builder')
|
46
|
-
s.add_dependency('excon', '>=0.3.
|
46
|
+
s.add_dependency('excon', '>=0.3.7')
|
47
47
|
s.add_dependency('formatador', '>=0.0.16')
|
48
48
|
s.add_dependency('json')
|
49
49
|
s.add_dependency('mime-types')
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
## those that are only needed during development
|
56
56
|
s.add_development_dependency('rake')
|
57
57
|
s.add_development_dependency('rspec', '1.3.1')
|
58
|
-
s.add_development_dependency('shindo', '0.1.
|
58
|
+
s.add_development_dependency('shindo', '0.1.12')
|
59
59
|
|
60
60
|
s.files = `git ls-files`.split("\n")
|
61
61
|
s.test_files = `git ls-files -- {spec,tests}/*`.split("\n")
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws.rb
CHANGED
@@ -68,7 +68,7 @@ module Fog
|
|
68
68
|
class Mock
|
69
69
|
|
70
70
|
def self.availability_zone
|
71
|
-
"us-east-1" << random_selection('abcd', 1)
|
71
|
+
"us-east-1" << Fog::Mock.random_selection('abcd', 1)
|
72
72
|
end
|
73
73
|
|
74
74
|
def self.box_usage
|
@@ -84,16 +84,16 @@ module Fog
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.etag
|
87
|
-
|
87
|
+
Fog::Mock.random_hex(32)
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.image
|
91
91
|
path = []
|
92
92
|
(rand(3) + 2).times do
|
93
|
-
path <<
|
93
|
+
path << Fog::Mock.random_letters(rand(9) + 8)
|
94
94
|
end
|
95
95
|
{
|
96
|
-
"imageOwnerId" =>
|
96
|
+
"imageOwnerId" => Fog::Mock.random_letters(rand(5) + 4),
|
97
97
|
"blockDeviceMapping" => [],
|
98
98
|
"productCodes" => [],
|
99
99
|
"kernelId" => kernel_id,
|
@@ -110,106 +110,71 @@ module Fog
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def self.image_id
|
113
|
-
"ami-#{
|
113
|
+
"ami-#{Fog::Mock.random_hex(8)}"
|
114
114
|
end
|
115
115
|
|
116
116
|
def self.key_fingerprint
|
117
117
|
fingerprint = []
|
118
118
|
20.times do
|
119
|
-
fingerprint <<
|
119
|
+
fingerprint << Fog::Mock.random_hex(2)
|
120
120
|
end
|
121
121
|
fingerprint.join(':')
|
122
122
|
end
|
123
123
|
|
124
124
|
def self.instance_id
|
125
|
-
"i-#{
|
125
|
+
"i-#{Fog::Mock.random_hex(8)}"
|
126
126
|
end
|
127
127
|
|
128
128
|
def self.ip_address
|
129
129
|
ip = []
|
130
130
|
4.times do
|
131
|
-
ip <<
|
131
|
+
ip << Fog::Mock.random_numbers(rand(3) + 1).to_i.to_s # remove leading 0
|
132
132
|
end
|
133
133
|
ip.join('.')
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.kernel_id
|
137
|
-
"aki-#{
|
137
|
+
"aki-#{Fog::Mock.random_hex(8)}"
|
138
138
|
end
|
139
139
|
|
140
140
|
def self.key_material
|
141
141
|
key_material = ['-----BEGIN RSA PRIVATE KEY-----']
|
142
142
|
20.times do
|
143
|
-
key_material <<
|
143
|
+
key_material << Fog::Mock.random_base64(76)
|
144
144
|
end
|
145
|
-
key_material <<
|
145
|
+
key_material << Fog::Mock.random_base64(67) + '='
|
146
146
|
key_material << '-----END RSA PRIVATE KEY-----'
|
147
147
|
key_material.join("\n")
|
148
148
|
end
|
149
149
|
|
150
150
|
def self.owner_id
|
151
|
-
|
151
|
+
Fog::Mock.random_numbers(12)
|
152
152
|
end
|
153
153
|
|
154
154
|
def self.ramdisk_id
|
155
|
-
"ari-#{
|
155
|
+
"ari-#{Fog::Mock.random_hex(8)}"
|
156
156
|
end
|
157
157
|
|
158
158
|
def self.request_id
|
159
159
|
request_id = []
|
160
|
-
request_id <<
|
160
|
+
request_id << Fog::Mock.random_hex(8)
|
161
161
|
3.times do
|
162
|
-
request_id <<
|
162
|
+
request_id << Fog::Mock.random_hex(4)
|
163
163
|
end
|
164
|
-
request_id <<
|
164
|
+
request_id << Fog::Mock.random_hex(12)
|
165
165
|
request_id.join('-')
|
166
166
|
end
|
167
167
|
|
168
168
|
def self.reservation_id
|
169
|
-
"r-#{
|
169
|
+
"r-#{Fog::Mock.random_hex(8)}"
|
170
170
|
end
|
171
171
|
|
172
172
|
def self.snapshot_id
|
173
|
-
"snap-#{
|
173
|
+
"snap-#{Fog::Mock.random_hex(8)}"
|
174
174
|
end
|
175
175
|
|
176
176
|
def self.volume_id
|
177
|
-
"vol-#{
|
178
|
-
end
|
179
|
-
|
180
|
-
private
|
181
|
-
|
182
|
-
def self.random_selection(characters, length)
|
183
|
-
selection = ''
|
184
|
-
length.times do
|
185
|
-
position = rand(characters.length)
|
186
|
-
selection << characters[position..position]
|
187
|
-
end
|
188
|
-
selection
|
189
|
-
end
|
190
|
-
|
191
|
-
def self.letters(length)
|
192
|
-
random_selection(
|
193
|
-
'abcdefghijklmnopqrstuvwxyz',
|
194
|
-
length
|
195
|
-
)
|
196
|
-
end
|
197
|
-
|
198
|
-
def self.numbers(length)
|
199
|
-
max = ('9' * length).to_i
|
200
|
-
rand(max).to_s
|
201
|
-
end
|
202
|
-
|
203
|
-
def self.hex(length)
|
204
|
-
max = ('f' * length).to_i(16)
|
205
|
-
rand(max).to_s(16).rjust(length, '0')
|
206
|
-
end
|
207
|
-
|
208
|
-
def self.base64(length)
|
209
|
-
random_selection(
|
210
|
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
211
|
-
length
|
212
|
-
)
|
177
|
+
"vol-#{Fog::Mock.random_hex(8)}"
|
213
178
|
end
|
214
179
|
|
215
180
|
end
|
data/lib/fog/aws/dns.rb
CHANGED
@@ -5,7 +5,11 @@ module Fog
|
|
5
5
|
requires :aws_access_key_id, :aws_secret_access_key
|
6
6
|
recognizes :host, :path, :port, :scheme, :version, :persistent
|
7
7
|
|
8
|
-
|
8
|
+
model_path 'fog/aws/models/dns'
|
9
|
+
model :record
|
10
|
+
collection :records
|
11
|
+
model :zone
|
12
|
+
collection :zones
|
9
13
|
|
10
14
|
request_path 'fog/aws/requests/dns'
|
11
15
|
request :create_hosted_zone
|