fog 0.3.31 → 0.3.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/.document +3 -0
  2. data/.gitignore +10 -0
  3. data/Gemfile.lock +1 -4
  4. data/README.rdoc +29 -37
  5. data/Rakefile +5 -25
  6. data/bin/fog +1 -3
  7. data/examples/dns_methods.rb +389 -0
  8. data/examples/storage.rb +103 -0
  9. data/fog.gemspec +4 -778
  10. data/lib/fog.rb +5 -66
  11. data/lib/fog/aws.rb +3 -0
  12. data/lib/fog/aws/bin.rb +7 -2
  13. data/lib/fog/aws/cdn.rb +2 -2
  14. data/lib/fog/aws/compute.rb +2 -2
  15. data/lib/fog/aws/dns.rb +101 -0
  16. data/lib/fog/aws/elb.rb +2 -2
  17. data/lib/fog/aws/iam.rb +2 -2
  18. data/lib/fog/aws/models/compute/image.rb +1 -0
  19. data/lib/fog/aws/models/compute/server.rb +1 -1
  20. data/lib/fog/aws/models/compute/servers.rb +1 -13
  21. data/lib/fog/aws/parsers/compute/describe_images.rb +36 -34
  22. data/lib/fog/aws/parsers/dns/change_resource_record_sets.rb +26 -0
  23. data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +55 -0
  24. data/lib/fog/aws/parsers/dns/delete_hosted_zone.rb +25 -0
  25. data/lib/fog/aws/parsers/dns/get_change.rb +26 -0
  26. data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +43 -0
  27. data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +35 -0
  28. data/lib/fog/aws/parsers/dns/list_resource_record_sets.rb +46 -0
  29. data/lib/fog/aws/requests/compute/describe_images.rb +1 -0
  30. data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +90 -0
  31. data/lib/fog/aws/requests/dns/create_hosted_zone.rb +68 -0
  32. data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +48 -0
  33. data/lib/fog/aws/requests/dns/get_change.rb +47 -0
  34. data/lib/fog/aws/requests/dns/get_hosted_zone.rb +51 -0
  35. data/lib/fog/aws/requests/dns/list_hosted_zones.rb +63 -0
  36. data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +68 -0
  37. data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
  38. data/lib/fog/aws/requests/storage/put_object_url.rb +2 -2
  39. data/lib/fog/aws/requests/storage/sync_clock.rb +28 -0
  40. data/lib/fog/aws/simpledb.rb +2 -2
  41. data/lib/fog/aws/storage.rb +5 -3
  42. data/lib/fog/bluebox.rb +2 -0
  43. data/lib/fog/bluebox/compute.rb +2 -2
  44. data/lib/fog/brightbox.rb +2 -0
  45. data/lib/fog/brightbox/compute.rb +2 -2
  46. data/lib/fog/core.rb +21 -1
  47. data/lib/fog/core/bin.rb +3 -1
  48. data/lib/fog/core/compute.rb +1 -0
  49. data/lib/fog/core/credentials.rb +72 -50
  50. data/lib/fog/core/deprecation.rb +11 -5
  51. data/lib/fog/core/mock.rb +34 -0
  52. data/lib/fog/core/model.rb +9 -1
  53. data/lib/fog/core/service.rb +40 -26
  54. data/lib/fog/core/storage.rb +1 -0
  55. data/lib/fog/core/time.rb +21 -0
  56. data/lib/fog/core/wait_for.rb +17 -0
  57. data/lib/fog/go_grid.rb +2 -0
  58. data/lib/fog/go_grid/compute.rb +2 -2
  59. data/lib/fog/google.rb +2 -0
  60. data/lib/fog/google/requests/storage/get_bucket.rb +6 -5
  61. data/lib/fog/google/requests/storage/get_object_url.rb +4 -4
  62. data/lib/fog/google/requests/storage/put_object_url.rb +4 -4
  63. data/lib/fog/google/storage.rb +4 -3
  64. data/lib/fog/linode.rb +3 -0
  65. data/lib/fog/linode/bin.rb +5 -3
  66. data/lib/fog/linode/compute.rb +6 -2
  67. data/lib/fog/linode/dns.rb +80 -0
  68. data/lib/fog/linode/requests/dns/domain_create.rb +52 -0
  69. data/lib/fog/linode/requests/dns/domain_delete.rb +35 -0
  70. data/lib/fog/linode/requests/dns/domain_list.rb +50 -0
  71. data/lib/fog/linode/requests/dns/domain_resource_create.rb +53 -0
  72. data/lib/fog/linode/requests/dns/domain_resource_delete.rb +36 -0
  73. data/lib/fog/linode/requests/dns/domain_resource_list.rb +48 -0
  74. data/lib/fog/linode/requests/dns/domain_resource_update.rb +54 -0
  75. data/lib/fog/linode/requests/dns/domain_update.rb +48 -0
  76. data/lib/fog/local.rb +2 -0
  77. data/lib/fog/local/storage.rb +3 -3
  78. data/lib/fog/new_servers.rb +2 -0
  79. data/lib/fog/new_servers/compute.rb +2 -2
  80. data/lib/fog/rackspace.rb +2 -0
  81. data/lib/fog/rackspace/cdn.rb +2 -2
  82. data/lib/fog/rackspace/compute.rb +2 -2
  83. data/lib/fog/rackspace/storage.rb +2 -2
  84. data/lib/fog/slicehost.rb +3 -0
  85. data/lib/fog/slicehost/bin.rb +2 -0
  86. data/lib/fog/slicehost/compute.rb +2 -2
  87. data/lib/fog/slicehost/dns.rb +84 -0
  88. data/lib/fog/slicehost/parsers/dns/create_record.rb +26 -0
  89. data/lib/fog/slicehost/parsers/dns/create_zone.rb +26 -0
  90. data/lib/fog/slicehost/parsers/dns/get_record.rb +26 -0
  91. data/lib/fog/slicehost/parsers/dns/get_records.rb +30 -0
  92. data/lib/fog/slicehost/parsers/dns/get_zone.rb +26 -0
  93. data/lib/fog/slicehost/parsers/dns/get_zones.rb +30 -0
  94. data/lib/fog/slicehost/requests/compute/create_slice.rb +2 -2
  95. data/lib/fog/slicehost/requests/compute/delete_slice.rb +3 -17
  96. data/lib/fog/slicehost/requests/dns/create_record.rb +61 -0
  97. data/lib/fog/slicehost/requests/dns/create_zone.rb +54 -0
  98. data/lib/fog/slicehost/requests/dns/delete_record.rb +31 -0
  99. data/lib/fog/slicehost/requests/dns/delete_zone.rb +31 -0
  100. data/lib/fog/slicehost/requests/dns/get_record.rb +40 -0
  101. data/lib/fog/slicehost/requests/dns/get_records.rb +41 -0
  102. data/lib/fog/slicehost/requests/dns/get_zone.rb +40 -0
  103. data/lib/fog/slicehost/requests/dns/get_zones.rb +38 -0
  104. data/lib/fog/terremark.rb +2 -0
  105. data/lib/fog/terremark/ecloud.rb +2 -4
  106. data/lib/fog/vcloud.rb +4 -2
  107. data/lib/fog/vcloud/bin.rb +3 -1
  108. data/lib/fog/vcloud/mock_data_classes.rb +77 -11
  109. data/lib/fog/vcloud/terremark/ecloud.rb +22 -7
  110. data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_service.rb +60 -0
  111. data/lib/fog/vcloud/terremark/ecloud/models/backup_internet_services.rb +36 -0
  112. data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +28 -13
  113. data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +2 -2
  114. data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +1 -1
  115. data/lib/fog/vcloud/terremark/ecloud/models/network.rb +4 -1
  116. data/lib/fog/vcloud/terremark/ecloud/models/server.rb +5 -5
  117. data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +6 -2
  118. data/lib/fog/vcloud/terremark/ecloud/requests/add_backup_internet_service.rb +111 -0
  119. data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +2 -4
  120. data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +1 -3
  121. data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +39 -27
  122. data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +1 -2
  123. data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +21 -6
  124. data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +2 -1
  125. data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +34 -17
  126. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +12 -10
  127. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +15 -10
  128. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +1 -12
  129. data/lib/fog/zerigo.rb +15 -0
  130. data/lib/fog/zerigo/bin.rb +25 -0
  131. data/lib/fog/zerigo/dns.rb +96 -0
  132. data/lib/fog/zerigo/parsers/dns/count_hosts.rb +24 -0
  133. data/lib/fog/zerigo/parsers/dns/count_zones.rb +24 -0
  134. data/lib/fog/zerigo/parsers/dns/create_host.rb +26 -0
  135. data/lib/fog/zerigo/parsers/dns/create_zone.rb +26 -0
  136. data/lib/fog/zerigo/parsers/dns/find_hosts.rb +30 -0
  137. data/lib/fog/zerigo/parsers/dns/get_host.rb +26 -0
  138. data/lib/fog/zerigo/parsers/dns/get_zone.rb +56 -0
  139. data/lib/fog/zerigo/parsers/dns/get_zone_stats.rb +26 -0
  140. data/lib/fog/zerigo/parsers/dns/list_hosts.rb +30 -0
  141. data/lib/fog/zerigo/parsers/dns/list_zones.rb +30 -0
  142. data/lib/fog/zerigo/requests/dns/count_hosts.rb +36 -0
  143. data/lib/fog/zerigo/requests/dns/count_zones.rb +36 -0
  144. data/lib/fog/zerigo/requests/dns/create_host.rb +70 -0
  145. data/lib/fog/zerigo/requests/dns/create_zone.rb +97 -0
  146. data/lib/fog/zerigo/requests/dns/delete_host.rb +32 -0
  147. data/lib/fog/zerigo/requests/dns/delete_zone.rb +33 -0
  148. data/lib/fog/zerigo/requests/dns/find_hosts.rb +63 -0
  149. data/lib/fog/zerigo/requests/dns/get_host.rb +47 -0
  150. data/lib/fog/zerigo/requests/dns/get_zone.rb +57 -0
  151. data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +44 -0
  152. data/lib/fog/zerigo/requests/dns/list_hosts.rb +48 -0
  153. data/lib/fog/zerigo/requests/dns/list_zones.rb +53 -0
  154. data/lib/fog/zerigo/requests/dns/update_host.rb +60 -0
  155. data/lib/fog/zerigo/requests/dns/update_zone.rb +78 -0
  156. data/spec/spec_helper.rb +0 -5
  157. data/spec/vcloud/spec_helper.rb +3 -2
  158. data/spec/vcloud/terremark/ecloud/models/backup_internet_service_spec.rb +49 -0
  159. data/spec/vcloud/terremark/ecloud/models/backup_internet_services_spec.rb +29 -0
  160. data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +32 -13
  161. data/spec/vcloud/terremark/ecloud/models/network_spec.rb +7 -4
  162. data/spec/vcloud/terremark/ecloud/models/server_spec.rb +20 -0
  163. data/spec/vcloud/terremark/ecloud/requests/add_backup_internet_service_spec.rb +60 -0
  164. data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +3 -0
  165. data/spec/vcloud/terremark/ecloud/requests/configure_network_ip_spec.rb +55 -0
  166. data/spec/vcloud/terremark/ecloud/requests/delete_vapp_spec.rb +9 -0
  167. data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +60 -14
  168. data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +2 -0
  169. data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +3 -3
  170. data/tests/aws/requests/compute/image_tests.rb +15 -14
  171. data/tests/aws/requests/dns/dns_tests.rb +276 -0
  172. data/tests/brightbox/requests/compute/account_tests.rb +20 -9
  173. data/tests/brightbox/requests/compute/api_client_tests.rb +12 -4
  174. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +20 -6
  175. data/tests/brightbox/requests/compute/image_tests.rb +9 -4
  176. data/tests/brightbox/requests/compute/interface_tests.rb +8 -2
  177. data/tests/brightbox/requests/compute/server_tests.rb +17 -5
  178. data/tests/brightbox/requests/compute/server_type_tests.rb +8 -4
  179. data/tests/brightbox/requests/compute/user_tests.rb +13 -5
  180. data/tests/brightbox/requests/compute/zone_tests.rb +8 -4
  181. data/tests/core/attribute_tests.rb +45 -0
  182. data/tests/helper.rb +0 -2
  183. data/tests/linode/requests/dns/dns_tests.rb +262 -0
  184. data/tests/rackspace/requests/compute/address_tests.rb +1 -1
  185. data/tests/rackspace/requests/compute/image_tests.rb +1 -1
  186. data/tests/slicehost/requests/dns_tests/dns_tests.rb +279 -0
  187. data/tests/zerigo/helper.rb +0 -0
  188. data/tests/zerigo/requests/dns/dns_tests.rb +374 -0
  189. metadata +280 -36
  190. data/spec/compact_progress_bar_formatter.rb +0 -195
  191. data/spec/core/attributes_spec.rb +0 -52
  192. data/spec/lorem.txt +0 -1
