fog 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/Gemfile.lock +11 -6
  2. data/changelog.txt +49 -0
  3. data/fog.gemspec +5 -4
  4. data/lib/fog.rb +1 -1
  5. data/lib/fog/aws/cloud_formation.rb +124 -0
  6. data/lib/fog/aws/elb.rb +4 -1
  7. data/lib/fog/aws/iam.rb +6 -0
  8. data/lib/fog/aws/parsers/cloud_formation/basic.rb +12 -0
  9. data/lib/fog/aws/parsers/cloud_formation/create_stack.rb +19 -0
  10. data/lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb +31 -0
  11. data/lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb +31 -0
  12. data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +72 -0
  13. data/lib/fog/aws/parsers/cloud_formation/get_template.rb +19 -0
  14. data/lib/fog/aws/parsers/cloud_formation/validate_template.rb +52 -0
  15. data/lib/fog/aws/parsers/iam/login_profile.rb +27 -0
  16. data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +26 -0
  17. data/lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb +38 -0
  18. data/lib/fog/aws/parsers/rds/create_db_instance.rb +34 -0
  19. data/lib/fog/aws/parsers/rds/create_db_instance_read_replica.rb +34 -0
  20. data/lib/fog/aws/parsers/rds/create_db_parameter_group.rb +35 -0
  21. data/lib/fog/aws/parsers/rds/create_db_security_group.rb +38 -0
  22. data/lib/fog/aws/parsers/rds/create_db_snapshot.rb +35 -0
  23. data/lib/fog/aws/parsers/rds/db_parser.rb +123 -0
  24. data/lib/fog/aws/parsers/rds/delete_db_instance.rb +35 -0
  25. data/lib/fog/aws/parsers/rds/delete_db_parameter_group.rb +27 -0
  26. data/lib/fog/aws/parsers/rds/delete_db_security_group.rb +33 -0
  27. data/lib/fog/aws/parsers/rds/delete_db_snapshot.rb +34 -0
  28. data/lib/fog/aws/parsers/rds/describe_db_instances.rb +36 -0
  29. data/lib/fog/aws/parsers/rds/describe_db_parameter_groups.rb +38 -0
  30. data/lib/fog/aws/parsers/rds/describe_db_parameters.rb +44 -0
  31. data/lib/fog/aws/parsers/rds/describe_db_security_groups.rb +39 -0
  32. data/lib/fog/aws/parsers/rds/describe_db_snapshots.rb +39 -0
  33. data/lib/fog/aws/parsers/rds/modify_db_instance.rb +34 -0
  34. data/lib/fog/aws/parsers/rds/modify_db_parameter_group.rb +28 -0
  35. data/lib/fog/aws/parsers/rds/reboot_db_instance.rb +35 -0
  36. data/lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb +34 -0
  37. data/lib/fog/aws/parsers/rds/restore_db_instance_to_point_in_time.rb +35 -0
  38. data/lib/fog/aws/parsers/rds/revoke_db_security_group_ingress.rb +39 -0
  39. data/lib/fog/aws/parsers/rds/security_group_parser.rb +39 -0
  40. data/lib/fog/aws/parsers/rds/snapshot_parser.rb +40 -0
  41. data/lib/fog/aws/rds.rb +161 -0
  42. data/lib/fog/aws/rds/models/parameter.rb +21 -0
  43. data/lib/fog/aws/rds/models/parameter_group.rb +36 -0
  44. data/lib/fog/aws/rds/models/parameter_groups.rb +27 -0
  45. data/lib/fog/aws/rds/models/parameters.rb +37 -0
  46. data/lib/fog/aws/rds/models/security_group.rb +73 -0
  47. data/lib/fog/aws/rds/models/security_groups.rb +43 -0
  48. data/lib/fog/aws/rds/models/server.rb +105 -0
  49. data/lib/fog/aws/rds/models/servers.rb +27 -0
  50. data/lib/fog/aws/rds/models/snapshot.rb +49 -0
  51. data/lib/fog/aws/rds/models/snapshots.rb +45 -0
  52. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +71 -0
  53. data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +30 -0
  54. data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +44 -0
  55. data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +43 -0
  56. data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +42 -0
  57. data/lib/fog/aws/requests/cloud_formation/get_template.rb +32 -0
  58. data/lib/fog/aws/requests/cloud_formation/validate_template.rb +34 -0
  59. data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -0
  60. data/lib/fog/aws/requests/iam/create_login_profile.rb +36 -0
  61. data/lib/fog/aws/requests/iam/delete_login_profile.rb +31 -0
  62. data/lib/fog/aws/requests/iam/delete_server_certificate.rb +32 -0
  63. data/lib/fog/aws/requests/iam/get_login_profile.rb +35 -0
  64. data/lib/fog/aws/requests/iam/update_login_profile.rb +33 -0
  65. data/lib/fog/aws/requests/iam/upload_server_certificate.rb +45 -0
  66. data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +43 -0
  67. data/lib/fog/aws/requests/rds/create_db_instance.rb +56 -0
  68. data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +42 -0
  69. data/lib/fog/aws/requests/rds/create_db_parameter_group.rb +41 -0
  70. data/lib/fog/aws/requests/rds/create_db_security_group.rb +37 -0
  71. data/lib/fog/aws/requests/rds/create_db_snapshot.rb +36 -0
  72. data/lib/fog/aws/requests/rds/delete_db_instance.rb +40 -0
  73. data/lib/fog/aws/requests/rds/delete_db_parameter_group.rb +36 -0
  74. data/lib/fog/aws/requests/rds/delete_db_security_group.rb +36 -0
  75. data/lib/fog/aws/requests/rds/delete_db_snapshot.rb +36 -0
  76. data/lib/fog/aws/requests/rds/describe_db_instances.rb +42 -0
  77. data/lib/fog/aws/requests/rds/describe_db_parameter_groups.rb +45 -0
  78. data/lib/fog/aws/requests/rds/describe_db_parameters.rb +46 -0
  79. data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +39 -0
  80. data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +42 -0
  81. data/lib/fog/aws/requests/rds/modify_db_instance.rb +54 -0
  82. data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +55 -0
  83. data/lib/fog/aws/requests/rds/reboot_db_instance.rb +34 -0
  84. data/lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb +34 -0
  85. data/lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb +35 -0
  86. data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +44 -0
  87. data/lib/fog/aws/simpledb.rb +21 -7
  88. data/lib/fog/bin.rb +2 -1
  89. data/lib/fog/bin/aws.rb +8 -0
  90. data/lib/fog/bin/virtual_box.rb +52 -0
  91. data/lib/fog/cdn/aws.rb +9 -8
  92. data/lib/fog/cdn/rackspace.rb +6 -6
  93. data/lib/fog/cdn/requests/rackspace/post_container.rb +30 -0
  94. data/lib/fog/cdn/requests/rackspace/put_container.rb +1 -1
  95. data/lib/fog/compute.rb +6 -3
  96. data/lib/fog/compute/aws.rb +11 -7
  97. data/lib/fog/compute/bluebox.rb +5 -6
  98. data/lib/fog/compute/brightbox.rb +3 -0
  99. data/lib/fog/compute/go_grid.rb +5 -6
  100. data/lib/fog/compute/linode.rb +5 -6
  101. data/lib/fog/compute/models/aws/flavors.rb +19 -18
  102. data/lib/fog/compute/models/aws/server.rb +23 -0
  103. data/lib/fog/compute/models/aws/tag.rb +1 -1
  104. data/lib/fog/compute/models/brightbox/server.rb +7 -1
  105. data/lib/fog/compute/models/virtual_box/medium.rb +87 -0
  106. data/lib/fog/compute/models/virtual_box/medium_format.rb +34 -0
  107. data/lib/fog/compute/models/virtual_box/mediums.rb +32 -0
  108. data/lib/fog/compute/models/virtual_box/nat_engine.rb +65 -0
  109. data/lib/fog/compute/models/virtual_box/nat_redirect.rb +91 -0
  110. data/lib/fog/compute/models/virtual_box/nat_redirects.rb +41 -0
  111. data/lib/fog/compute/models/virtual_box/network_adapter.rb +82 -0
  112. data/lib/fog/compute/models/virtual_box/network_adapters.rb +42 -0
  113. data/lib/fog/compute/models/virtual_box/server.rb +241 -0
  114. data/lib/fog/compute/models/virtual_box/servers.rb +41 -0
  115. data/lib/fog/compute/models/virtual_box/storage_controller.rb +83 -0
  116. data/lib/fog/compute/models/virtual_box/storage_controllers.rb +38 -0
  117. data/lib/fog/compute/models/voxel/servers.rb +7 -6
  118. data/lib/fog/compute/new_servers.rb +5 -6
  119. data/lib/fog/compute/parsers/aws/monitor_unmonitor_instances.rb +35 -0
  120. data/lib/fog/compute/rackspace.rb +7 -7
  121. data/lib/fog/compute/requests/aws/delete_tags.rb +12 -9
  122. data/lib/fog/compute/requests/aws/monitor_instances.rb +52 -0
  123. data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +24 -8
  124. data/lib/fog/compute/requests/aws/unmonitor_instances.rb +53 -0
  125. data/lib/fog/compute/requests/brightbox/activate_console_server.rb +20 -0
  126. data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +20 -0
  127. data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +20 -0
  128. data/lib/fog/compute/slicehost.rb +5 -6
  129. data/lib/fog/compute/virtual_box.rb +48 -0
  130. data/lib/fog/compute/voxel.rb +30 -27
  131. data/lib/fog/core.rb +1 -0
  132. data/lib/fog/core/attributes.rb +3 -1
  133. data/lib/fog/core/collection.rb +2 -2
  134. data/lib/fog/core/credentials.rb +13 -3
  135. data/lib/fog/core/scp.rb +0 -4
  136. data/lib/fog/core/service.rb +0 -8
  137. data/lib/fog/core/ssh.rb +0 -4
  138. data/lib/fog/dns.rb +3 -3
  139. data/lib/fog/dns/aws.rb +8 -8
  140. data/lib/fog/dns/bluebox.rb +5 -7
  141. data/lib/fog/dns/dnsimple.rb +7 -7
  142. data/lib/fog/dns/linode.rb +5 -6
  143. data/lib/fog/dns/models/dnsimple/record.rb +11 -1
  144. data/lib/fog/dns/models/dnsimple/records.rb +7 -7
  145. data/lib/fog/dns/models/dnsimple/zones.rb +2 -1
  146. data/lib/fog/dns/requests/dnsimple/get_record.rb +34 -0
  147. data/lib/fog/dns/slicehost.rb +5 -6
  148. data/lib/fog/dns/zerigo.rb +5 -7
  149. data/lib/fog/providers.rb +2 -1
  150. data/lib/fog/providers/aws.rb +10 -8
  151. data/lib/fog/providers/virtual_box.rb +11 -0
  152. data/lib/fog/storage.rb +21 -0
  153. data/lib/fog/storage/aws.rb +16 -32
  154. data/lib/fog/storage/google.rb +6 -27
  155. data/lib/fog/storage/local.rb +7 -7
  156. data/lib/fog/storage/models/rackspace/directory.rb +1 -1
  157. data/lib/fog/storage/models/rackspace/file.rb +1 -0
  158. data/lib/fog/storage/rackspace.rb +5 -27
  159. data/lib/fog/storage/requests/aws/put_object.rb +2 -2
  160. data/lib/fog/storage/requests/aws/upload_part.rb +1 -1
  161. data/lib/fog/storage/requests/google/put_object.rb +2 -2
  162. data/lib/fog/storage/requests/rackspace/put_object.rb +1 -1
  163. data/tests/aws/requests/cloud_formation/stack_tests.rb +130 -0
  164. data/tests/aws/requests/iam/login_profile_tests.rb +64 -0
  165. data/tests/aws/requests/rds/helper.rb +169 -0
  166. data/tests/aws/requests/rds/instance_tests.rb +129 -0
  167. data/tests/aws/requests/rds/model_tests.rb +98 -0
  168. data/tests/aws/requests/rds/parameter_group_tests.rb +68 -0
  169. data/tests/aws/requests/rds/parameter_request_tests.rb +35 -0
  170. data/tests/compute/models/aws/server_monitor_tests.rb +47 -0
  171. data/tests/compute/models/server_tests.rb +7 -23
  172. data/tests/compute/parsers/aws/monitor_unmonitor_instances_tests.rb +49 -0
  173. data/tests/compute/requests/aws/security_group_tests.rb +69 -52
  174. data/tests/compute/requests/aws/tag_tests.rb +5 -5
  175. data/tests/compute/requests/brightbox/helper.rb +7 -6
  176. data/tests/compute/requests/brightbox/server_tests.rb +5 -0
  177. data/tests/compute/requests/voxel/server_tests.rb +2 -3
  178. data/tests/storage/requests/aws/bucket_tests.rb +10 -0
  179. metadata +148 -12
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Brightbox
3
+ class Compute
4
+ class Real
5
+
6
+ def activate_console_server(identifier, options = {})
7
+ return nil if identifier.nil? || identifier == ""
8
+ request(
9
+ :expects => [202],
10
+ :method => 'POST',
11
+ :path => "/1.0/servers/#{identifier}/activate_console",
12
+ :headers => {"Content-Type" => "application/json"},
13
+ :body => options.to_json
14
+ )
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Brightbox
3
+ class Compute
4
+ class Real
5
+
6
+ def add_listeners_load_balancer(identifier, options = {})
7
+ return nil if identifier.nil? || identifier == ""
8
+ request(
9
+ :expects => [202],
10
+ :method => 'POST',
11
+ :path => "/1.0/load_balancers/#{identifier}/add_listeners",
12
+ :headers => {"Content-Type" => "application/json"},
13
+ :body => options.to_json
14
+ )
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Brightbox
3
+ class Compute
4
+ class Real
5
+
6
+ def remove_listeners_load_balancer(identifier, options = {})
7
+ return nil if identifier.nil? || identifier == ""
8
+ request(
9
+ :expects => [202],
10
+ :method => 'POST',
11
+ :path => "/1.0/load_balancers/#{identifier}/remove_listeners",
12
+ :headers => {"Content-Type" => "application/json"},
13
+ :body => options.to_json
14
+ )
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -34,12 +34,6 @@ module Fog
34
34
  end
