fog 0.0.56 → 0.0.57
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/fog.gemspec +4 -4
- data/lib/fog/aws.rb +4 -3
- data/lib/fog/aws/ec2.rb +136 -150
- data/lib/fog/aws/models/ec2/address.rb +3 -1
- data/lib/fog/aws/models/ec2/addresses.rb +20 -6
- data/lib/fog/aws/models/ec2/flavor.rb +3 -1
- data/lib/fog/aws/models/ec2/flavors.rb +14 -3
- data/lib/fog/aws/models/ec2/image.rb +3 -1
- data/lib/fog/aws/models/ec2/images.rb +14 -3
- data/lib/fog/aws/models/ec2/key_pair.rb +3 -1
- data/lib/fog/aws/models/ec2/key_pairs.rb +14 -3
- data/lib/fog/aws/models/ec2/security_group.rb +3 -1
- data/lib/fog/aws/models/ec2/security_groups.rb +14 -3
- data/lib/fog/aws/models/ec2/server.rb +3 -1
- data/lib/fog/aws/models/ec2/servers.rb +14 -3
- data/lib/fog/aws/models/ec2/snapshot.rb +3 -1
- data/lib/fog/aws/models/ec2/snapshots.rb +18 -5
- data/lib/fog/aws/models/ec2/volume.rb +3 -1
- data/lib/fog/aws/models/ec2/volumes.rb +18 -5
- data/lib/fog/aws/models/s3/directories.rb +14 -3
- data/lib/fog/aws/models/s3/directory.rb +4 -1
- data/lib/fog/aws/models/s3/file.rb +3 -1
- data/lib/fog/aws/models/s3/files.rb +4 -1
- data/lib/fog/aws/parsers/simpledb/domain_metadata.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/get_attributes.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/list_domains.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/select.rb +2 -0
- data/lib/fog/aws/requests/ec2/allocate_address.rb +11 -16
- data/lib/fog/aws/requests/ec2/associate_address.rb +14 -19
- data/lib/fog/aws/requests/ec2/attach_volume.rb +16 -21
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +29 -27
- data/lib/fog/aws/requests/ec2/create_key_pair.rb +13 -18
- data/lib/fog/aws/requests/ec2/create_security_group.rb +14 -19
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +13 -18
- data/lib/fog/aws/requests/ec2/create_volume.rb +14 -19
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +12 -17
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +13 -18
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +12 -17
- data/lib/fog/aws/requests/ec2/delete_volume.rb +13 -18
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_images.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_instances.rb +17 -22
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_regions.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_reserved_instances.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +12 -17
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +14 -19
- data/lib/fog/aws/requests/ec2/detach_volume.rb +11 -16
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +12 -17
- data/lib/fog/aws/requests/ec2/get_console_output.rb +12 -17
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +11 -16
- data/lib/fog/aws/requests/ec2/release_address.rb +12 -17
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +10 -15
- data/lib/fog/aws/requests/ec2/run_instances.rb +36 -38
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +16 -20
- data/lib/fog/aws/requests/s3/copy_object.rb +9 -15
- data/lib/fog/aws/requests/s3/delete_bucket.rb +9 -16
- data/lib/fog/aws/requests/s3/delete_object.rb +6 -14
- data/lib/fog/aws/requests/s3/get_bucket.rb +9 -14
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +8 -14
- data/lib/fog/aws/requests/s3/get_object.rb +7 -15
- data/lib/fog/aws/requests/s3/get_request_payment.rb +7 -13
- data/lib/fog/aws/requests/s3/get_service.rb +7 -13
- data/lib/fog/aws/requests/s3/head_object.rb +6 -14
- data/lib/fog/aws/requests/s3/put_bucket.rb +13 -21
- data/lib/fog/aws/requests/s3/put_object.rb +8 -16
- data/lib/fog/aws/requests/s3/put_request_payment.rb +7 -16
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +14 -21
- data/lib/fog/aws/requests/simpledb/create_domain.rb +11 -18
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +15 -22
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +11 -18
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +14 -19
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +19 -23
- data/lib/fog/aws/requests/simpledb/list_domains.rb +11 -16
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +15 -15
- data/lib/fog/aws/requests/simpledb/select.rb +12 -17
- data/lib/fog/aws/s3.rb +117 -121
- data/lib/fog/aws/simpledb.rb +127 -127
- data/lib/fog/rackspace/models/servers/images.rb +1 -1
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +11 -1
- metadata +4 -4
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
gem.name = "fog"
|
17
17
|
gem.description = %Q{brings clouds to you}
|
18
18
|
gem.summary = %Q{fog = clouds + you}
|
19
|
-
gem.email = "
|
19
|
+
gem.email = "geemus@gmail.com"
|
20
20
|
gem.homepage = "http://github.com/geemus/fog"
|
21
21
|
gem.authors = ["geemus (Wesley Beary)"]
|
22
22
|
gem.rubyforge_project = "fog"
|
data/VERSION.yml
CHANGED
data/fog.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
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.57"
|
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-03-
|
12
|
+
s.date = %q{2010-03-17}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
|
-
s.email = %q{
|
15
|
+
s.email = %q{geemus@gmail.com}
|
16
16
|
s.executables = ["fog"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"README.rdoc"
|
data/lib/fog/aws.rb
CHANGED
data/lib/fog/aws/ec2.rb
CHANGED
@@ -1,12 +1,65 @@
|
|
1
|
+
require 'fog/aws/models/ec2/address'
|
2
|
+
require 'fog/aws/models/ec2/addresses'
|
3
|
+
require 'fog/aws/models/ec2/flavor'
|
4
|
+
require 'fog/aws/models/ec2/flavors'
|
5
|
+
require 'fog/aws/models/ec2/image'
|
6
|
+
require 'fog/aws/models/ec2/images'
|
7
|
+
require 'fog/aws/models/ec2/key_pair'
|
8
|
+
require 'fog/aws/models/ec2/key_pairs'
|
9
|
+
require 'fog/aws/models/ec2/security_group'
|
10
|
+
require 'fog/aws/models/ec2/security_groups'
|
11
|
+
require 'fog/aws/models/ec2/server'
|
12
|
+
require 'fog/aws/models/ec2/servers'
|
13
|
+
require 'fog/aws/models/ec2/snapshot'
|
14
|
+
require 'fog/aws/models/ec2/snapshots'
|
15
|
+
require 'fog/aws/models/ec2/volume'
|
16
|
+
require 'fog/aws/models/ec2/volumes'
|
17
|
+
require 'fog/aws/requests/ec2/allocate_address'
|
18
|
+
require 'fog/aws/requests/ec2/associate_address'
|
19
|
+
require 'fog/aws/requests/ec2/attach_volume'
|
20
|
+
require 'fog/aws/requests/ec2/authorize_security_group_ingress'
|
21
|
+
require 'fog/aws/requests/ec2/create_key_pair'
|
22
|
+
require 'fog/aws/requests/ec2/create_security_group'
|
23
|
+
require 'fog/aws/requests/ec2/create_snapshot'
|
24
|
+
require 'fog/aws/requests/ec2/create_volume'
|
25
|
+
require 'fog/aws/requests/ec2/delete_key_pair'
|
26
|
+
require 'fog/aws/requests/ec2/delete_security_group'
|
27
|
+
require 'fog/aws/requests/ec2/delete_snapshot'
|
28
|
+
require 'fog/aws/requests/ec2/delete_volume'
|
29
|
+
require 'fog/aws/requests/ec2/describe_addresses'
|
30
|
+
require 'fog/aws/requests/ec2/describe_availability_zones'
|
31
|
+
require 'fog/aws/requests/ec2/describe_images'
|
32
|
+
require 'fog/aws/requests/ec2/describe_instances'
|
33
|
+
require 'fog/aws/requests/ec2/describe_reserved_instances'
|
34
|
+
require 'fog/aws/requests/ec2/describe_key_pairs'
|
35
|
+
require 'fog/aws/requests/ec2/describe_regions'
|
36
|
+
require 'fog/aws/requests/ec2/describe_security_groups'
|
37
|
+
require 'fog/aws/requests/ec2/describe_snapshots'
|
38
|
+
require 'fog/aws/requests/ec2/describe_volumes'
|
39
|
+
require 'fog/aws/requests/ec2/detach_volume'
|
40
|
+
require 'fog/aws/requests/ec2/disassociate_address'
|
41
|
+
require 'fog/aws/requests/ec2/get_console_output'
|
42
|
+
require 'fog/aws/requests/ec2/reboot_instances'
|
43
|
+
require 'fog/aws/requests/ec2/release_address'
|
44
|
+
require 'fog/aws/requests/ec2/revoke_security_group_ingress'
|
45
|
+
require 'fog/aws/requests/ec2/run_instances'
|
46
|
+
require 'fog/aws/requests/ec2/terminate_instances'
|
47
|
+
|
1
48
|
module Fog
|
2
49
|
module AWS
|
3
|
-
|
50
|
+
module EC2
|
4
51
|
|
5
|
-
|
6
|
-
|
7
|
-
|
52
|
+
def self.new(options={})
|
53
|
+
if Fog.mocking?
|
54
|
+
Fog::AWS::EC2::Mock.new(options)
|
55
|
+
else
|
56
|
+
Fog::AWS::EC2::Real.new(options)
|
8
57
|
end
|
9
|
-
|
58
|
+
end
|
59
|
+
|
60
|
+
class Mock
|
61
|
+
|
62
|
+
def reset_data
|
10
63
|
@data = {
|
11
64
|
:deleted_at => {},
|
12
65
|
:addresses => {},
|
@@ -17,163 +70,96 @@ module Fog
|
|
17
70
|
:volumes => {}
|
18
71
|
}
|
19
72
|
end
|
20
|
-
end
|
21
73
|
|
22
|
-
|
23
|
-
[
|
24
|
-
"fog/aws/models/ec2/address.rb",
|
25
|
-
"fog/aws/models/ec2/addresses.rb",
|
26
|
-
"fog/aws/models/ec2/flavor.rb",
|
27
|
-
"fog/aws/models/ec2/flavors.rb",
|
28
|
-
"fog/aws/models/ec2/image.rb",
|
29
|
-
"fog/aws/models/ec2/images.rb",
|
30
|
-
"fog/aws/models/ec2/key_pair.rb",
|
31
|
-
"fog/aws/models/ec2/key_pairs.rb",
|
32
|
-
"fog/aws/models/ec2/security_group.rb",
|
33
|
-
"fog/aws/models/ec2/security_groups.rb",
|
34
|
-
"fog/aws/models/ec2/server.rb",
|
35
|
-
"fog/aws/models/ec2/servers.rb",
|
36
|
-
"fog/aws/models/ec2/snapshot.rb",
|
37
|
-
"fog/aws/models/ec2/snapshots.rb",
|
38
|
-
"fog/aws/models/ec2/volume.rb",
|
39
|
-
"fog/aws/models/ec2/volumes.rb",
|
40
|
-
"fog/aws/parsers/ec2/allocate_address.rb",
|
41
|
-
"fog/aws/parsers/ec2/attach_volume.rb",
|
42
|
-
"fog/aws/parsers/ec2/basic.rb",
|
43
|
-
"fog/aws/parsers/ec2/create_key_pair.rb",
|
44
|
-
"fog/aws/parsers/ec2/create_snapshot.rb",
|
45
|
-
"fog/aws/parsers/ec2/create_volume.rb",
|
46
|
-
"fog/aws/parsers/ec2/describe_addresses.rb",
|
47
|
-
"fog/aws/parsers/ec2/describe_availability_zones.rb",
|
48
|
-
"fog/aws/parsers/ec2/describe_images.rb",
|
49
|
-
"fog/aws/parsers/ec2/describe_instances.rb",
|
50
|
-
"fog/aws/parsers/ec2/describe_reserved_instances.rb",
|
51
|
-
"fog/aws/parsers/ec2/describe_key_pairs.rb",
|
52
|
-
"fog/aws/parsers/ec2/describe_regions.rb",
|
53
|
-
"fog/aws/parsers/ec2/describe_security_groups.rb",
|
54
|
-
"fog/aws/parsers/ec2/describe_snapshots.rb",
|
55
|
-
"fog/aws/parsers/ec2/describe_volumes.rb",
|
56
|
-
"fog/aws/parsers/ec2/detach_volume.rb",
|
57
|
-
"fog/aws/parsers/ec2/get_console_output.rb",
|
58
|
-
"fog/aws/parsers/ec2/run_instances.rb",
|
59
|
-
"fog/aws/parsers/ec2/terminate_instances.rb",
|
60
|
-
"fog/aws/requests/ec2/allocate_address.rb",
|
61
|
-
"fog/aws/requests/ec2/associate_address.rb",
|
62
|
-
"fog/aws/requests/ec2/attach_volume.rb",
|
63
|
-
"fog/aws/requests/ec2/authorize_security_group_ingress.rb",
|
64
|
-
"fog/aws/requests/ec2/create_key_pair.rb",
|
65
|
-
"fog/aws/requests/ec2/create_security_group.rb",
|
66
|
-
"fog/aws/requests/ec2/create_snapshot.rb",
|
67
|
-
"fog/aws/requests/ec2/create_volume.rb",
|
68
|
-
"fog/aws/requests/ec2/delete_key_pair.rb",
|
69
|
-
"fog/aws/requests/ec2/delete_security_group.rb",
|
70
|
-
"fog/aws/requests/ec2/delete_snapshot.rb",
|
71
|
-
"fog/aws/requests/ec2/delete_volume.rb",
|
72
|
-
"fog/aws/requests/ec2/describe_addresses.rb",
|
73
|
-
"fog/aws/requests/ec2/describe_availability_zones.rb",
|
74
|
-
"fog/aws/requests/ec2/describe_images.rb",
|
75
|
-
"fog/aws/requests/ec2/describe_instances.rb",
|
76
|
-
"fog/aws/requests/ec2/describe_reserved_instances.rb",
|
77
|
-
"fog/aws/requests/ec2/describe_key_pairs.rb",
|
78
|
-
"fog/aws/requests/ec2/describe_regions.rb",
|
79
|
-
"fog/aws/requests/ec2/describe_security_groups.rb",
|
80
|
-
"fog/aws/requests/ec2/describe_snapshots.rb",
|
81
|
-
"fog/aws/requests/ec2/describe_volumes.rb",
|
82
|
-
"fog/aws/requests/ec2/detach_volume.rb",
|
83
|
-
"fog/aws/requests/ec2/disassociate_address.rb",
|
84
|
-
"fog/aws/requests/ec2/get_console_output.rb",
|
85
|
-
"fog/aws/requests/ec2/reboot_instances.rb",
|
86
|
-
"fog/aws/requests/ec2/release_address.rb",
|
87
|
-
"fog/aws/requests/ec2/revoke_security_group_ingress.rb",
|
88
|
-
"fog/aws/requests/ec2/run_instances.rb",
|
89
|
-
"fog/aws/requests/ec2/terminate_instances.rb"
|
90
|
-
]
|
91
|
-
end
|
92
|
-
|
93
|
-
def self.reload
|
94
|
-
self.dependencies.each {|dependency| load(dependency)}
|
95
|
-
if Fog.mocking?
|
74
|
+
def initialize(options={})
|
96
75
|
reset_data
|
97
76
|
end
|
98
|
-
end
|
99
77
|
|
100
|
-
# Initialize connection to EC2
|
101
|
-
#
|
102
|
-
# ==== Notes
|
103
|
-
# options parameter must include values for :aws_access_key_id and
|
104
|
-
# :aws_secret_access_key in order to create a connection
|
105
|
-
#
|
106
|
-
# ==== Examples
|
107
|
-
# sdb = SimpleDB.new(
|
108
|
-
# :aws_access_key_id => your_aws_access_key_id,
|
109
|
-
# :aws_secret_access_key => your_aws_secret_access_key
|
110
|
-
# )
|
111
|
-
#
|
112
|
-
# ==== Parameters
|
113
|
-
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
114
|
-
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1']
|
115
|
-
#
|
116
|
-
# ==== Returns
|
117
|
-
# * EC2 object with connection to aws.
|
118
|
-
def initialize(options={})
|
119
|
-
unless @aws_access_key_id = options[:aws_access_key_id]
|
120
|
-
raise ArgumentError.new('aws_access_key_id is required to access ec2')
|
121
|
-
end
|
122
|
-
unless @aws_secret_access_key = options[:aws_secret_access_key]
|
123
|
-
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
124
|
-
end
|
125
|
-
@hmac = HMAC::SHA256.new(@aws_secret_access_key)
|
126
|
-
@host = options[:host] || case options[:region]
|
127
|
-
when 'eu-west-1'
|
128
|
-
'ec2.eu-west-1.amazonaws.com'
|
129
|
-
when 'us-east-1'
|
130
|
-
'ec2.us-east-1.amazonaws.com'
|
131
|
-
when 'us-west-1'
|
132
|
-
'ec2.us-west-1.amazonaws.com'
|
133
|
-
else
|
134
|
-
'ec2.amazonaws.com'
|
135
|
-
end
|
136
|
-
@port = options[:port] || 443
|
137
|
-
@scheme = options[:scheme] || 'https'
|
138
78
|
end
|
139
79
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
80
|
+
class Real
|
81
|
+
|
82
|
+
# Initialize connection to EC2
|
83
|
+
#
|
84
|
+
# ==== Notes
|
85
|
+
# options parameter must include values for :aws_access_key_id and
|
86
|
+
# :aws_secret_access_key in order to create a connection
|
87
|
+
#
|
88
|
+
# ==== Examples
|
89
|
+
# sdb = SimpleDB.new(
|
90
|
+
# :aws_access_key_id => your_aws_access_key_id,
|
91
|
+
# :aws_secret_access_key => your_aws_secret_access_key
|
92
|
+
# )
|
93
|
+
#
|
94
|
+
# ==== Parameters
|
95
|
+
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
96
|
+
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1']
|
97
|
+
#
|
98
|
+
# ==== Returns
|
99
|
+
# * EC2 object with connection to aws.
|
100
|
+
def initialize(options={})
|
101
|
+
unless @aws_access_key_id = options[:aws_access_key_id]
|
102
|
+
raise ArgumentError.new('aws_access_key_id is required to access ec2')
|
103
|
+
end
|
104
|
+
unless @aws_secret_access_key = options[:aws_secret_access_key]
|
105
|
+
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
106
|
+
end
|
107
|
+
@hmac = HMAC::SHA256.new(@aws_secret_access_key)
|
108
|
+
@host = options[:host] || case options[:region]
|
109
|
+
when 'eu-west-1'
|
110
|
+
'ec2.eu-west-1.amazonaws.com'
|
111
|
+
when 'us-east-1'
|
112
|
+
'ec2.us-east-1.amazonaws.com'
|
113
|
+
when 'us-west-1'
|
114
|
+
'ec2.us-west-1.amazonaws.com'
|
115
|
+
else
|
116
|
+
'ec2.amazonaws.com'
|
156
117
|
end
|
118
|
+
@port = options[:port] || 443
|
119
|
+
@scheme = options[:scheme] || 'https'
|
157
120
|
end
|
158
121
|
|
159
|
-
|
160
|
-
hmac = @hmac.update(string_to_sign)
|
161
|
-
body << "Signature=#{CGI.escape(Base64.encode64(hmac.digest).chomp!).gsub(/\+/, '%20')}"
|
122
|
+
private
|
162
123
|
|
163
|
-
|
164
|
-
|
165
|
-
:expects => 200,
|
166
|
-
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
167
|
-
:host => @host,
|
168
|
-
:method => 'POST',
|
169
|
-
:parser => parser
|
170
|
-
})
|
124
|
+
def request(params)
|
125
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
171
126
|
|
172
|
-
|
173
|
-
|
127
|
+
idempotent = params.delete(:idempotent)
|
128
|
+
parser = params.delete(:parser)
|
129
|
+
|
130
|
+
params.merge!({
|
131
|
+
'AWSAccessKeyId' => @aws_access_key_id,
|
132
|
+
'SignatureMethod' => 'HmacSHA256',
|
133
|
+
'SignatureVersion' => '2',
|
134
|
+
'Timestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
135
|
+
'Version' => '2009-11-30'
|
136
|
+
})
|
137
|
+
|
138
|
+
body = ''
|
139
|
+
for key in params.keys.sort
|
140
|
+
unless (value = params[key]).nil?
|
141
|
+
body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
string_to_sign = "POST\n#{@host}\n/\n" << body.chop
|
146
|
+
hmac = @hmac.update(string_to_sign)
|
147
|
+
body << "Signature=#{CGI.escape(Base64.encode64(hmac.digest).chomp!).gsub(/\+/, '%20')}"
|
174
148
|
|
149
|
+
response = @connection.request({
|
150
|
+
:body => body,
|
151
|
+
:expects => 200,
|
152
|
+
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
153
|
+
:idempotent => idempotent,
|
154
|
+
:host => @host,
|
155
|
+
:method => 'POST',
|
156
|
+
:parser => parser
|
157
|
+
})
|
158
|
+
|
159
|
+
response
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
175
163
|
end
|
176
164
|
end
|
177
165
|
end
|
178
|
-
|
179
|
-
Fog::AWS::EC2.reload
|
@@ -1,11 +1,24 @@
|
|
1
|
+
require 'fog/collection'
|
2
|
+
require 'fog/aws/models/ec2/address'
|
3
|
+
|
1
4
|
module Fog
|
2
5
|
module AWS
|
3
|
-
|
6
|
+
module EC2
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
class Mock
|
9
|
+
def addresses(attributes = {})
|
10
|
+
Fog::AWS::EC2::Addresses.new({
|
11
|
+
:connection => self
|
12
|
+
}.merge!(attributes))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Real
|
17
|
+
def addresses(attributes = {})
|
18
|
+
Fog::AWS::EC2::Addresses.new({
|
19
|
+
:connection => self
|
20
|
+
}.merge!(attributes))
|
21
|
+
end
|
9
22
|
end
|
10
23
|
|
11
24
|
class Addresses < Fog::Collection
|
@@ -29,8 +42,9 @@ module Fog
|
|
29
42
|
end
|
30
43
|
)
|
31
44
|
if server
|
32
|
-
self.replace(self.select {|address| address.
|
45
|
+
self.replace(self.select {|address| address.server_id == server.id})
|
33
46
|
end
|
47
|
+
self
|
34
48
|
end
|
35
49
|
|
36
50
|
def get(public_ip)
|
@@ -1,9 +1,20 @@
|
|
1
|
+
require 'fog/collection'
|
2
|
+
require 'fog/aws/models/ec2/flavor'
|
3
|
+
|
1
4
|
module Fog
|
2
5
|
module AWS
|
3
|
-
|
6
|
+
module EC2
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
class Mock
|
9
|
+
def flavors
|
10
|
+
Fog::AWS::EC2::Flavors.new(:connection => self)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Real
|
15
|
+
def flavors
|
16
|
+
Fog::AWS::EC2::Flavors.new(:connection => self)
|
17
|
+
end
|
7
18
|
end
|
8
19
|
|
9
20
|
class Flavors < Fog::Collection
|