data/lib/fog.rb CHANGED
@@ -1,80 +1,18 @@
1
- require 'rubygems'
2
- require 'base64'
3
- require 'cgi'
4
- require 'excon'
5
- require 'formatador'
6
- require 'time'
7
- require 'named-parameters'
8
-
9
- __DIR__ = File.dirname(__FILE__)
10
-
11
- $LOAD_PATH.unshift __DIR__ unless
12
- $LOAD_PATH.include?(__DIR__) ||
13
- $LOAD_PATH.include?(File.expand_path(__DIR__))
14
-
15
- require 'fog/core'
1
+ require File.join(File.dirname(__FILE__), 'fog', 'core')
16
2
 
17
3
  module Fog
18
4
 
19
- @mocking = false
20
-
21
5
  unless const_defined?(:VERSION)
22
- VERSION = '0.3.31'
23
- end
24
-
25
- module Mock
26
- @delay = 1
27
- def self.delay
28
- @delay
29
- end
30
-
31
- def self.delay=(new_delay)
32
- raise ArgumentError, "delay must be non-negative" unless new_delay >= 0
33
- @delay = new_delay
34
- end
35
-
36
- def self.not_implemented
37
- raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
38
- end
39
-
40
- end
41
-
42
- def self.bin
43
- @bin ||= false
6
+ VERSION = '0.3.32'
44
7
  end
