fog 0.0.40 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/Rakefile +12 -0
- data/VERSION +1 -1
- data/bin/fog +28 -40
- data/fog.gemspec +16 -3
- data/lib/fog.rb +27 -3
- data/lib/fog/aws/ec2.rb +7 -3
- data/lib/fog/aws/models/ec2/security_group.rb +1 -1
- data/lib/fog/aws/models/ec2/server.rb +8 -3
- data/lib/fog/aws/models/ec2/servers.rb +1 -1
- data/lib/fog/aws/parsers/ec2/terminate_instances.rb +10 -10
- data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
- data/lib/fog/aws/s3.rb +6 -2
- data/lib/fog/rackspace.rb +8 -2
- data/lib/fog/slicehost.rb +3 -1
- data/spec/aws/models/ec2/address_spec.rb +8 -8
- data/spec/aws/models/ec2/addresses_spec.rb +10 -10
- data/spec/aws/models/ec2/key_pair_spec.rb +8 -8
- data/spec/aws/models/ec2/key_pairs_spec.rb +10 -10
- data/spec/aws/models/ec2/security_group_spec.rb +8 -8
- data/spec/aws/models/ec2/security_groups_spec.rb +10 -10
- data/spec/aws/models/ec2/server_spec.rb +1 -4
- data/spec/aws/models/ec2/servers_spec.rb +1 -1
- data/spec/aws/models/ec2/snapshot_spec.rb +12 -10
- data/spec/aws/models/ec2/snapshots_spec.rb +20 -20
- data/spec/aws/models/ec2/volume_spec.rb +10 -10
- data/spec/aws/models/ec2/volumes_spec.rb +10 -10
- data/spec/aws/models/s3/directories_spec.rb +8 -8
- data/spec/aws/models/s3/directory_spec.rb +11 -11
- data/spec/aws/models/s3/file_spec.rb +2 -2
- data/spec/aws/models/s3/files_spec.rb +2 -2
- data/spec/aws/requests/ec2/allocate_address_spec.rb +2 -2
- data/spec/aws/requests/ec2/associate_address_spec.rb +15 -13
- data/spec/aws/requests/ec2/attach_volume_spec.rb +12 -12
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +3 -3
- data/spec/aws/requests/ec2/create_key_pair_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_security_group_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_volume_spec.rb +2 -2
- data/spec/aws/requests/ec2/delete_key_pair_spec.rb +3 -3
- data/spec/aws/requests/ec2/delete_security_group_spec.rb +3 -3
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -5
- data/spec/aws/requests/ec2/delete_volume_spec.rb +3 -3
- data/spec/aws/requests/ec2/describe_addresses_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_images_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_instances_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_regions_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +7 -7
- data/spec/aws/requests/ec2/describe_volumes_spec.rb +5 -5
- data/spec/aws/requests/ec2/detach_volume_spec.rb +7 -7
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +9 -7
- data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +4 -4
- data/spec/aws/requests/ec2/release_address_spec.rb +3 -3
- data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +4 -4
- data/spec/aws/requests/ec2/run_instances_spec.rb +2 -2
- data/spec/aws/requests/ec2/terminate_instances_spec.rb +7 -7
- data/spec/aws/requests/s3/copy_object_spec.rb +11 -11
- data/spec/aws/requests/s3/delete_bucket_spec.rb +8 -8
- data/spec/aws/requests/s3/delete_object_spec.rb +8 -8
- data/spec/aws/requests/s3/get_bucket_location_spec.rb +4 -4
- data/spec/aws/requests/s3/get_bucket_spec.rb +12 -12
- data/spec/aws/requests/s3/get_object_spec.rb +9 -9
- data/spec/aws/requests/s3/get_request_payment_spec.rb +4 -4
- data/spec/aws/requests/s3/get_service_spec.rb +4 -4
- data/spec/aws/requests/s3/head_object_spec.rb +5 -5
- data/spec/aws/requests/s3/put_bucket_spec.rb +3 -3
- data/spec/aws/requests/s3/put_object_spec.rb +11 -11
- data/spec/aws/requests/s3/put_request_payment_spec.rb +4 -4
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +4 -4
- data/spec/aws/requests/simpledb/create_domain_spec.rb +4 -4
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +8 -8
- data/spec/aws/requests/simpledb/delete_domain_spec.rb +3 -3
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +6 -6
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +9 -9
- data/spec/aws/requests/simpledb/list_domains_spec.rb +4 -4
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +4 -4
- data/spec/compact_progress_bar_formatter.rb +195 -0
- data/spec/rackspace/models/servers/server_spec.rb +1 -1
- data/spec/rackspace/requests/files/delete_container_spec.rb +3 -3
- data/spec/rackspace/requests/files/delete_object_spec.rb +8 -8
- data/spec/rackspace/requests/files/get_container_spec.rb +6 -6
- data/spec/rackspace/requests/files/get_containers_spec.rb +3 -3
- data/spec/rackspace/requests/files/head_container_spec.rb +6 -6
- data/spec/rackspace/requests/files/head_containers_spec.rb +3 -3
- data/spec/rackspace/requests/files/put_container_spec.rb +2 -2
- data/spec/rackspace/requests/files/put_object_spec.rb +4 -4
- data/spec/rackspace/requests/servers/create_image_spec.rb +4 -4
- data/spec/rackspace/requests/servers/create_server_spec.rb +2 -2
- data/spec/rackspace/requests/servers/delete_image_spec.rb +5 -5
- data/spec/rackspace/requests/servers/delete_server_spec.rb +3 -3
- data/spec/rackspace/requests/servers/get_flavor_details_spec.rb +1 -1
- data/spec/rackspace/requests/servers/get_server_details_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_flavors_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_images_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_images_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +3 -3
- data/spec/rackspace/requests/servers/list_servers_spec.rb +3 -3
- data/spec/rackspace/requests/servers/reboot_server_spec.rb +4 -4
- data/spec/rackspace/requests/servers/update_server_spec.rb +4 -4
- data/spec/slicehost/requests/create_slice_spec.rb +2 -2
- data/spec/slicehost/requests/delete_slice_spec.rb +2 -2
- data/spec/slicehost/requests/get_backups_spec.rb +1 -1
- data/spec/slicehost/requests/get_flavors_spec.rb +1 -1
- data/spec/slicehost/requests/get_images_spec.rb +1 -1
- data/spec/slicehost/requests/get_slices_spec.rb +1 -1
- data/spec/spec_helper.rb +60 -38
- metadata +16 -3
- data/spec/spec.opts +0 -1
data/README.rdoc
CHANGED
@@ -46,6 +46,8 @@ Lets boot up a server on EC2
|
|
46
46
|
|
47
47
|
# boot a gentoo server
|
48
48
|
server = connection.servers.new(:image_id => 'ami-5ee70037')
|
49
|
+
# you might also want to add the server to security groups, which goes like this:
|
50
|
+
# AWS.servers.create(:image_id => 'ami-5ee70037', :groups => ['web', 'db'])
|
49
51
|
|
50
52
|
# wait for it to be ready to do stuff
|
51
53
|
server.wait_for { ready? }
|
data/Rakefile
CHANGED
@@ -20,6 +20,18 @@ begin
|
|
20
20
|
gem.rubyforge_project = "fog"
|
21
21
|
|
22
22
|
gem.post_install_message = <<MESSAGE
|
23
|
+
#{'=' * 50}
|
24
|
+
|
25
|
+
fog 0.0.41 has a minor change to the API for ec2 servers:
|
26
|
+
|
27
|
+
# what_it_was => what_it_is
|
28
|
+
|
29
|
+
ec2.servers.new(:group_id => 'foo') => ec2.servers.new(:groups => ['foo'])
|
30
|
+
|
31
|
+
Updating to the newest api version also means you can now assign multiple groups:
|
32
|
+
|
33
|
+
ec2.servers.new(:groups => ['foo', 'bar'])
|
34
|
+
|
23
35
|
#{'=' * 50}
|
24
36
|
|
25
37
|
fog 0.0.40 has API changes you should know about.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.41
|
data/bin/fog
CHANGED
@@ -5,20 +5,8 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
module Fog
|
7
7
|
module Credentials
|
8
|
-
|
9
|
-
unless Fog.credentials
|
10
|
-
print("\n To run as '#{key}', add credentials like the following to ~/.fog\n")
|
11
|
-
yml = <<-YML
|
12
|
-
|
13
|
-
:#{key}:
|
14
|
-
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
|
15
|
-
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
|
16
|
-
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
|
17
|
-
:rackspace_username: INTENTIONALLY_LEFT_BLANK
|
18
|
-
:slicehost_password: INTENTIONALLY_LEFT_BLANK
|
19
|
-
|
20
|
-
YML
|
21
|
-
print(yml)
|
8
|
+
Fog.credential = (ARGV.first && :"#{ARGV.first}") || :default
|
9
|
+
unless Fog.credentials
|
22
10
|
exit
|
23
11
|
end
|
24
12
|
end
|
@@ -26,15 +14,14 @@ end
|
|
26
14
|
|
27
15
|
module AWS
|
28
16
|
class << self
|
29
|
-
|
30
|
-
if Fog.credentials
|
17
|
+
credential = (ARGV.first && :"#{ARGV.first}") || :default
|
18
|
+
if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
|
31
19
|
|
32
|
-
def
|
20
|
+
def [](service)
|
33
21
|
@@connections ||= Hash.new do |hash, key|
|
34
|
-
credentials =
|
35
|
-
:aws_access_key_id
|
36
|
-
|
37
|
-
}
|
22
|
+
credentials = Fog.credentials.reject do |k, v|
|
23
|
+
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
24
|
+
end
|
38
25
|
hash[key] = case key
|
39
26
|
when :ec2
|
40
27
|
Fog::AWS::EC2.new(credentials)
|
@@ -42,42 +29,43 @@ module AWS
|
|
42
29
|
Fog::AWS::S3.new(credentials)
|
43
30
|
end
|
44
31
|
end
|
32
|
+
@@connections[service]
|
45
33
|
end
|
46
34
|
|
47
35
|
def addresses
|
48
|
-
|
36
|
+
self[:ec2].addresses
|
49
37
|
end
|
50
38
|
|
51
39
|
def directories
|
52
|
-
|
40
|
+
self[:s3].directories
|
53
41
|
end
|
54
42
|
|
55
43
|
def flavors
|
56
|
-
|
44
|
+
self[:ec2].flavors
|
57
45
|
end
|
58
46
|
|
59
47
|
def images
|
60
|
-
|
48
|
+
self[:ec2].images
|
61
49
|
end
|
62
50
|
|
63
51
|
def servers
|
64
|
-
|
52
|
+
self[:ec2].servers
|
65
53
|
end
|
66
54
|
|
67
55
|
def key_pairs
|
68
|
-
|
56
|
+
self[:ec2].key_pairs
|
69
57
|
end
|
70
58
|
|
71
59
|
def security_groups
|
72
|
-
|
60
|
+
self[:ec2].security_groups
|
73
61
|
end
|
74
62
|
|
75
63
|
def snapshots
|
76
|
-
|
64
|
+
self[:ec2].snapshots
|
77
65
|
end
|
78
66
|
|
79
67
|
def volumes
|
80
|
-
|
68
|
+
self[:ec2].volumes
|
81
69
|
end
|
82
70
|
|
83
71
|
end
|
@@ -86,15 +74,14 @@ end
|
|
86
74
|
|
87
75
|
module Rackspace
|
88
76
|
class << self
|
89
|
-
|
90
|
-
if Fog.credentials(key)[:rackspace_api_key] && Fog.credentials(key)[:rackspace_username]
|
77
|
+
if Fog.credentials[:rackspace_api_key] && Fog.credentials[:rackspace_username]
|
91
78
|
|
92
|
-
def
|
79
|
+
def [](service)
|
93
80
|
@@connections ||= Hash.new do |hash, key|
|
94
|
-
|
95
|
-
|
96
|
-
:
|
97
|
-
|
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
|
98
85
|
hash[key] = case key
|
99
86
|
when :files
|
100
87
|
Fog::Rackspace::Files.new(credentials)
|
@@ -102,18 +89,19 @@ module Rackspace
|
|
102
89
|
Fog::Rackspace::Servers.new(credentials)
|
103
90
|
end
|
104
91
|
end
|
92
|
+
@@connections[service]
|
105
93
|
end
|
106
94
|
|
107
95
|
def flavors
|
108
|
-
|
96
|
+
self[:servers].flavors
|
109
97
|
end
|
110
98
|
|
111
99
|
def images
|
112
|
-
|
100
|
+
self[:servers].images
|
113
101
|
end
|
114
102
|
|
115
103
|
def servers
|
116
|
-
|
104
|
+
self[:servers].servers
|
117
105
|
end
|
118
106
|
|
119
107
|
end
|
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.41"
|
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-01-
|
12
|
+
s.date = %q{2010-01-25}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{me@geemus.com}
|
@@ -248,6 +248,7 @@ Gem::Specification.new do |s|
|
|
248
248
|
"spec/aws/requests/simpledb/list_domains_spec.rb",
|
249
249
|
"spec/aws/requests/simpledb/put_attributes_spec.rb",
|
250
250
|
"spec/aws/requests/simpledb/select_spec.rb",
|
251
|
+
"spec/compact_progress_bar_formatter.rb",
|
251
252
|
"spec/lorem.txt",
|
252
253
|
"spec/rackspace/models/servers/server_spec.rb",
|
253
254
|
"spec/rackspace/requests/files/delete_container_spec.rb",
|
@@ -282,12 +283,23 @@ Gem::Specification.new do |s|
|
|
282
283
|
"spec/slicehost/requests/get_flavors_spec.rb",
|
283
284
|
"spec/slicehost/requests/get_images_spec.rb",
|
284
285
|
"spec/slicehost/requests/get_slices_spec.rb",
|
285
|
-
"spec/spec.opts",
|
286
286
|
"spec/spec_helper.rb"
|
287
287
|
]
|
288
288
|
s.homepage = %q{http://github.com/geemus/fog}
|
289
289
|
s.post_install_message = %q{==================================================
|
290
290
|
|
291
|
+
fog 0.0.41 has a minor change to the API for ec2 servers:
|
292
|
+
|
293
|
+
# what_it_was => what_it_is
|
294
|
+
|
295
|
+
ec2.servers.new(:group_id => 'foo') => ec2.servers.new(:groups => ['foo'])
|
296
|
+
|
297
|
+
Updating to the newest api version also means you can now assign multiple groups:
|
298
|
+
|
299
|
+
ec2.servers.new(:groups => ['foo', 'bar'])
|
300
|
+
|
301
|
+
==================================================
|
302
|
+
|
291
303
|
fog 0.0.40 has API changes you should know about.
|
292
304
|
|
293
305
|
Some changes you might care about happened in the models:
|
@@ -379,6 +391,7 @@ Gem::Specification.new do |s|
|
|
379
391
|
"spec/aws/requests/simpledb/list_domains_spec.rb",
|
380
392
|
"spec/aws/requests/simpledb/put_attributes_spec.rb",
|
381
393
|
"spec/aws/requests/simpledb/select_spec.rb",
|
394
|
+
"spec/compact_progress_bar_formatter.rb",
|
382
395
|
"spec/rackspace/models/servers/server_spec.rb",
|
383
396
|
"spec/rackspace/requests/files/delete_container_spec.rb",
|
384
397
|
"spec/rackspace/requests/files/delete_object_spec.rb",
|
data/lib/fog.rb
CHANGED
@@ -38,16 +38,40 @@ module Fog
|
|
38
38
|
load "fog/slicehost.rb"
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.
|
41
|
+
def self.credential=(new_credential)
|
42
|
+
@credential = new_credential
|
43
|
+
@credentials = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.credential
|
47
|
+
@credential || :default
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.credentials
|
42
51
|
@credentials ||= begin
|
43
52
|
path = File.expand_path('~/.fog')
|
44
|
-
if File.exists?(path)
|
53
|
+
credentials = if File.exists?(path)
|
45
54
|
File.open(path) do |file|
|
46
|
-
YAML.load(file.read)
|
55
|
+
YAML.load(file.read)
|
47
56
|
end
|
48
57
|
else
|
49
58
|
nil
|
50
59
|
end
|
60
|
+
unless credentials
|
61
|
+
print("\n To run as '#{key}', add credentials like the following to ~/.fog\n")
|
62
|
+
yml = <<-YML
|
63
|
+
|
64
|
+
:#{key}:
|
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
|
+
end
|
74
|
+
credentials[credential]
|
51
75
|
end
|
52
76
|
end
|
53
77
|
|
data/lib/fog/aws/ec2.rb
CHANGED
@@ -127,8 +127,12 @@ module Fog
|
|
127
127
|
# ==== Returns
|
128
128
|
# * EC2 object with connection to aws.
|
129
129
|
def initialize(options={})
|
130
|
-
@aws_access_key_id
|
131
|
-
|
130
|
+
unless @aws_access_key_id = options[:aws_access_key_id]
|
131
|
+
raise ArgumentError.new('aws_access_key_id is required to access ec2')
|
132
|
+
end
|
133
|
+
unless @aws_secret_access_key = options[:aws_secret_access_key]
|
134
|
+
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
135
|
+
end
|
132
136
|
@hmac = HMAC::SHA256.new(@aws_secret_access_key)
|
133
137
|
@host = options[:host] || 'ec2.amazonaws.com'
|
134
138
|
@port = options[:port] || 443
|
@@ -153,7 +157,7 @@ module Fog
|
|
153
157
|
'SignatureMethod' => 'HmacSHA256',
|
154
158
|
'SignatureVersion' => '2',
|
155
159
|
'Timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
156
|
-
'Version' => '2009-
|
160
|
+
'Version' => '2009-11-30'
|
157
161
|
})
|
158
162
|
|
159
163
|
body = ''
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
attribute :ami_launch_index, 'amiLaunchIndex'
|
10
10
|
attribute :availability_zone, 'availabilityZone'
|
11
11
|
attribute :dns_name, 'dnsName'
|
12
|
-
attribute :
|
12
|
+
attribute :groups
|
13
13
|
attribute :image_id, 'imageId'
|
14
14
|
attribute :state, 'instanceState'
|
15
15
|
attribute :flavor_id, 'instanceType'
|
@@ -23,6 +23,11 @@ module Fog
|
|
23
23
|
attribute :reason
|
24
24
|
attribute :user_data
|
25
25
|
|
26
|
+
def initialize(attributes)
|
27
|
+
@groups ||= ["default"]
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
26
31
|
def addresses
|
27
32
|
requires :id
|
28
33
|
|
@@ -99,8 +104,8 @@ module Fog
|
|
99
104
|
if @availability_zone
|
100
105
|
options['Placement.AvailabilityZone'] = @availability_zone
|
101
106
|
end
|
102
|
-
|
103
|
-
options[
|
107
|
+
@groups.each_with_index do |group, index|
|
108
|
+
options["SecurityGroup.#{index}"] = group
|
104
109
|
end
|
105
110
|
if @kernel_id
|
106
111
|
options['KernelId'] = @kernel_id
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
data = connection.describe_instances(server_id).body
|
27
27
|
data['reservationSet'].each do |reservation|
|
28
28
|
reservation['instancesSet'].each do |instance|
|
29
|
-
self << new(instance)
|
29
|
+
self << new(instance.merge(:groups => reservation['groupSet']))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
self
|
@@ -6,15 +6,15 @@ module Fog
|
|
6
6
|
class TerminateInstances < Fog::Parsers::Base
|
7
7
|
|
8
8
|
def reset
|
9
|
-
@instance = { 'previousState' => {}, '
|
9
|
+
@instance = { 'previousState' => {}, 'currentState' => {} }
|
10
10
|
@response = { 'instancesSet' => [] }
|
11
11
|
end
|
12
12
|
|
13
13
|
def start_element(name, attrs = [])
|
14
14
|
if name == 'previousState'
|
15
15
|
@in_previous_state = true
|
16
|
-
elsif name == '
|
17
|
-
@
|
16
|
+
elsif name == 'currentState'
|
17
|
+
@in_current_state = true
|
18
18
|
end
|
19
19
|
@value = ''
|
20
20
|
end
|
@@ -25,25 +25,25 @@ module Fog
|
|
25
25
|
@instance[name] = @value
|
26
26
|
when 'item'
|
27
27
|
@response['instancesSet'] << @instance
|
28
|
-
@instance = { 'previousState' => {}, '
|
28
|
+
@instance = { 'previousState' => {}, 'currentState' => {} }
|
29
29
|
when 'code'
|
30
30
|
if @in_previous_state
|
31
31
|
@instance['previousState'][name] = @value.to_i
|
32
|
-
elsif @
|
33
|
-
@instance['
|
32
|
+
elsif @in_current_state
|
33
|
+
@instance['currentState'][name] = @value.to_i
|
34
34
|
end
|
35
35
|
when 'name'
|
36
36
|
if @in_previous_state
|
37
37
|
@instance['previousState'][name] = @value
|
38
|
-
elsif @
|
39
|
-
@instance['
|
38
|
+
elsif @in_current_state
|
39
|
+
@instance['currentState'][name] = @value
|
40
40
|
end
|
41
41
|
when 'previousState'
|
42
42
|
@in_previous_state = false
|
43
43
|
when 'requestId'
|
44
44
|
@response[name] = @value
|
45
|
-
when '
|
46
|
-
@
|
45
|
+
when 'currentState'
|
46
|
+
@in_current_state = false
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -21,7 +21,7 @@ unless Fog.mocking?
|
|
21
21
|
# * 'Placement.AvailabilityZone'<~String> - Placement constraint for instances
|
22
22
|
# * 'DeviceName'<~String> - ?
|
23
23
|
# * 'Encoding'<~String> - ?
|
24
|
-
# * '
|
24
|
+
# * 'SecurityGroup.n'<~String> - Indexed names of security groups for instances
|
25
25
|
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
|
26
26
|
# in ['m1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.2xlarge', 'm2.4xlarge']
|
27
27
|
# default is 'm1.small'
|
data/lib/fog/aws/s3.rb
CHANGED
@@ -59,8 +59,12 @@ module Fog
|
|
59
59
|
# ==== Returns
|
60
60
|
# * S3 object with connection to aws.
|
61
61
|
def initialize(options={})
|
62
|
-
@aws_access_key_id
|
63
|
-
|
62
|
+
unless @aws_access_key_id = options[:aws_access_key_id]
|
63
|
+
raise ArgumentError.new('aws_access_key_id is required to access ec2')
|
64
|
+
end
|
65
|
+
unless @aws_secret_access_key = options[:aws_secret_access_key]
|
66
|
+
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
67
|
+
end
|
64
68
|
@hmac = HMAC::SHA1.new(@aws_secret_access_key)
|
65
69
|
@host = options[:host] || 's3.amazonaws.com'
|
66
70
|
@port = options[:port] || 443
|
data/lib/fog/rackspace.rb
CHANGED
@@ -9,12 +9,18 @@ module Fog
|
|
9
9
|
unless Fog.mocking?
|
10
10
|
|
11
11
|
def self.authenticate(options)
|
12
|
+
unless @rackspace_api_key = options[:rackspace_api_key]
|
13
|
+
raise ArgumentError.new('rackspace_api_key is required to access rackspace')
|
14
|
+
end
|
15
|
+
unless @rackspace_username = options[:rackspace_username]
|
16
|
+
raise ArgumentError.new('rackspace_username is required to access rackspace')
|
17
|
+
end
|
12
18
|
connection = Fog::Connection.new("https://auth.api.rackspacecloud.com")
|
13
19
|
response = connection.request({
|
14
20
|
:expects => 204,
|
15
21
|
:headers => {
|
16
|
-
'X-Auth-Key' =>
|
17
|
-
'X-Auth-User' =>
|
22
|
+
'X-Auth-Key' => @rackspace_api_key,
|
23
|
+
'X-Auth-User' => @rackspace_username
|
18
24
|
},
|
19
25
|
:host => 'auth.api.rackspacecloud.com',
|
20
26
|
:method => 'GET',
|
data/lib/fog/slicehost.rb
CHANGED
@@ -30,7 +30,9 @@ module Fog
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def initialize(options={})
|
33
|
-
@password
|
33
|
+
unless @password = options[:password]
|
34
|
+
raise ArgumentError.new('password is required to access slicehost')
|
35
|
+
end
|
34
36
|
@host = options[:host] || "api.slicehost.com"
|
35
37
|
@port = options[:port] || 443
|
36
38
|
@scheme = options[:scheme] || 'https'
|