fog 0.0.57 → 0.0.58
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/fog.gemspec +1 -1
- data/lib/fog/aws/ec2.rb +33 -18
- data/lib/fog/aws/s3.rb +18 -3
- data/lib/fog/aws/simpledb.rb +18 -3
- metadata +2 -2
data/VERSION.yml
CHANGED
data/fog.gemspec
CHANGED
data/lib/fog/aws/ec2.rb
CHANGED
@@ -50,6 +50,12 @@ module Fog
|
|
50
50
|
module EC2
|
51
51
|
|
52
52
|
def self.new(options={})
|
53
|
+
unless options[:aws_access_key_id]
|
54
|
+
raise ArgumentError.new('aws_access_key_id is required to access ec2')
|
55
|
+
end
|
56
|
+
unless options[:aws_secret_access_key]
|
57
|
+
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
58
|
+
end
|
53
59
|
if Fog.mocking?
|
54
60
|
Fog::AWS::EC2::Mock.new(options)
|
55
61
|
else
|
@@ -57,22 +63,35 @@ module Fog
|
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
66
|
+
def self.reset_data(keys=Mock.data.keys)
|
67
|
+
Mock.reset_data(keys)
|
68
|
+
end
|
69
|
+
|
60
70
|
class Mock
|
61
71
|
|
62
|
-
def
|
63
|
-
@data
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
def self.data
|
73
|
+
@data ||= Hash.new do |hash, key|
|
74
|
+
hash[key] = {
|
75
|
+
:deleted_at => {},
|
76
|
+
:addresses => {},
|
77
|
+
:instances => {},
|
78
|
+
:key_pairs => {},
|
79
|
+
:security_groups => {},
|
80
|
+
:snapshots => {},
|
81
|
+
:volumes => {}
|
82
|
+
}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.reset_data(keys=data.keys)
|
87
|
+
for key in [*keys]
|
88
|
+
data.delete(key)
|
89
|
+
end
|
72
90
|
end
|
73
91
|
|
74
92
|
def initialize(options={})
|
75
|
-
|
93
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
94
|
+
@data = self.class.data[@aws_access_key_id]
|
76
95
|
end
|
77
96
|
|
78
97
|
end
|
@@ -98,13 +117,9 @@ module Fog
|
|
98
117
|
# ==== Returns
|
99
118
|
# * EC2 object with connection to aws.
|
100
119
|
def initialize(options={})
|
101
|
-
|
102
|
-
|
103
|
-
|
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)
|
120
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
121
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
122
|
+
@hmac = HMAC::SHA256.new(@aws_secret_access_key)
|
108
123
|
@host = options[:host] || case options[:region]
|
109
124
|
when 'eu-west-1'
|
110
125
|
'ec2.eu-west-1.amazonaws.com'
|
data/lib/fog/aws/s3.rb
CHANGED
@@ -48,14 +48,29 @@ module Fog
|
|
48
48
|
metadata
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.reset_data(keys=Mock.data.keys)
|
52
|
+
Mock.reset_data(keys)
|
53
|
+
end
|
54
|
+
|
51
55
|
class Mock
|
52
56
|
|
53
|
-
def
|
54
|
-
@data
|
57
|
+
def self.data
|
58
|
+
@data ||= Hash.new do |hash, key|
|
59
|
+
hash[key] = {
|
60
|
+
:buckets => {}
|
61
|
+
}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.reset_data(keys=data.keys)
|
66
|
+
for key in [*keys]
|
67
|
+
data.delete(key)
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
71
|
def initialize(options={})
|
58
|
-
|
72
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
73
|
+
@data = self.class.data[@aws_access_key_id]
|
59
74
|
end
|
60
75
|
|
61
76
|
end
|
data/lib/fog/aws/simpledb.rb
CHANGED
@@ -20,14 +20,29 @@ module Fog
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.reset_data(keys=Mock.data.keys)
|
24
|
+
Mock.reset_data(keys)
|
25
|
+
end
|
26
|
+
|
23
27
|
class Mock
|
24
28
|
|
25
|
-
def
|
26
|
-
@data
|
29
|
+
def self.data
|
30
|
+
@data ||= Hash.new do |hash, key|
|
31
|
+
hash[key] = {
|
32
|
+
:domains => {}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.reset_data(keys=data.keys)
|
38
|
+
for key in [*keys]
|
39
|
+
data.delete(key)
|
40
|
+
end
|
27
41
|
end
|
28
42
|
|
29
43
|
def initialize(options={})
|
30
|
-
|
44
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
45
|
+
@data = self.class.data[@aws_access_key_id]
|
31
46
|
end
|
32
47
|
|
33
48
|
end
|