45
8
 
46
- def self.bin=(new_bin)
47
- @bin = new_bin
48
- end
49
-
50
- def self.mock!
51
- @mocking = true
52
- end
53
-
54
- def self.mocking?
55
- !!@mocking
56
- end
57
-
58
- def self.wait_for(timeout=600, interval=1, &block)
59
- duration = 0
60
- start = Time.now
61
- until yield || duration > timeout
62
- sleep(interval)
63
- duration = Time.now - start
64
- end
65
- if duration > timeout
66
- false
67
- else
68
- { :duration => duration }
69
- end
70
- end
71
-
72
9
  end
73
10
 
74
11
  require 'fog/aws'
75
12
  require 'fog/bluebox'
76
13
  require 'fog/brightbox'
77
14
  require 'fog/go_grid'
15
+ require 'fog/google'
78
16
  require 'fog/linode'
79
17
  require 'fog/local'
80
18
  require 'fog/new_servers'
@@ -82,4 +20,5 @@ require 'fog/rackspace'
82
20
  require 'fog/slicehost'
83
21
  require 'fog/terremark'
84
22
  require 'fog/vcloud'
85
- require 'fog/google'
23
+ require 'fog/zerigo'
24
+
@@ -1,4 +1,6 @@
1
1
  require 'nokogiri'
