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
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class DeleteHostedZone < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = {}
10
+ @response['ChangeInfo'] = {}
11
+ end
12
+
13
+ def end_element(name)
14
+ case name
15
+ when 'Id', 'Status', 'SubmittedAt'
16
+ @response['ChangeInfo'][name] = @value
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class GetChange < 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,43 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class GetHostedZone < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @hosted_zone = {}
10
+ @name_servers = []
11
+ @response = {}
12
+ @section = :hosted_zone
13
+ end
14
+
15
+ def end_element(name)
16
+ if @section == :hosted_zone
17
+ case name
18
+ when 'Id'
19
+ @hosted_zone[name]= @value.sub('/hostedzone/', '')
20
+ when 'Name', 'CallerReference', 'Comment'
21
+ @hosted_zone[name]= @value
22
+ when 'HostedZone'
23
+ @response['HostedZone'] = @hosted_zone
24
+ @hosted_zone = {}
25
+ @section = :name_servers
26
+ end
27
+ elsif @section == :name_servers
28
+ case name
29
+ when 'NameServer'
30
+ @name_servers << @value
31
+ when 'NameServers'
32
+ @response['NameServers'] = @name_servers
33
+ @name_servers = {}
34
+ end
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,35 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class ListHostedZones < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @hosted_zones = []
10
+ @zone = {}
11
+ @response = {}
12
+ end
13
+
14
+ def end_element(name)
15
+ case name
16
+ when 'Id', 'Name', 'CallerReference', 'Comment'
17
+ @zone[name] = @value
18
+ when 'HostedZone'
19
+ @hosted_zones << @zone
20
+ @zone = {}
21
+ when 'HostedZones'
22
+ @response['HostedZones'] = @hosted_zones
23
+ when 'MaxItems'
24
+ @response[name] = @value.to_i
25
+ when 'IsTruncated', 'Marker', 'NextMarker'
26
+ @response[name] = @value
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module DNS
5
+
6
+ class ListResourceRecordSets < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @resource_record = []
10
+ @resource_record_set = {}
11
+ @resource_record_set['ResourceRecords'] = []
12
+ @response = {}
13
+ @response['ResourceRecordSets'] = []
14
+ @section = :resource_record_set
15
+ end
16
+
17
+ def end_element(name)
18
+ if @section == :resource_record_set
19
+ case name
20
+ when 'Name', 'Type', 'TTL'
21
+ @resource_record_set[name] = @value
22
+ when 'Value'
23
+ @resource_record_set['ResourceRecords'] << @value
24
+ when 'ResourceRecordSet'
25
+ @response['ResourceRecordSets'] << @resource_record_set
26
+ @resource_record_set = {}
27
+ @resource_record_set['ResourceRecords'] = []
28
+ when 'ResourceRecordSets'
29
+ @section = :main
30
+ end
31
+ elsif @section == :main
32
+ case name
33
+ when 'MaxItems'
34
+ @response[name]= @value.to_i
35
+ when 'IsTruncated', 'NextRecordName', 'NextRecordType'
36
+ @response[name]= @value
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -35,6 +35,7 @@ module Fog
35
35
  # * 'ramdiskId'<~String> - Ramdisk id associated with image, if any
36
36
  # * 'rootDeviceName'<~String> - Root device name, e.g. /dev/sda1
37
37
  # * 'rootDeviceType'<~String> - Root device type, ebs or instance-store
38
+ # * 'virtualizationType'<~String> - Type of virtualization
38
39
  def describe_images(filters = {})
39
40
  options = {}
40
41
  for key in ['ExecutableBy', 'ImageId', 'Owner']