35
35
  end
36
36
 
37
- def self.reset_data(keys=data.keys)
38
- for key in [*keys]
39
- data.delete(key)
40
- end
41
- end
42
-
43
37
  def initialize(options={})
44
38
  unless options.delete(:provider)
45
39
  location = caller.first
@@ -49,6 +43,11 @@ module Fog
49
43
  end
50
44
 
51
45
  @slicehost_password = options[:slicehost_password]
46
+ reset_data
47
+ end
48
+
49
+ def reset_data
50
+ self.class.data.delete(@slicehost_password)
52
51
  @data = self.class.data[@slicehost_password]
53
52
  end
54
53
 
@@ -0,0 +1,48 @@
1
+ module Fog
2
+ module VirtualBox
3
+ class Compute < Fog::Service
4
+
5
+ recognizes :provider # remove post deprecation
6
+
7
+ model_path 'fog/compute/models/virtual_box'
8
+ model :medium
9
+ collection :mediums
10
+ model :medium_format
11
+ model :nat_engine
12
+ model :nat_redirect
13
+ collection :nat_redirects
14
+ model :network_adapter
15
+ collection :network_adapters
16
+ model :server
17
+ collection :servers
18
+ model :storage_controller
19
+ collection :storage_controllers
20
+
21
+ class Mock
22
+
23
+ def initialize(options={})
24
+ Fog::Mock.not_implemented
25
+ end
26
+
27
+ end
28
+
29
+ class Real
30
+
31
+ def initialize(options={})
32
+ require 'virtualbox'
33
+ @connection = ::VirtualBox::Global.global.lib.virtualbox
34
+ end
35
+
36
+ # hack to provide 'requests'
37
+ def method_missing(method_sym, *arguments, &block)
38
+ if @connection.respond_to?(method_sym)
39
+ @connection.send(method_sym, *arguments)
40
+ else
41
+ super
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -23,38 +23,41 @@ module Fog
23
23
  include Collections