2
+
3
+ require File.join(File.dirname(__FILE__), 'core')
2
4
  require 'fog/core/parser'
3
5
 
4
6
  module Fog
@@ -9,6 +11,7 @@ module Fog
9
11
  service_path 'fog/aws'
10
12
  service 'cdn'
11
13
  service 'compute'
14
+ service 'dns'
12
15
  service 'ec2'
13
16
  service 'elb'
14
17
  service 'iam'
@@ -7,6 +7,8 @@ class AWS < Fog::Bin
7
7
  Fog::AWS::CDN
8
8
  when :compute, :ec2
9
9
  Fog::AWS::Compute
10
+ when :dns
11
+ Fog::AWS::DNS
10
12
  when :elb
11
13
  Fog::AWS::ELB
12
14
  when :iam
@@ -15,7 +17,10 @@ class AWS < Fog::Bin
15
17
  Fog::AWS::SimpleDB
16
18
  when :eu_storage, :s3, :storage
17
19
  Fog::AWS::Storage
18
- else
20
+ else
21
+ # @todo Replace most instances of ArgumentError with NotImplementedError
22
+ # @todo For a list of widely supported Exceptions, see:
23
+ # => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35
19
24
  raise ArgumentError, "Unsupported #{self} service: #{key}"
20
25
  end