@@ -0,0 +1,90 @@
1
+ module Fog
2
+ module AWS
3
+ class DNS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/dns/change_resource_record_sets'
7
+
8
+ # Use this action to create or change your authoritative DNS information for a zone
9
+ #
10
+ # ==== Parameters
11
+ # * zone_id<~String> - ID of the zone these changes apply to
12
+ # * options<~Hash>
13
+ # * comment<~String> - Any comments you want to include about the change.
14
+ # * change_batch<~Array> - The information for a change request
15
+ # * changes<~Hash> -
16
+ # * action<~String> - 'CREATE' or 'DELETE'
17
+ # * name<~String> - This must be a fully-specified name, ending with a final period
18
+ # * type<~String> - A | AAAA | CNAME | MX | NS | PTR | SOA | SPF | SRV | TXT
19
+ # * ttl<~Integer> -
20
+ # * resource_record<~String>
21
+ #
22
+ # ==== Returns
23
+ # * response<~Excon::Response>:
24
+ # * body<~Hash>:
25
+ # * 'ChangeInfo'<~Hash>
26
+ # * 'Id'<~String> - The ID of the request
27
+ # * 'Status'<~String> - status of the request - PENDING | INSYNC
28
+ # * 'SubmittedAt'<~String> - The date and time the change was made
29
+ # * status<~Integer> - 201 when successful
30
+ def change_resource_record_sets(zone_id, change_batch, options = {})
31
+
32
+ # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use
33
+ # that form or just the actual id (which is what this request needs)
34
+ zone_id = zone_id.sub('/hostedzone/', '')
35
+
36
+ optional_tags = ''
37
+ options.each { |option, value|
38
+ case option
39
+ when :comment
40
+ optional_tags+= "<Comment>#{value}</Comment>"
41
+ end
42
+ }
43
+
44
+ #build XML
45
+ if change_batch.count > 0
46
+
47
+ changes= "<ChangeBatch>#{optional_tags}<Changes>"
48
+
49
+ change_batch.each { |change_item|
50
+ action_tag = %Q{<Action>#{change_item[:action]}</Action>}
51
+ name_tag = %Q{<Name>#{change_item[:name]}</Name>}
52
+ type_tag = %Q{<Type>#{change_item[:type]}</Type>}
53
+ ttl_tag = %Q{<TTL>#{change_item[:ttl]}</TTL>}
54
+ resource_records= change_item[:resource_records]
55
+ resource_record_tags = ''
56
+ resource_records.each { |record|
57
+ resource_record_tags+= %Q{<ResourceRecord><Value>#{record}</Value></ResourceRecord>}
58
+ }
59
+ resource_tag= %Q{<ResourceRecords>#{resource_record_tags}</ResourceRecords>}
60
+
61
+ change_tags = %Q{<Change>#{action_tag}<ResourceRecordSet>#{name_tag}#{type_tag}#{ttl_tag}#{resource_tag}</ResourceRecordSet></Change>}
62
+ changes+= change_tags
63
+ }
64
+
65
+ changes+= '</Changes></ChangeBatch>'
66
+ end
67
+
68
+ body = %Q{<?xml version="1.0" encoding="UTF-8"?><ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2010-10-01/">#{changes}</ChangeResourceRecordSetsRequest>}
69
+ request({
70
+ :body => body,
71
+ :parser => Fog::Parsers::AWS::DNS::ChangeResourceRecordSets.new,
72
+ :expects => 200,
73
+ :method => 'POST',
74
+ :path => "hostedzone/#{zone_id}/rrset"
75
+ })
76
+
77
+ end
78
+
79
+ end
80
+
81
+ class Mock
82
+
83
+ def change_resource_record_sets(zone_id, change_batch, options = {})
84
+ Fog::Mock.not_implemented
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,68 @@
1
+ module Fog
2
+ module AWS
3
+ class DNS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/dns/create_hosted_zone'
7
+
8
+ # Creates a new hosted zone
9
+ #
10
+ # ==== Parameters
11
+ # * name<~String> - The name of the domain. Must be a fully-specified domain that ends with a period
12
+ # * options<~Hash>
13
+ # * caller_ref<~String> - unique string that identifies the request & allows failed
14
+ # calls to be retried without the risk of executing the operation twice
15
+ # * comment<~Integer> -
16
+ #
17
+ # ==== Returns
18
+ # * response<~Excon::Response>:
19
+ # * body<~Hash>:
20
+ # * 'HostedZone'<~Hash>:
21
+ # * 'Id'<~String> -
22
+ # * 'Name'<~String> -
23
+ # * 'CallerReference'<~String>
24
+ # * 'Comment'<~String> -
25
+ # * 'ChangeInfo'<~Hash> -
26
+ # * 'Id'<~String>
27
+ # * 'Status'<~String>
28
+ # * 'SubmittedAt'<~String>
29
+ # * 'NameServers'<~Array>
30
+ # * 'NameServer'<~String>
31
+ # * status<~Integer> - 201 when successful
32
+ def create_hosted_zone(name, options = {})
33
+
34
+ optional_tags = ''
35
+ if options[:caller_ref]
36
+ optional_tags+= "<CallerReference>#{options[:call_ref]}</CallerReference>"
37
+ else
38
+ #make sure we have a unique call reference
39
+ caller_ref = "ref-#{rand(1000000).to_s}"
40
+ optional_tags+= "<CallerReference>#{caller_ref}</CallerReference>"
41
+ end
42
+ if options[:comment]
43
+ optional_tags+= "<HostedZoneConfig><Comment>#{options[:comment]}</Comment></HostedZoneConfig>"
44
+ end
45
+
46
+ request({
47
+ :body => %Q{<?xml version="1.0" encoding="UTF-8"?><CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2010-10-01/"><Name>#{name}</Name>#{optional_tags}</CreateHostedZoneRequest>},
48
+ :parser => Fog::Parsers::AWS::DNS::CreateHostedZone.new,
49
+ :expects => 201,
50
+ :method => 'POST',
51
+ :path => "hostedzone"
52
+ })
53
+
54
+ end
55
+
56
+ end
57
+
58
+ class Mock
59
+
60
+ def create_hosted_zone(name, options = {})
61
+ Fog::Mock.not_implemented
62
+ end
63
+
64
+
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,48 @@
1
+ module Fog
2
+ module AWS
3
+ class DNS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/dns/delete_hosted_zone'
7
+
8
+ # Delete a hosted zone
9
+ #
10
+ # ==== Parameters
11
+ # * zone_id<~String> -
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'ChangeInfo'<~Hash> -
17
+ # * 'Id'<~String> The ID of the request
18
+ # * 'Status'<~String> The current state of the hosted zone
19
+ # * 'SubmittedAt'<~String> The date and time the change was made
20
+ # * status<~Integer> - 200 when successful
21
+ def delete_hosted_zone(zone_id)
22
+
23
+ # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use
24
+ # that form or just the actual id (which is what this request needs)
25
+ zone_id = zone_id.sub('/hostedzone/', '')
26
+
27
+ request({
28
+ :expects => 200,
29
+ :parser => Fog::Parsers::AWS::DNS::DeleteHostedZone.new,
30
+ :method => 'DELETE',
31
+ :path => "hostedzone/#{zone_id}"
32
+ })
33
+
34
+ end
35
+
36
+ end
37
+
38
+
39
+ class Mock
40
+
41
+ def delete_hosted_zone(zone_id)
42
+ Fog::Mock.not_implemented
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,47 @@
1
+ module Fog
2
+ module AWS
3
+ class DNS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/dns/get_change'
7
+
8
+ # returns the current state of a change request
9
+ #
10
+ # ==== Parameters
11
+ # * change_id<~String>
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'Id'<~String>
17
+ # * 'Status'<~String>
18
+ # * 'SubmittedAt'<~String>
19
+ # * status<~Integer> - 200 when successful
20
+ def get_change(change_id)
21
+
22
+ # AWS methods return change_ids that looks like '/change/id'. Let the caller either use
23
+ # that form or just the actual id (which is what this request needs)
24
+ change_id = change_id.sub('/change/', '')
25
+
26
+ request({
27
+ :expects => 200,
28
+ :parser => Fog::Parsers::AWS::DNS::GetChange.new,
29
+ :method => 'GET',
30
+ :path => "change/#{change_id}"
31
+ })
32
+
33
+ end
34
+
35
+ end
36
+
37
+
38
+ class Mock
39
+
40
+ def get_change(change_id)
41
+ Fog::Mock.not_implemented
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end