24
24
 
25
25
  def self.data
26
- @data ||= {
27
- :last_modified => { :servers => {}, :statuses => {}, :images => {} },
28
- :servers => [],
29
- :statuses => {},
30
- :images => [
31
- {'id' => 1, 'name' => "CentOS 4, 32-bit, base install"},
32
- {'id' => 2, 'name' => "CentOS 4, 64-bit, base install"},
33
- {'id' => 3, 'name' => "CentOS 5, 32-bit, base install"},
34
- {'id' => 4, 'name' => "CentOS 5, 64-bit, base install"},
35
- {'id' => 7, 'name' => "Fedora 10, 32-bit, base install"},
36
- {'id' => 8, 'name' => "Fedora 10, 64-bit, base install"},
37
- {'id' => 10, 'name' => "OpenSUSE 11, 64-bit, base install"},
38
- {'id' => 11, 'name' => "Debian 5.0 \"lenny\", 32-bit, base install"},
39
- {'id' => 12, 'name' => "Debian 5.0 \"lenny\", 64-bit, base install"},
40
- {'id' => 13, 'name' => "Ubuntu 8.04 \"Hardy\", 32-bit, base install"},
41
- {'id' => 14, 'name' => "Ubuntu 8.04 \"Hardy\", 64-bit, base install"},
42
- {'id' => 15, 'name' => "Voxel Server Environment (VSE), 32-bit, base install"},
43
- {'id' => 16, 'name' => "Voxel Server Environment (VSE), 64-bit, base install"},
44
- {'id' => 32, 'name' => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)"},
45
- {'id' => 55, 'name' => "Ubuntu 10.04 \"Lucid\", 64-bit, base install"} ]
46
- }
47
- end
48
-
49
- def self.reset_data(keys=data.keys)
50
- for key in [*keys]
51
- data.delete(key)
26
+ @data ||= Hash.new do |hash, key|
27
+ hash[key] = {
28
+ :last_modified => { :servers => {}, :statuses => {}, :images => {} },
29
+ :servers => [],
30
+ :statuses => {},
31
+ :images => [
32
+ {'id' => 1, 'name' => "CentOS 4, 32-bit, base install"},
33
+ {'id' => 2, 'name' => "CentOS 4, 64-bit, base install"},
34
+ {'id' => 3, 'name' => "CentOS 5, 32-bit, base install"},
35
+ {'id' => 4, 'name' => "CentOS 5, 64-bit, base install"},
36
+ {'id' => 7, 'name' => "Fedora 10, 32-bit, base install"},
37
+ {'id' => 8, 'name' => "Fedora 10, 64-bit, base install"},
38
+ {'id' => 10, 'name' => "OpenSUSE 11, 64-bit, base install"},
39
+ {'id' => 11, 'name' => "Debian 5.0 \"lenny\", 32-bit, base install"},
40
+ {'id' => 12, 'name' => "Debian 5.0 \"lenny\", 64-bit, base install"},
41
+ {'id' => 13, 'name' => "Ubuntu 8.04 \"Hardy\", 32-bit, base install"},
42
+ {'id' => 14, 'name' => "Ubuntu 8.04 \"Hardy\", 64-bit, base install"},
43
+ {'id' => 15, 'name' => "Voxel Server Environment (VSE), 32-bit, base install"},
44
+ {'id' => 16, 'name' => "Voxel Server Environment (VSE), 64-bit, base install"},
45
+ {'id' => 32, 'name' => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)"},
46
+ {'id' => 55, 'name' => "Ubuntu 10.04 \"Lucid\", 64-bit, base install"} ]
47
+ }
52
48
  end