21
26
  end
@@ -46,7 +51,7 @@ class AWS < Fog::Bin
46
51
  end
47
52
 
48
53
  def services
49
- [:cdn, :compute, :elb, :iam, :sdb, :storage]
54
+ [:cdn, :compute, :dns, :elb, :iam, :sdb, :storage]
50
55
  end
51
56
 
52
57
  end
@@ -2,8 +2,8 @@ module Fog
2
2
  module AWS
3
3
  class CDN < Fog::Service
4
4
 
5
- requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
6
- recognizes :host, :path, :port, :scheme, :version, :persistent, &inject_parameter_specs
5
+ requires :aws_access_key_id, :aws_secret_access_key
6
+ recognizes :host, :path, :port, :scheme, :version, :persistent
7
7
 
8
8
  model_path 'fog/aws/models/cdn'
9
9
 
@@ -2,8 +2,8 @@ module Fog
2
2
  module AWS
3
3
  class Compute < Fog::Service
4
4
 
5
- requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
6
- recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
5
+ requires :aws_access_key_id, :aws_secret_access_key
6
+ recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
7
7
 
8
8
  model_path 'fog/aws/models/compute'
9
9
  model :address
@@ -0,0 +1,101 @@
1
+ module Fog
2
+ module AWS
3
+ class DNS < Fog::Service
4
+
5
+ requires :aws_access_key_id, :aws_secret_access_key
6
+ recognizes :host, :path, :port, :scheme, :version, :persistent
7
+
8
+ # model_path 'fog/aws/models/dns'
9
+
10
+ request_path 'fog/aws/requests/dns'
11
+ request :create_hosted_zone
12
+ request :get_hosted_zone
13
+ request :delete_hosted_zone
14
+ request :list_hosted_zones
15
+ request :change_resource_record_sets
16
+ request :list_resource_record_sets
17
+ request :get_change
18
+
19
+ class Mock
20
+
21
+ def self.data
22
+ @data ||= Hash.new do |hash, region|
23
+ hash[region] = Hash.new do |region_hash, key|
24
+ region_hash[key] = {
25
+ :buckets => {}
26
+ }
27
+ end
28
+ end
29
+ end
30
+
31
+ def self.reset_data(keys=data.keys)
32
+ for key in [*keys]
33
+ data.delete(key)
34
+ end
35
+ end
36
+
37
+ def initialize(options={})
38
+ require 'mime/types'
39
+ @aws_access_key_id = options[:aws_access_key_id]
40
+ @data = self.class.data[options[:region]][@aws_access_key_id]
41
+ end
42
+
43
+ def signature(params)
44
+ "foo"
45
+ end
46
+ end
47
+
48
+ class Real
49
+
50
+ # Initialize connection to Route 53 DNS service
51
+ #
52
+ # ==== Notes
53
+ # options parameter must include values for :aws_access_key_id and
54
+ # :aws_secret_access_key in order to create a connection
55
+ #
56
+ # ==== Examples
57
+ # dns = Fog::AWS::DNS.new(
58
+ # :aws_access_key_id => your_aws_access_key_id,
59
+ # :aws_secret_access_key => your_aws_secret_access_key
60
+ # )
61
+ #
62
+ # ==== Parameters
63
+ # * options<~Hash> - config arguments for connection. Defaults to {}.
64
+ #
65
+ # ==== Returns
66
+ # * dns object with connection to aws.
67
+ def initialize(options={})
68
+ @aws_access_key_id = options[:aws_access_key_id]
69
+ @aws_secret_access_key = options[:aws_secret_access_key]
70
+ @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
71
+ @host = options[:host] || 'route53.amazonaws.com'
72
+ @path = options[:path] || '/'
73
+ @port = options[:port] || 443
74
+ @scheme = options[:scheme] || 'https'
75
+ @version = options[:version] || '2010-10-01'
76
+ @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent] || true)
77
+ end
78
+
79
+ def reload
80
+ @connection.reset
81
+ end
82
+
83
+ private
84
+
85
+ def request(params, &block)
86
+ params[:headers] ||= {}
87
+ params[:headers]['Date'] = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S +0000")
88
+ params[:headers]['X-Amzn-Authorization'] = "AWS3-HTTPS AWSAccessKeyId=#{@aws_access_key_id},Algorithm=HmacSHA1,Signature=#{signature(params)}"
89
+ params[:path] = "/#{@version}/#{params[:path]}"
90
+ @connection.request(params, &block)
91
+ end
92
+
93
+ def signature(params)
94
+ string_to_sign = params[:headers]['Date']
95
+ signed_string = @hmac.sign(string_to_sign)
96
+ signature = Base64.encode64(signed_string).chomp!
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -2,8 +2,8 @@ module Fog
2
2
  module AWS
