fog 0.0.42 → 0.0.43
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -0
- data/VERSION.yml +2 -2
- data/bin/fog +23 -102
- data/fog.gemspec +48 -2
- data/lib/fog.rb +17 -46
- data/lib/fog/aws.rb +10 -4
- data/lib/fog/aws/bin.rb +69 -0
- data/lib/fog/aws/ec2.rb +82 -86
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +20 -16
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +19 -15
- data/lib/fog/aws/requests/s3/get_object.rb +4 -0
- data/lib/fog/aws/requests/simpledb/select.rb +42 -24
- data/lib/fog/aws/s3.rb +28 -25
- data/lib/fog/aws/simpledb.rb +21 -17
- data/lib/fog/bin.rb +79 -0
- data/lib/fog/collection.rb +20 -9
- data/lib/fog/model.rb +9 -4
- data/lib/fog/rackspace.rb +10 -3
- data/lib/fog/rackspace/bin.rb +44 -0
- data/lib/fog/rackspace/files.rb +16 -9
- data/lib/fog/rackspace/requests/files/delete_container.rb +2 -1
- data/lib/fog/rackspace/requests/files/delete_object.rb +2 -1
- data/lib/fog/rackspace/requests/files/get_container.rb +2 -1
- data/lib/fog/rackspace/requests/files/get_containers.rb +2 -1
- data/lib/fog/rackspace/requests/files/head_container.rb +2 -1
- data/lib/fog/rackspace/requests/files/head_containers.rb +2 -1
- data/lib/fog/rackspace/requests/files/put_container.rb +2 -1
- data/lib/fog/rackspace/requests/files/put_object.rb +2 -1
- data/lib/fog/rackspace/requests/servers/get_flavor_details.rb +1 -0
- data/lib/fog/rackspace/requests/servers/list_flavors.rb +1 -0
- data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +1 -0
- data/lib/fog/rackspace/requests/servers/list_images.rb +0 -1
- data/lib/fog/rackspace/requests/servers/reboot_server.rb +2 -1
- data/lib/fog/rackspace/servers.rb +31 -26
- data/lib/fog/slicehost.rb +35 -17
- data/lib/fog/slicehost/bin.rb +42 -0
- data/lib/fog/slicehost/models/flavor.rb +41 -0
- data/lib/fog/slicehost/models/flavors.rb +33 -0
- data/lib/fog/slicehost/models/image.rb +13 -0
- data/lib/fog/slicehost/models/images.rb +35 -0
- data/lib/fog/slicehost/models/server.rb +55 -0
- data/lib/fog/slicehost/models/servers.rb +37 -0
- data/lib/fog/slicehost/parsers/get_flavor.rb +24 -0
- data/lib/fog/slicehost/parsers/get_image.rb +24 -0
- data/lib/fog/slicehost/parsers/get_slice.rb +29 -0
- data/lib/fog/slicehost/requests/create_slice.rb +2 -1
- data/lib/fog/slicehost/requests/delete_slice.rb +2 -1
- data/lib/fog/slicehost/requests/get_backups.rb +1 -0
- data/lib/fog/slicehost/requests/get_flavor.rb +42 -0
- data/lib/fog/slicehost/requests/get_flavors.rb +1 -0
- data/lib/fog/slicehost/requests/get_image.rb +40 -0
- data/lib/fog/slicehost/requests/get_images.rb +1 -0
- data/lib/fog/slicehost/requests/get_slice.rb +48 -0
- data/lib/fog/slicehost/requests/get_slices.rb +1 -0
- data/lib/fog/slicehost/requests/reboot_slice.rb +49 -0
- data/lib/fog/terremark.rb +71 -0
- data/lib/fog/terremark/bin.rb +30 -0
- data/lib/fog/terremark/parsers/get_catalog.rb +43 -0
- data/lib/fog/terremark/parsers/get_catalog_item.rb +44 -0
- data/lib/fog/terremark/parsers/get_organization.rb +44 -0
- data/lib/fog/terremark/parsers/get_organizations.rb +26 -0
- data/lib/fog/terremark/parsers/get_vapp_template.rb +44 -0
- data/lib/fog/terremark/parsers/get_vdc.rb +105 -0
- data/lib/fog/terremark/requests/get_catalog.rb +44 -0
- data/lib/fog/terremark/requests/get_catalog_item.rb +47 -0
- data/lib/fog/terremark/requests/get_organization.rb +46 -0
- data/lib/fog/terremark/requests/get_organizations.rb +42 -0
- data/lib/fog/terremark/requests/get_vapp_template.rb +47 -0
- data/lib/fog/terremark/requests/get_vdc.rb +47 -0
- data/spec/slicehost/models/server_spec.rb +51 -0
- data/spec/slicehost/models/servers_spec.rb +22 -0
- data/spec/slicehost/requests/get_flavor_spec.rb +24 -0
- data/spec/slicehost/requests/get_image_spec.rb +24 -0
- data/spec/slicehost/requests/get_slice_spec.rb +41 -0
- data/spec/slicehost/requests/get_slices_spec.rb +20 -9
- data/spec/slicehost/requests/reboot_slice_spec.rb +41 -0
- data/spec/spec_helper.rb +10 -0
- metadata +55 -2
data/README.rdoc
CHANGED
@@ -93,7 +93,7 @@ Now we will try again, but with Rackspace
|
|
93
93
|
directory.files.create(:key => 'filename', :body => 'filebody')
|
94
94
|
|
95
95
|
# connect to your directory
|
96
|
-
directory = connection.directories.get('
|
96
|
+
directory = connection.directories.get('directoryname')
|
97
97
|
|
98
98
|
# get your file
|
99
99
|
file = directory.files.get('filename')
|
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
data/bin/fog
CHANGED
@@ -1,116 +1,37 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require File.join(lib_dir, 'fog')
|
3
4
|
require 'irb'
|
4
5
|
require 'yaml'
|
5
6
|
|
6
|
-
|
7
|
-
module Credentials
|
8
|
-
Fog.credential = (ARGV.first && :"#{ARGV.first}") || :default
|
9
|
-
unless Fog.credentials
|
10
|
-
exit
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
module AWS
|
16
|
-
class << self
|
17
|
-
credential = (ARGV.first && :"#{ARGV.first}") || :default
|
18
|
-
if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
|
19
|
-
|
20
|
-
def [](service)
|
21
|
-
@@connections ||= Hash.new do |hash, key|
|
22
|
-
credentials = Fog.credentials.reject do |k, v|
|
23
|
-
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
24
|
-
end
|
25
|
-
hash[key] = case key
|
26
|
-
when :ec2
|
27
|
-
Fog::AWS::EC2.new(credentials)
|
28
|
-
when :s3
|
29
|
-
Fog::AWS::S3.new(credentials)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
@@connections[service]
|
33
|
-
end
|
34
|
-
|
35
|
-
def addresses
|
36
|
-
self[:ec2].addresses
|
37
|
-
end
|
38
|
-
|
39
|
-
def directories
|
40
|
-
self[:s3].directories
|
41
|
-
end
|
42
|
-
|
43
|
-
def flavors
|
44
|
-
self[:ec2].flavors
|
45
|
-
end
|
46
|
-
|
47
|
-
def images
|
48
|
-
self[:ec2].images
|
49
|
-
end
|
50
|
-
|
51
|
-
def servers
|
52
|
-
self[:ec2].servers
|
53
|
-
end
|
54
|
-
|
55
|
-
def key_pairs
|
56
|
-
self[:ec2].key_pairs
|
57
|
-
end
|
58
|
-
|
59
|
-
def security_groups
|
60
|
-
self[:ec2].security_groups
|
61
|
-
end
|
7
|
+
require File.join(lib_dir, 'fog', 'bin')
|
62
8
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
def volumes
|
68
|
-
self[:ec2].volumes
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
9
|
+
Fog.credential = (ARGV.first && :"#{ARGV.first}") || :default
|
10
|
+
unless Fog.credentials
|
11
|
+
exit
|
73
12
|
end
|
74
13
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
def [](service)
|
80
|
-
@@connections ||= Hash.new do |hash, key|
|
81
|
-
credential = (ARGV.first && :"#{ARGV.first}") || :default
|
82
|
-
credentials = Fog.credentials.reject do |k,v|
|
83
|
-
![:rackspace_api_key, :rackspace_username].include?(k)
|
84
|
-
end
|
85
|
-
hash[key] = case key
|
86
|
-
when :files
|
87
|
-
Fog::Rackspace::Files.new(credentials)
|
88
|
-
when :servers
|
89
|
-
Fog::Rackspace::Servers.new(credentials)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
@@connections[service]
|
93
|
-
end
|
94
|
-
|
95
|
-
def flavors
|
96
|
-
self[:servers].flavors
|
97
|
-
end
|
98
|
-
|
99
|
-
def images
|
100
|
-
self[:servers].images
|
101
|
-
end
|
102
|
-
|
103
|
-
def servers
|
104
|
-
self[:servers].servers
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
14
|
+
require File.join(lib_dir, 'fog', 'aws', 'bin')
|
15
|
+
require File.join(lib_dir, 'fog', 'rackspace', 'bin')
|
16
|
+
require File.join(lib_dir, 'fog', 'slicehost', 'bin')
|
17
|
+
require File.join(lib_dir, 'fog', 'terremark', 'bin')
|
110
18
|
|
111
19
|
ARGV.clear # Avoid passing args to IRB
|
112
20
|
IRB.setup(nil)
|
113
21
|
@irb = IRB::Irb.new(nil)
|
114
22
|
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
23
|
+
IRB.conf[:PROMPT][:FOG] = IRB.conf[:PROMPT][:SIMPLE].dup
|
24
|
+
IRB.conf[:PROMPT][:FOG][:RETURN] = "%s\n"
|
25
|
+
@irb.context.prompt_mode = :FOG
|
115
26
|
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
27
|
+
|
28
|
+
services = Fog.services.map{|service| service.to_s}
|
29
|
+
available_services = if services.length > 1
|
30
|
+
services[0...-1].join(', ') << ' and ' << services[-1]
|
31
|
+
else
|
32
|
+
services.first
|
33
|
+
end
|
34
|
+
print "Welcome to fog interactive!\n"
|
35
|
+
print "Your '#{Fog.credential.to_s}' configuration provides access to #{available_services}.\n"
|
36
|
+
|
116
37
|
catch(:IRB_EXIT) { @irb.eval_input }
|
data/fog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.43"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-15}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{me@geemus.com}
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"fog.gemspec",
|
31
31
|
"lib/fog.rb",
|
32
32
|
"lib/fog/aws.rb",
|
33
|
+
"lib/fog/aws/bin.rb",
|
33
34
|
"lib/fog/aws/ec2.rb",
|
34
35
|
"lib/fog/aws/models/ec2/address.rb",
|
35
36
|
"lib/fog/aws/models/ec2/addresses.rb",
|
@@ -132,11 +133,13 @@ Gem::Specification.new do |s|
|
|
132
133
|
"lib/fog/aws/requests/simpledb/select.rb",
|
133
134
|
"lib/fog/aws/s3.rb",
|
134
135
|
"lib/fog/aws/simpledb.rb",
|
136
|
+
"lib/fog/bin.rb",
|
135
137
|
"lib/fog/collection.rb",
|
136
138
|
"lib/fog/connection.rb",
|
137
139
|
"lib/fog/model.rb",
|
138
140
|
"lib/fog/parser.rb",
|
139
141
|
"lib/fog/rackspace.rb",
|
142
|
+
"lib/fog/rackspace/bin.rb",
|
140
143
|
"lib/fog/rackspace/files.rb",
|
141
144
|
"lib/fog/rackspace/models/servers/flavor.rb",
|
142
145
|
"lib/fog/rackspace/models/servers/flavors.rb",
|
@@ -171,17 +174,45 @@ Gem::Specification.new do |s|
|
|
171
174
|
"lib/fog/rackspace/requests/servers/update_server.rb",
|
172
175
|
"lib/fog/rackspace/servers.rb",
|
173
176
|
"lib/fog/slicehost.rb",
|
177
|
+
"lib/fog/slicehost/bin.rb",
|
178
|
+
"lib/fog/slicehost/models/flavor.rb",
|
179
|
+
"lib/fog/slicehost/models/flavors.rb",
|
180
|
+
"lib/fog/slicehost/models/image.rb",
|
181
|
+
"lib/fog/slicehost/models/images.rb",
|
182
|
+
"lib/fog/slicehost/models/server.rb",
|
183
|
+
"lib/fog/slicehost/models/servers.rb",
|
174
184
|
"lib/fog/slicehost/parsers/create_slice.rb",
|
175
185
|
"lib/fog/slicehost/parsers/get_backups.rb",
|
186
|
+
"lib/fog/slicehost/parsers/get_flavor.rb",
|
176
187
|
"lib/fog/slicehost/parsers/get_flavors.rb",
|
188
|
+
"lib/fog/slicehost/parsers/get_image.rb",
|
177
189
|
"lib/fog/slicehost/parsers/get_images.rb",
|
190
|
+
"lib/fog/slicehost/parsers/get_slice.rb",
|
178
191
|
"lib/fog/slicehost/parsers/get_slices.rb",
|
179
192
|
"lib/fog/slicehost/requests/create_slice.rb",
|
180
193
|
"lib/fog/slicehost/requests/delete_slice.rb",
|
181
194
|
"lib/fog/slicehost/requests/get_backups.rb",
|
195
|
+
"lib/fog/slicehost/requests/get_flavor.rb",
|
182
196
|
"lib/fog/slicehost/requests/get_flavors.rb",
|
197
|
+
"lib/fog/slicehost/requests/get_image.rb",
|
183
198
|
"lib/fog/slicehost/requests/get_images.rb",
|
199
|
+
"lib/fog/slicehost/requests/get_slice.rb",
|
184
200
|
"lib/fog/slicehost/requests/get_slices.rb",
|
201
|
+
"lib/fog/slicehost/requests/reboot_slice.rb",
|
202
|
+
"lib/fog/terremark.rb",
|
203
|
+
"lib/fog/terremark/bin.rb",
|
204
|
+
"lib/fog/terremark/parsers/get_catalog.rb",
|
205
|
+
"lib/fog/terremark/parsers/get_catalog_item.rb",
|
206
|
+
"lib/fog/terremark/parsers/get_organization.rb",
|
207
|
+
"lib/fog/terremark/parsers/get_organizations.rb",
|
208
|
+
"lib/fog/terremark/parsers/get_vapp_template.rb",
|
209
|
+
"lib/fog/terremark/parsers/get_vdc.rb",
|
210
|
+
"lib/fog/terremark/requests/get_catalog.rb",
|
211
|
+
"lib/fog/terremark/requests/get_catalog_item.rb",
|
212
|
+
"lib/fog/terremark/requests/get_organization.rb",
|
213
|
+
"lib/fog/terremark/requests/get_organizations.rb",
|
214
|
+
"lib/fog/terremark/requests/get_vapp_template.rb",
|
215
|
+
"lib/fog/terremark/requests/get_vdc.rb",
|
185
216
|
"spec/aws/models/ec2/address_spec.rb",
|
186
217
|
"spec/aws/models/ec2/addresses_spec.rb",
|
187
218
|
"spec/aws/models/ec2/key_pair_spec.rb",
|
@@ -279,12 +310,18 @@ Gem::Specification.new do |s|
|
|
279
310
|
"spec/rackspace/requests/servers/update_server_spec.rb",
|
280
311
|
"spec/shared_examples/server_examples.rb",
|
281
312
|
"spec/shared_examples/servers_examples.rb",
|
313
|
+
"spec/slicehost/models/server_spec.rb",
|
314
|
+
"spec/slicehost/models/servers_spec.rb",
|
282
315
|
"spec/slicehost/requests/create_slice_spec.rb",
|
283
316
|
"spec/slicehost/requests/delete_slice_spec.rb",
|
284
317
|
"spec/slicehost/requests/get_backups_spec.rb",
|
318
|
+
"spec/slicehost/requests/get_flavor_spec.rb",
|
285
319
|
"spec/slicehost/requests/get_flavors_spec.rb",
|
320
|
+
"spec/slicehost/requests/get_image_spec.rb",
|
286
321
|
"spec/slicehost/requests/get_images_spec.rb",
|
322
|
+
"spec/slicehost/requests/get_slice_spec.rb",
|
287
323
|
"spec/slicehost/requests/get_slices_spec.rb",
|
324
|
+
"spec/slicehost/requests/reboot_slice_spec.rb",
|
288
325
|
"spec/spec_helper.rb"
|
289
326
|
]
|
290
327
|
s.homepage = %q{http://github.com/geemus/fog}
|
@@ -423,12 +460,18 @@ Gem::Specification.new do |s|
|
|
423
460
|
"spec/rackspace/requests/servers/update_server_spec.rb",
|
424
461
|
"spec/shared_examples/server_examples.rb",
|
425
462
|
"spec/shared_examples/servers_examples.rb",
|
463
|
+
"spec/slicehost/models/server_spec.rb",
|
464
|
+
"spec/slicehost/models/servers_spec.rb",
|
426
465
|
"spec/slicehost/requests/create_slice_spec.rb",
|
427
466
|
"spec/slicehost/requests/delete_slice_spec.rb",
|
428
467
|
"spec/slicehost/requests/get_backups_spec.rb",
|
468
|
+
"spec/slicehost/requests/get_flavor_spec.rb",
|
429
469
|
"spec/slicehost/requests/get_flavors_spec.rb",
|
470
|
+
"spec/slicehost/requests/get_image_spec.rb",
|
430
471
|
"spec/slicehost/requests/get_images_spec.rb",
|
472
|
+
"spec/slicehost/requests/get_slice_spec.rb",
|
431
473
|
"spec/slicehost/requests/get_slices_spec.rb",
|
474
|
+
"spec/slicehost/requests/reboot_slice_spec.rb",
|
432
475
|
"spec/spec_helper.rb"
|
433
476
|
]
|
434
477
|
|
@@ -438,12 +481,14 @@ Gem::Specification.new do |s|
|
|
438
481
|
|
439
482
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
440
483
|
s.add_runtime_dependency(%q<excon>, [">= 0.0.18"])
|
484
|
+
s.add_runtime_dependency(%q<formatador>, [">= 0"])
|
441
485
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
442
486
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
443
487
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
444
488
|
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
445
489
|
else
|
446
490
|
s.add_dependency(%q<excon>, [">= 0.0.18"])
|
491
|
+
s.add_dependency(%q<formatador>, [">= 0"])
|
447
492
|
s.add_dependency(%q<json>, [">= 0"])
|
448
493
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
449
494
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
@@ -451,6 +496,7 @@ Gem::Specification.new do |s|
|
|
451
496
|
end
|
452
497
|
else
|
453
498
|
s.add_dependency(%q<excon>, [">= 0.0.18"])
|
499
|
+
s.add_dependency(%q<formatador>, [">= 0"])
|
454
500
|
s.add_dependency(%q<json>, [">= 0"])
|
455
501
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
456
502
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
data/lib/fog.rb
CHANGED
@@ -3,6 +3,7 @@ require 'base64'
|
|
3
3
|
require 'cgi'
|
4
4
|
require 'digest/md5'
|
5
5
|
require 'excon'
|
6
|
+
require 'formatador'
|
6
7
|
require 'hmac-sha1'
|
7
8
|
require 'hmac-sha2'
|
8
9
|
require 'json'
|
@@ -18,6 +19,8 @@ $LOAD_PATH.unshift __DIR__ unless
|
|
18
19
|
|
19
20
|
module Fog
|
20
21
|
|
22
|
+
class MockNotImplemented < StandardError; end
|
23
|
+
|
21
24
|
def self.mock!
|
22
25
|
@mocking = true
|
23
26
|
self.reload
|
@@ -27,55 +30,23 @@ module Fog
|
|
27
30
|
!!@mocking
|
28
31
|
end
|
29
32
|
|
30
|
-
def self.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
def self.credential=(new_credential)
|
42
|
-
@credential = new_credential
|
43
|
-
@credentials = nil
|
33
|
+
def self.dependencies
|
34
|
+
[
|
35
|
+
'fog/collection.rb',
|
36
|
+
'fog/connection.rb',
|
37
|
+
'fog/model.rb',
|
38
|
+
'fog/parser.rb',
|
39
|
+
'fog/aws.rb',
|
40
|
+
'fog/rackspace.rb',
|
41
|
+
'fog/slicehost.rb',
|
42
|
+
'fog/terremark.rb'
|
43
|
+
]
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.credentials
|
51
|
-
@credentials ||= begin
|
52
|
-
path = File.expand_path('~/.fog')
|
53
|
-
credentials = if File.exists?(path)
|
54
|
-
File.open(path) do |file|
|
55
|
-
YAML.load(file.read)
|
56
|
-
end
|
57
|
-
else
|
58
|
-
nil
|
59
|
-
end
|
60
|
-
unless credentials && credentials[credential]
|
61
|
-
print("\n To run as '#{credential}', add credentials like the following to ~/.fog\n")
|
62
|
-
yml = <<-YML
|
63
|
-
|
64
|
-
:#{credential}:
|
65
|
-
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
|
66
|
-
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
|
67
|
-
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
|
68
|
-
:rackspace_username: INTENTIONALLY_LEFT_BLANK
|
69
|
-
:slicehost_password: INTENTIONALLY_LEFT_BLANK
|
70
|
-
|
71
|
-
YML
|
72
|
-
print(yml)
|
73
|
-
raise(ArgumentError.new("Missing Credentials"))
|
74
|
-
end
|
75
|
-
credentials[credential]
|
76
|
-
end
|
46
|
+
def self.reload
|
47
|
+
self.dependencies.each {|dependency| load(dependency)}
|
77
48
|
end
|
78
49
|
|
79
50
|
end
|
80
51
|
|
81
|
-
Fog.
|
52
|
+
Fog.dependencies.each {|dependency| require(dependency)}
|
data/lib/fog/aws.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
module Fog
|
2
2
|
module AWS
|
3
3
|
|
4
|
+
def self.dependencies
|
5
|
+
[
|
6
|
+
'fog/aws/ec2.rb',
|
7
|
+
'fog/aws/simpledb.rb',
|
8
|
+
'fog/aws/s3.rb'
|
9
|
+
]
|
10
|
+
end
|
11
|
+
|
4
12
|
def self.reload
|
5
|
-
load
|
6
|
-
load "fog/aws/simpledb.rb"
|
7
|
-
load "fog/aws/s3.rb"
|
13
|
+
self.dependencies.each {|dependency| load(dependency)}
|
8
14
|
end
|
9
15
|
|
10
16
|
def self.indexed_param(key, values)
|
@@ -172,4 +178,4 @@ module Fog
|
|
172
178
|
end
|
173
179
|
end
|
174
180
|
|
175
|
-
Fog::AWS.
|
181
|
+
Fog::AWS.dependencies.each {|dependency| require(dependency)}
|
data/lib/fog/aws/bin.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
module AWS
|
2
|
+
class << self
|
3
|
+
credential = (ARGV.first && :"#{ARGV.first}") || :default
|
4
|
+
if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
|
5
|
+
|
6
|
+
def initialized?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](service)
|
11
|
+
@@connections ||= Hash.new do |hash, key|
|
12
|
+
credentials = Fog.credentials.reject do |k, v|
|
13
|
+
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
14
|
+
end
|
15
|
+
hash[key] = case key
|
16
|
+
when :ec2
|
17
|
+
Fog::AWS::EC2.new(credentials)
|
18
|
+
when :s3
|
19
|
+
Fog::AWS::S3.new(credentials)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
@@connections[service]
|
23
|
+
end
|
24
|
+
|
25
|
+
def addresses
|
26
|
+
self[:ec2].addresses
|
27
|
+
end
|
28
|
+
|
29
|
+
def directories
|
30
|
+
self[:s3].directories
|
31
|
+
end
|
32
|
+
|
33
|
+
def flavors
|
34
|
+
self[:ec2].flavors
|
35
|
+
end
|
36
|
+
|
37
|
+
def images
|
38
|
+
self[:ec2].images
|
39
|
+
end
|
40
|
+
|
41
|
+
def servers
|
42
|
+
self[:ec2].servers
|
43
|
+
end
|
44
|
+
|
45
|
+
def key_pairs
|
46
|
+
self[:ec2].key_pairs
|
47
|
+
end
|
48
|
+
|
49
|
+
def security_groups
|
50
|
+
self[:ec2].security_groups
|
51
|
+
end
|
52
|
+
|
53
|
+
def snapshots
|
54
|
+
self[:ec2].snapshots
|
55
|
+
end
|
56
|
+
|
57
|
+
def volumes
|
58
|
+
self[:ec2].volumes
|
59
|
+
end
|
60
|
+
|
61
|
+
else
|
62
|
+
|
63
|
+
def initialized?
|
64
|
+
false
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|