53
49
  end
54
50
 
55
51
  def initialize(options={})
56
- @data = self.class.data
52
+ @voxel_api_key = options[:voxel_api_key]
53
+ reset_data
57
54
  end
55
+
56
+ def reset_data
57
+ self.class.data.delete(@voxel_api_key)
58
+ @data = self.class.data[@voxel_api_key]
59
+ end
60
+
58
61
  end
59
62
 
60
63
  class Real
@@ -9,6 +9,7 @@ require 'rubygems'
9
9
  require 'base64'
10
10
  require 'cgi'
11
11
  require 'excon'
12
+ require 'fileutils'
12
13
  require 'formatador'
13
14
  require 'time'
14
15
  require 'timeout'
@@ -152,7 +152,9 @@ module Fog
152
152
  def requires(*args)
153
153
  missing = []
154
154
  for arg in [:connection] | args
155
- missing << arg unless send("#{arg}")
155
+ unless send("#{arg}") || attributes.has_key?(arg)
156
+ missing << arg
157
+ end
156
158
  end
157
159
  unless missing.empty?
158
160
  if missing.length == 1
@@ -5,7 +5,7 @@ module Fog
5
5
  include Fog::Attributes::InstanceMethods
6
6
 
7
7
  Array.public_instance_methods(false).each do |method|