3
3
  class ELB < Fog::Service
4
4
 
5
- requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
6
- recognizes :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
5
+ requires :aws_access_key_id, :aws_secret_access_key
6
+ recognizes :region, :host, :path, :port, :scheme, :persistent
7
7
 
8
8
  request_path 'fog/aws/requests/elb'
9
9
  request :create_load_balancer
@@ -2,8 +2,8 @@ module Fog
2
2
  module AWS
3
3
  class IAM < Fog::Service
4
4
 
5
- requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
6
- recognizes :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
5
+ requires :aws_access_key_id, :aws_secret_access_key
6
+ recognizes :host, :path, :port, :scheme, :persistent
7
7
 
8
8
  request_path 'fog/aws/requests/iam'
9
9
  request :add_user_to_group
@@ -23,6 +23,7 @@ module Fog
23
23
  attribute :root_device_type, :aliases => 'rootDeviceType'
24
24
  attribute :root_device_name, :aliases => 'rootDeviceName'
25
25
  attribute :tags, :aliases => 'tagSet'
26
+ attribute :name
26
27
 
27
28
  def deregister(delete_snapshot = false)
28
29
  connection.deregister_image(id)
@@ -167,7 +167,7 @@ module Fog
167
167
  Timeout::timeout(4) do
168
168
  Fog::SSH.new(ip_address, username, credentials).run(commands)
169
169
  end
170
- rescue Timeout::Error
170
+ rescue Net::SSH::AuthenticationFailed, Timeout::Error
171
171
  retry
172
172
  end
173
173
  end
@@ -98,19 +98,7 @@ module Fog
98
98
  end
99
99
 
100
100
  server.save
101
- # eventual consistency sometimes means a delay before it appears
102
- retries = 3
103
- begin
104
- server.wait_for { ready? }
105
- rescue Fog::Errors::Error => error
106
- sleep(1)
107
- retries -= 1
108
- if retries > 0
109
- retry
110
- else
111
- raise error
112
- end
113
- end
101
+ server.wait_for { ready? }
114
102
  server.setup(:key_data => [server.private_key])
115
103
  server
116
104
  end
@@ -15,8 +15,6 @@ module Fog
15
15
  def start_element(name, attrs = [])
16
16
  super
17
17
  case name
18
- when 'productCodes'
19
- @in_product_codes = true
20
18
  when 'blockDeviceMapping'
21
19
  @in_block_device_mapping = true
22
20
  when 'tagSet'
@@ -25,45 +23,49 @@ module Fog
25
23
  end
26
24
 
27
25
  def end_element(name)