8
- unless [:reject, :select].include?(method.to_sym)
8
+ unless [:reject, :select, :slice].include?(method.to_sym)
9
9
  class_eval <<-RUBY
10
10
  def #{method}(*args)
11
11
  unless @loaded
@@ -17,7 +17,7 @@ module Fog
17
17
  end
18
18
  end
19
19
 
20
- %w[reject select].each do |method|
20
+ %w[reject select slice].each do |method|
21
21
  class_eval <<-RUBY
22
22
  def #{method}(*args)
23
23
  unless @loaded
@@ -18,7 +18,7 @@ module Fog
18
18
 
19
19
  # @return [String] The path for configuration_file
20
20
  def self.credentials_path
21
- @credential_path ||= File.expand_path(ENV["FOG_RC"] || '~/.fog')
21
+ @credential_path ||= File.expand_path(ENV["FOG_RC"] || (ENV['HOME'] && '~/.fog'))
22
22
  end
23
23
 
24
24
  # @return [String] The new path for credentials file
@@ -31,14 +31,24 @@ module Fog
31
31
  # @raise [LoadError] Configuration unavailable in configuration file
32
32
  def self.credentials
33
33
  @credentials ||= begin
34
- if File.exists?(credentials_path)
35
- credentials = YAML.load_file(credentials_path)
34
+ if credentials_path && File.exists?(credentials_path)
35
+ credentials = self.symbolize_credentials(YAML.load_file(credentials_path))
36
36
  (credentials && credentials[credential]) or raise LoadError.new(missing_credentials)
37
37
  else
38
38
  {}
39
39
  end
40
40
  end
41
41
  end
42
+
43
+ def self.symbolize_credentials(args)
44
+ if args.is_a? Hash
45
+ Hash[ args.collect do |key, value|
46
+ [key.to_sym, self.symbolize_credentials(value)]
47
+ end ]
48
+ else
49
+ args
50
+ end
51
+ end
42
52
 
43
53
  private
44
54
 
@@ -9,10 +9,6 @@ module Fog
9
9
  end
10
10
  end
11
11
 
12
- def self.reset_data(keys=Mock.data.keys)
13
- Mock.reset_data(keys)
14
- end
15
-
16
12
  class Mock
17
13
 
18
14
  def self.data
@@ -146,14 +146,6 @@ module Fog
146
146
  @recognized ||= []
147
147
  end
148
148
 
149
- def reset_data(keys=Mock.data.keys)
150
- Mock.reset_data(keys)
151
- end
152
-
153
- def reset_data(keys=Mock.data.keys)
154
- Mock.reset_data(keys)
155
- end
156
-
157
149
  def validate_options(options)
158
150
  missing = requirements - options.keys
159
151
  unless missing.empty?
@@ -9,10 +9,6 @@ module Fog
9
9
  end
10
10
  end
11
11
 
12
- def self.reset_data(keys=Mock.data.keys)
13
- Mock.reset_data(keys)
14
- end
15
-
16
12
  class Mock
17
13
 
18
14
  def self.data
@@ -10,6 +10,9 @@ module Fog
10
10
  when 'Bluebox'
11
11
  require 'fog/dns/bluebox'
12
12
  Fog::Bluebox::DNS.new(attributes)
13
+ when 'DNSimple'
14
+ require 'fog/dns/dnsimple'
15
+ Fog::DNSimple::DNS.new(attributes)
13
16
  when 'Linode'
14
17
  require 'fog/dns/linode'
15
18
  Fog::Linode::DNS.new(attributes)