28
- case name
29
- when 'architecture', 'description', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName'
30
- @image[name] = @value
31
- when 'blockDeviceMapping'
32
- @in_block_device_mapping = false
33
- when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
34
- @block_device_mapping[name] = @value
35
- when 'isPublic'
36
- if @value == 'true'
37
- @image[name] = true
38
- else
39
- @image[name] = false
26
+ if @in_tag_set
27
+ case name
28
+ when 'item'
29
+ @image['tagSet'][@tag['key']] = @tag['value']
30
+ @tag = {}
31
+ when 'key', 'value'
32
+ @tag[name] = @value
33
+ when 'tagSet'
34
+ @in_tag_set = false
35
+ end
36
+ elsif @in_block_device_mapping
37
+ case name
38
+ when 'blockDeviceMapping'
39
+ @in_block_device_mapping = false
40
+ when 'deviceName', 'virtualName', 'snapshotId', 'deleteOnTermination'
41
+ @block_device_mapping[name] = @value
42
+ when 'volumeSize'
43
+ @block_device_mapping[name] = @value.to_i
44
+ when 'item'
45
+ @image['blockDeviceMapping'] << @block_device_mapping
46
+ @block_device_mapping = {}
40
47
  end
41
- when 'item'
42
- if @in_block_device_mapping
43
- @image['blockDeviceMapping'] << @block_device_mapping
44
- @block_device_mapping = {}
45
- elsif @in_tag_set
46
- @image['tagSet'][@tag['key']] = @tag['value']
47
- @tag = {}
48
- elsif !@in_product_codes
48
+ else
49
+ case name
50
+ when 'architecture', 'description', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'name', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName','virtualizationType'
51
+ @image[name] = @value
52
+ when 'isPublic'
53
+ if @value == 'true'
54
+ @image[name] = true
55
+ else
56
+ @image[name] = false
57
+ end
58
+ when 'item'
49
59
  @response['imagesSet'] << @image
50
60
  @image = { 'blockDeviceMapping' => [], 'productCodes' => [], 'tagSet' => {} }
61
+ when 'productCode'
62
+ @image['productCodes'] << @value
63
+ when 'requestId'
64
+ @response[name] = @value
51
65
  end
52
- when 'key', 'value'
53
- @tag[name] = @value
54
- when 'productCode'
55
- @image['productCodes'] << @value
56
- when 'productCodes'
57
- @in_product_codes = false
58
- when 'requestId'
59
- @response[name] = @value
60
- when 'volumeSize'
61
- @block_device_mapping[name] = @value.to_i
62
66
  end
63
67
  end
64
-
65
68
  end
66
-
67
69
  end
68
70
  end
69
71
  end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class ChangeResourceRecordSets < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = {}
10
+ end
11
+
12
+ def end_element(name)
13
+ case name
14
+ when 'Id'
15
+ @response[name] = @value.sub('/change/', '')
16
+ when 'Status', 'SubmittedAt'
17
+ @response[name] = @value
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,55 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class CreateHostedZone < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @hosted_zone = {}
10
+ @change_info = {}
11
+ @name_servers = []
12
+ @response = {}
13
+ @section = :hosted_zone
14
+ end
15
+
16
+ def end_element(name)
17
+ if @section == :hosted_zone
18
+ case name
19
+ when 'Id'
20
+ @hosted_zone[name]= @value.sub('/hostedzone/', '')
21
+ when 'Name', 'CallerReference', 'Comment'
22
+ @hosted_zone[name]= @value
23
+ when 'HostedZone'
24
+ @response['HostedZone'] = @hosted_zone
25
+ @hosted_zone = {}
26
+ @section = :change_info
27
+ end
28
+ elsif @section == :change_info
29
+ case name
30
+ when 'Id'
31
+ @change_info[name]= @value.sub('/change/', '')
32
+ when 'Status', 'SubmittedAt'
33
+ @change_info[name] = @value
34
+ when 'ChangeInfo'
35
+ @response['ChangeInfo'] = @change_info
36
+ @change_info = {}
37
+ @section = :name_servers
38
+ end
39
+ elsif @section == :name_servers
40
+ case name
41
+ when 'NameServer'
42
+ @name_servers << @value
43
+ when 'NameServers'
44
+ @response['NameServers'] = @name_servers
45
+ @name_servers = {}
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ end
54
+ end
55
+ end