@@ -19,9 +22,6 @@ module Fog
19
22
  when 'Zerigo'
20
23
  require 'fog/dns/zerigo'
21
24
  Fog::Zerigo::DNS.new(attributes)
22
- when 'DNSimple'
23
- require 'fog/dns/dnsimple'
24
- Fog::DNSimple::DNS.new(attributes)
25
25
  else
26
26
  raise ArgumentError.new("#{provider} is not a recognized dns provider")
27
27
  end
@@ -33,12 +33,6 @@ module Fog
33
33
  end
34
34
  end
35
35
 
36
- def self.reset_data(keys=data.keys)
37
- for key in [*keys]
38
- data.delete(key)
39
- end
40
- end
41
-
42
36
  def initialize(options={})
43
37
  unless options.delete(:provider)
44
38
  location = caller.first
@@ -48,8 +42,14 @@ module Fog
48
42
  end
49
43
 
50
44
  require 'mime/types'
51
- @aws_access_key_id = options[:aws_access_key_id]
52
- @data = self.class.data[options[:region]][@aws_access_key_id]
45
+ @aws_access_key_id = options[:aws_access_key_id]
46
+ @region = options[:region]
47
+ reset_data
48
+ end
49
+
50
+ def reset_data
51
+ self.class.data[@region].delete(@aws_access_key_id)
52
+ @data = self.class.data[@region][@aws_access_key_id]
53
53
  end
54
54
 
55
55
  def signature(params)
@@ -30,12 +30,6 @@ module Fog
30
30
  end
31
31
  end
32
32
 
33
- def self.reset_data(keys=data.keys)
34
- for key in [*keys]
35
- data.delete(key)
36
- end
37
- end
38
-
39
33
  def initialize(options={})
40
34
  unless options.delete(:provider)
41
35
  location = caller.first
@@ -46,8 +40,12 @@ module Fog
46
40
 
47
41
  @bluebox_customer_id = options[:bluebox_customer_id]
48
42
  @bluebox_api_key = options[:bluebox_api_key]
43
+ reset_data
44
+ end
45
+
46
+ def reset_data
47
+ self.class.data.delete(@bluebox_customer_id)
49
48
  @data = self.class.data[@bluebox_customer_id]
50
- @data = self.class.data[@bluebox_api_key]
51
49
  end
52
50
  end
53
51
 
@@ -21,6 +21,7 @@ module Fog
21
21
  request :list_records
22
22
  request :update_record
23
23
  request :delete_record
24
+ request :get_record
24
25
 
25
26
  class Mock
26
27
 
@@ -30,12 +31,6 @@ module Fog
30
31
  end
31
32
  end
32
33
 
33
- def self.reset_data(keys=data.keys)
34
- for key in [*keys]
35
- data.delete(key)
36
- end
37
- end
38
-
39
34
  def initialize(options={})
40
35
  unless options.delete(:provider)
41
36
  location = caller.first
@@ -47,8 +42,13 @@ module Fog
47
42
  @dnsimple_email = options[:dnsimple_email]
48
43
  @dnsimple_password = options[:dnsimple_password]
49
44
  @data = self.class.data[@dnsimple_email]
50
- @data = self.class.data[@dnsimple_password]
51
45
  end
46
+
47
+ def reset_data
48
+ self.class.data.delete(@dnsimple_email)
49
+ @data = self.class.data[@dnsimple_email]
50
+ end
51
+
52
52
  end
53
53
 
54
54
  class Real
@@ -30,12 +30,6 @@ module Fog
30
30
  end
31
31
  end
32
32
 
33
- def self.reset_data(keys=data.keys)
34
- for key in [*keys]
35
- data.delete(key)
36
- end
37
- end
38
-
39
33
  def initialize(options={})
40
34
  unless options.delete(:provider)
41
35
  location = caller.first
@@ -45,6 +39,11 @@ module Fog
45
39
  end
46
40
 
47
41
  @linode_api_key = options[:linode_api_key]
42
+ reset_data
43
+ end
44
+
45
+ def reset_data
46
+ self.class.data.delete(@linode_api_key)
48
47
  @data = self.class.data[@linode_api_key]
49
48
  end
50
49