fog 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +3 -3
  3. data/changelog.txt +213 -0
  4. data/docs/compute/index.markdown +15 -1
  5. data/fog.gemspec +3 -3
  6. data/lib/fog.rb +1 -1
  7. data/lib/fog/aws.rb +9 -0
  8. data/lib/fog/aws/auto_scaling.rb +3 -1
  9. data/lib/fog/aws/cloud_formation.rb +2 -0
  10. data/lib/fog/aws/cloud_watch.rb +2 -0
  11. data/lib/fog/aws/compute.rb +9 -3
  12. data/lib/fog/aws/elasticache.rb +8 -1
  13. data/lib/fog/aws/elb.rb +2 -0
  14. data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
  15. data/lib/fog/aws/models/compute/security_group.rb +1 -1
  16. data/lib/fog/aws/models/compute/server.rb +3 -1
  17. data/lib/fog/aws/models/dns/records.rb +3 -3
  18. data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
  19. data/lib/fog/aws/models/storage/file.rb +2 -2
  20. data/lib/fog/aws/models/storage/files.rb +4 -4
  21. data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
  22. data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
  23. data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
  24. data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
  25. data/lib/fog/aws/rds.rb +36 -1
  26. data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
  27. data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
  28. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
  29. data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
  30. data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
  31. data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
  32. data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
  33. data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
  34. data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
  35. data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
  36. data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
  37. data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
  38. data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
  39. data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
  40. data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
  41. data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
  42. data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
  43. data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
  44. data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
  45. data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
  46. data/lib/fog/aws/simpledb.rb +5 -1
  47. data/lib/fog/aws/sns.rb +2 -0
  48. data/lib/fog/aws/sqs.rb +5 -1
  49. data/lib/fog/aws/storage.rb +6 -0
  50. data/lib/fog/aws/sts.rb +137 -0
  51. data/lib/fog/bin.rb +1 -0
  52. data/lib/fog/bin/aws.rb +2 -0
  53. data/lib/fog/bin/clodo.rb +31 -0
  54. data/lib/fog/brightbox/compute.rb +7 -0
  55. data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
  56. data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
  57. data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
  58. data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
  59. data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
  60. data/lib/fog/brightbox/models/compute/image.rb +2 -0
  61. data/lib/fog/brightbox/models/compute/server.rb +41 -6
  62. data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
  63. data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
  64. data/lib/fog/clodo.rb +34 -0
  65. data/lib/fog/clodo/compute.rb +152 -0
  66. data/lib/fog/clodo/models/compute/image.rb +31 -0
  67. data/lib/fog/clodo/models/compute/images.rb +28 -0
  68. data/lib/fog/clodo/models/compute/server.rb +163 -0
  69. data/lib/fog/clodo/models/compute/servers.rb +36 -0
  70. data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
  71. data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
  72. data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
  73. data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
  74. data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
  75. data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
  76. data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
  77. data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
  78. data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
  79. data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
  80. data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
  81. data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
  82. data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
  83. data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
  84. data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
  85. data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
  86. data/lib/fog/compute.rb +3 -0
  87. data/lib/fog/core/credentials.rb +3 -3
  88. data/lib/fog/core/errors.rb +2 -0
  89. data/lib/fog/core/wait_for.rb +1 -1
  90. data/lib/fog/dnsmadeeasy/dns.rb +1 -1
  91. data/lib/fog/libvirt/compute.rb +2 -0
  92. data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
  93. data/lib/fog/libvirt/models/compute/server.rb +8 -1
  94. data/lib/fog/providers.rb +1 -0
  95. data/lib/fog/rackspace/dns.rb +10 -2
  96. data/lib/fog/rackspace/load_balancers.rb +3 -0
  97. data/lib/fog/rackspace/models/compute/server.rb +2 -2
  98. data/lib/fog/rackspace/models/dns/callback.rb +3 -1
  99. data/lib/fog/rackspace/models/dns/record.rb +4 -0
  100. data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
  101. data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
  102. data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
  103. data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
  104. data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
  105. data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
  106. data/lib/fog/vcloud/compute.rb +7 -1
  107. data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
  108. data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
  109. data/lib/fog/vcloud/models/compute/network.rb +13 -49
  110. data/lib/fog/vcloud/models/compute/networks.rb +12 -3
  111. data/lib/fog/vcloud/models/compute/organization.rb +44 -0
  112. data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
  113. data/lib/fog/vcloud/models/compute/server.rb +35 -56
  114. data/lib/fog/vcloud/models/compute/servers.rb +11 -13
  115. data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
  116. data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
  117. data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
  118. data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
  119. data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
  120. data/lib/fog/vsphere/compute.rb +1 -0
  121. data/lib/fog/vsphere/models/compute/server.rb +18 -0
  122. data/lib/fog/vsphere/models/compute/servers.rb +8 -2
  123. data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
  124. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
  125. data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
  126. data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
  127. data/tests/aws/models/elb/model_tests.rb +5 -0
  128. data/tests/aws/requests/compute/instance_tests.rb +23 -0
  129. data/tests/aws/requests/compute/security_group_tests.rb +1 -0
  130. data/tests/aws/requests/elb/listener_tests.rb +4 -0
  131. data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
  132. data/tests/aws/requests/storage/bucket_tests.rb +0 -3
  133. data/tests/aws/requests/storage/object_tests.rb +2 -4
  134. data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
  135. data/tests/aws/requests/sts/session_token_tests.rb +16 -0
  136. data/tests/brightbox/requests/compute/account_tests.rb +11 -6
  137. data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
  138. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
  139. data/tests/brightbox/requests/compute/helper.rb +29 -3
  140. data/tests/brightbox/requests/compute/image_tests.rb +17 -14
  141. data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
  142. data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
  143. data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
  144. data/tests/brightbox/requests/compute/server_tests.rb +41 -22
  145. data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
  146. data/tests/brightbox/requests/compute/user_tests.rb +11 -16
  147. data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
  148. data/tests/clodo/requests/compute/image_tests.rb +36 -0
  149. data/tests/clodo/requests/compute/server_tests.rb +152 -0
  150. data/tests/compute/helper.rb +1 -1
  151. data/tests/core/credential_tests.rb +2 -2
  152. data/tests/glesys/requests/compute/helper.rb +91 -66
  153. data/tests/glesys/requests/compute/ip_tests.rb +1 -1
  154. data/tests/glesys/requests/compute/server_tests.rb +5 -5
  155. data/tests/helpers/mock_helper.rb +2 -0
  156. data/tests/rackspace/models/dns/zone_tests.rb +14 -0
  157. data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
  158. data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
  159. data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
  160. data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
  161. data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
  162. data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
  163. data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
  164. data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
  165. data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
  166. data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
  167. data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
  168. data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
  169. data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
  170. data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
  171. data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
  172. data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
  173. data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
  174. data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
  175. data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
  176. data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
  177. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
  178. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
  179. data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
  180. data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
  181. data/tests/vcloud/models/compute/conn_helper.rb +20 -0
  182. data/tests/vcloud/models/compute/network_tests.rb +65 -0
  183. data/tests/vcloud/models/compute/networks_tests.rb +42 -0
  184. data/tests/vcloud/models/compute/organization_tests.rb +13 -0
  185. data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
  186. data/tests/vcloud/models/compute/server_tests.rb +136 -0
  187. data/tests/vcloud/models/compute/servers_tests.rb +10 -89
  188. data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
  189. data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
  190. data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
  191. data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
  192. data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
  193. metadata +151 -55
@@ -15,7 +15,7 @@ module Fog
15
15
  # ==== Returns
16
16
  # * response<~Excon::Response>:
17
17
  # * body<~Hash>:
18
- def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
18
+ def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
19
19
  params = {}
20
20
  params['FinalDBSnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
21
21
  request({
@@ -30,8 +30,24 @@ module Fog
30
30
 
31
31
  class Mock
32
32
 
33
- def delete_db_snapshot(identifier, snapshot_identifier, skip_snapshot = false)
34
- Fog::Mock.not_implemented
33
+ def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
34
+ response = Excon::Response.new
35
+
36
+ unless skip_snapshot
37
+ # I don't know how to mock snapshot_identifier
38
+ Fog::Logger.warning("snapshot_identifier is not mocked [light_black](#{caller.first})[/]")
39
+ end
40
+
41
+ if server_set = self.data[:servers].delete(identifier)
42
+ response.status = 200
43
+ response.body = {
44
+ "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
45
+ "DeleteDBInstanceResult" => { "DBInstance" => server_set }
46
+ }
47
+ response
48
+ else
49
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
50
+ end
35
51
  end
36
52
 
37
53
  end
@@ -33,8 +33,47 @@ module Fog
33
33
  class Mock
34
34
 
35
35
  def describe_db_instances(identifier=nil, opts={})
36
- Fog::Mock.not_implemented
36
+ response = Excon::Response.new
37
+ server_set = []
38
+ if identifier
39
+ if server = self.data[:servers][identifier]
40
+ server_set << server
41
+ else
42
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
43
+ end
44
+ else
45
+ server_set = self.data[:servers].values
46
+ end
47
+
48
+ server_set.each do |server|
49
+ case server["DBInstanceStatus"]
50
+ when "creating"
51
+ if Time.now - server['created_at'] >= Fog::Mock.delay * 2
52
+ region = "us-east-1"
53
+ server["DBInstanceStatus"] = "available"
54
+ server["availability_zone"] = region + 'a'
55
+ server["Endpoint"] = {"Port"=>3306,
56
+ "Address"=> Fog::AWS::Mock.rds_address(server["DBInstanceIdentifier"],region) }
57
+ server["PendingModifiedValues"] = {}
58
+ end
59
+ when "rebooting"
60
+ # it applies pending modified values
61
+ if server["PendingModifiedValues"]
62
+ server.merge!(server["PendingModifiedValues"])
63
+ server["PendingModifiedValues"] = {}
64
+ server["DBInstanceStatus"] = 'available'
65
+ end
66
+ end
67
+ end
68
+
69
+ response.status = 200
70
+ response.body = {
71
+ "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
72
+ "DescribeDBInstancesResult" => { "DBInstances" => server_set }
73
+ }
74
+ response
37
75
  end
76
+
38
77
 
39
78
  end
40
79
  end
@@ -32,7 +32,7 @@ module Fog
32
32
 
33
33
  class Mock
34
34
 
35
- def describe_db_instances(identifier=nil, opts={})
35
+ def describe_db_reserved_instances(identifier=nil, opts={})
36
36
  Fog::Mock.not_implemented
37
37
  end
38
38
 
@@ -45,7 +45,30 @@ module Fog
45
45
  class Mock
46
46
 
47
47
  def modify_db_instance(db_name, apply_immediately, options={})
48
- Fog::Mock.not_implemented
48
+ response = Excon::Response.new
49
+ if server = self.data[:servers][db_name]
50
+ if server["DBInstanceStatus"] != "available"
51
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{db_name} not available for modification")
52
+ else
53
+ # TODO verify the params options
54
+ # if apply_immediately is false, all the options go to pending_modified_values and then apply and clear after either
55
+ # a reboot or the maintainance window
56
+ if apply_immediately
57
+ modified_server = server.merge(options)
58
+ else
59
+ modified_server = server["PendingModifiedValues"].merge!(options) # it appends
60
+ end
61
+ response.status = 200
62
+ response.body = {
63
+ "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
64
+ "ModifyDBInstanceResult" => { "DBInstance" => modified_server }
65
+ }
66
+ response
67
+
68
+ end
69
+ else
70
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{db_name} not found")
71
+ end
49
72
  end
50
73
 
51
74
  end
@@ -25,7 +25,23 @@ module Fog
25
25
  class Mock
26
26
 
27
27
  def reboot_db_instance(instance_identifier)
28
- Fog::Mock.not_implemented
28
+ response = Excon::Response.new
29
+ if server = self.data[:servers][instance_identifier]
30
+ if server["DBInstanceStatus"] != "available"
31
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{db_name} not available for rebooting")
32
+ else
33
+ server["DBInstanceStatus"] = 'rebooting'
34
+ response.status = 200
35
+ response.body = {
36
+ "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
37
+ "RebootDBInstanceResult" => { "DBInstance" => server }
38
+ }
39
+ response
40
+
41
+ end
42
+ else
43
+ raise Fog::AWS::RDS::NotFound.new("DBInstance #{db_name} not found")
44
+ end
29
45
  end
30
46
 
31
47
  end
@@ -2,6 +2,8 @@ module Fog
2
2
  module Storage
3
3
  class AWS
4
4
 
5
+ require 'fog/aws/parsers/storage/access_control_list'
6
+
5
7
  private
6
8
  def self.hash_to_acl(acl)
7
9
  data = "<AccessControlPolicy>\n"
@@ -49,6 +51,12 @@ module Fog
49
51
  data
50
52
  end
51
53
 
54
+ def self.acl_to_hash(acl_xml)
55
+ parser = Fog::Parsers::Storage::AWS::AccessControlList.new
56
+ Nokogiri::XML::SAX::Parser.new(parser).parse(acl_xml)
57
+ parser.response
58
+ end
59
+
52
60
  end
53
61
  end
54
62
  end
@@ -51,6 +51,14 @@ module Fog
51
51
  source_object = source_bucket && source_bucket[:objects][source_object_name]
52
52
  target_bucket = self.data[:buckets][target_bucket_name]
53
53
 
54
+ acl = options['x-amz-acl'] || 'private'
55
+ if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl)
56
+ raise Excon::Errors::BadRequest.new('invalid x-amz-acl')
57
+ else
58
+ self.data[:acls][:object][target_bucket_name] ||= {}
59
+ self.data[:acls][:object][target_bucket_name][target_object_name] = self.class.acls(acl)
60
+ end
61
+
54
62
  if source_object && target_bucket
55
63
  response.status = 200
56
64
  target_object = source_object.dup
@@ -48,11 +48,17 @@ module Fog
48
48
 
49
49
  class Mock # :nodoc:all
50
50
 
51
+ require 'fog/aws/requests/storage/acl_utils'
52
+
51
53
  def get_bucket_acl(bucket_name)
52
54
  response = Excon::Response.new
53
55
  if acl = self.data[:acls][:bucket][bucket_name]
54
56
  response.status = 200
55
- response.body = acl
57
+ if acl.is_a?(String)
58
+ response.body = Fog::Storage::AWS.acl_to_hash(acl)
59
+ else
60
+ response.body = acl
61
+ end
56
62
  else
57
63
  response.status = 404
58
64
  raise(Excon::Errors.status_error({:expects => 200}, response))
@@ -59,11 +59,17 @@ module Fog
59
59
 
60
60
  class Mock # :nodoc:all
61
61
 
62
+ require 'fog/aws/requests/storage/acl_utils'
63
+
62
64
  def get_object_acl(bucket_name, object_name, options = {})
63
65
  response = Excon::Response.new
64
66
  if acl = self.data[:acls][:object][bucket_name] && self.data[:acls][:object][bucket_name][object_name]
65
67
  response.status = 200
66
- response.body = acl
68
+ if acl.is_a?(String)
69
+ response.body = Fog::Storage::AWS.acl_to_hash(acl)
70
+ else
71
+ response.body = acl
72
+ end
67
73
  else
68
74
  response.status = 404
69
75
  raise(Excon::Errors.status_error({:expects => 200}, response))
@@ -4,7 +4,7 @@ module Fog
4
4
 
5
5
  module GetObjectHttpUrl
6
6
 
7
- def get_object_http_url(bucket_name, object_name, expires)
7
+ def get_object_http_url(bucket_name, object_name, expires, options = {})
8
8
  unless bucket_name
9
9
  raise ArgumentError.new('bucket_name is required')
10
10
  end
@@ -15,7 +15,8 @@ module Fog
15
15
  :headers => {},
16
16
  :host => @host,
17
17
  :method => 'GET',
18
- :path => "#{bucket_name}/#{object_name}"
18
+ :path => "#{bucket_name}/#{object_name}",
19
+ :query => options[:query]
19
20
  }, expires)
20
21
  end
21
22
 
@@ -48,4 +49,4 @@ module Fog
48
49
  end
49
50
  end
50
51
  end
51
- end
52
+ end
@@ -4,7 +4,7 @@ module Fog
4
4
 
5
5
  module GetObjectHttpsUrl
6
6
 
7
- def get_object_https_url(bucket_name, object_name, expires)
7
+ def get_object_https_url(bucket_name, object_name, expires, options = {})
8
8
  unless bucket_name
9
9
  raise ArgumentError.new('bucket_name is required')
10
10
  end
@@ -15,7 +15,8 @@ module Fog
15
15
  :headers => {},
16
16
  :host => @host,
17
17
  :method => 'GET',
18
- :path => "#{bucket_name}/#{object_name}"
18
+ :path => "#{bucket_name}/#{object_name}",
19
+ :query => options[:query]
19
20
  }, expires)
20
21
  end
21
22
 
@@ -48,4 +49,4 @@ module Fog
48
49
  end
49
50
  end
50
51
  end
51
- end
52
+ end
@@ -3,8 +3,8 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/requests/storage/hash_to_acl'
7
-
6
+ require 'fog/aws/requests/storage/acl_utils'
7
+
8
8
  # Change access control list for an S3 bucket
9
9
  #
10
10
  # ==== Parameters
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/requests/storage/hash_to_acl'
6
+ require 'fog/aws/requests/storage/acl_utils'
7
7
 
8
8
  # Change access control list for an S3 object
9
9
  #
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module AWS
3
+ class STS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/sts/get_session_token'
7
+
8
+ def get_federation_token(name, policy, duration=43200)
9
+ request({
10
+ 'Action' => 'GetFederationToken',
11
+ 'Name' => name,
12
+ 'Policy' => MultiJson.encode(policy),
13
+ 'DurationSeconds' => duration,
14
+ :parser => Fog::Parsers::AWS::STS::GetSessionToken.new
15
+ })
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module AWS
3
+ class STS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/sts/get_session_token'
7
+
8
+ def get_session_token(duration=43200)
9
+ request({
10
+ 'Action' => 'GetSessionToken',
11
+ 'DurationSeconds' => duration,
12
+ :parser => Fog::Parsers::AWS::STS::GetSessionToken.new
13
+ })
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -5,7 +5,7 @@ module Fog
5
5
  class SimpleDB < Fog::Service
6
6
 
7
7
  requires :aws_access_key_id, :aws_secret_access_key
8
- recognizes :host, :nil_string, :path, :port, :scheme, :persistent, :region
8
+ recognizes :host, :nil_string, :path, :port, :scheme, :persistent, :region, :aws_session_token
9
9
 
10
10
  request_path 'fog/aws/requests/simpledb'
11
11
  request :batch_put_attributes
@@ -70,6 +70,7 @@ module Fog
70
70
 
71
71
  @aws_access_key_id = options[:aws_access_key_id]
72
72
  @aws_secret_access_key = options[:aws_secret_access_key]
73
+ @aws_session_token = options[:aws_session_token]
73
74
  @connection_options = options[:connection_options] || {}
74
75
  @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
75
76
  @nil_string = options[:nil_string]|| 'nil'
@@ -88,6 +89,8 @@ module Fog
88
89
  'sdb.us-west-1.amazonaws.com'
89
90
  when 'us-west-2'
90
91
  'sdb.us-west-2.amazonaws.com'
92
+ when 'sa-east-1'
93
+ 'sdb.sa-east-1.amazonaws.com'
91
94
  else
92
95
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
93
96
  end
@@ -165,6 +168,7 @@ module Fog
165
168
  params,
166
169
  {
167
170
  :aws_access_key_id => @aws_access_key_id,
171
+ :aws_session_token => @aws_session_token,
168
172
  :hmac => @hmac,
169
173
  :host => @host,
170
174
  :path => @path,
data/lib/fog/aws/sns.rb CHANGED
@@ -67,6 +67,8 @@ module Fog
67
67
  'sns.us-west-1.amazonaws.com'
68
68
  when 'us-west-2'
69
69
  'sns.us-west-2.amazonaws.com'
70
+ when 'sa-east-1'
71
+ 'sns.sa-east-1.amazonaws.com'
70
72
  else
71
73
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
72
74
  end
data/lib/fog/aws/sqs.rb CHANGED
@@ -5,7 +5,7 @@ module Fog
5
5
  class SQS < Fog::Service
6
6
 
7
7
  requires :aws_access_key_id, :aws_secret_access_key
8
- recognizes :region, :host, :path, :port, :scheme, :persistent
8
+ recognizes :region, :host, :path, :port, :scheme, :persistent, :aws_session_token
9
9
 
10
10
  request_path 'fog/aws/requests/sqs'
11
11
  request :change_message_visibility
@@ -78,6 +78,7 @@ module Fog
78
78
  def initialize(options={})
79
79
  @aws_access_key_id = options[:aws_access_key_id]
80
80
  @aws_secret_access_key = options[:aws_secret_access_key]
81
+ @aws_session_token = options[:aws_session_token]
81
82
  @connection_options = options[:connection_options] || {}
82
83
  @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
83
84
  options[:region] ||= 'us-east-1'
@@ -92,6 +93,8 @@ module Fog
92
93
  'us-west-1.queue.amazonaws.com'
93
94
  when 'us-west-2'
94
95
  'us-west-2.queue.amazonaws.com'
96
+ when 'sa-east-1'
97
+ 'sa-east-1.queue.amazonaws.com'
95
98
  else
96
99
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
97
100
  end
@@ -121,6 +124,7 @@ module Fog
121
124
  params,
122
125
  {
123
126
  :aws_access_key_id => @aws_access_key_id,
127
+ :aws_session_token => @aws_session_token,
124
128
  :hmac => @hmac,
125
129
  :host => @host,
126
130
  :path => path || @path,
@@ -197,10 +197,14 @@ module Fog
197
197
  's3-eu-west-1.amazonaws.com'
198
198
  when 'us-east-1'
199
199
  's3.amazonaws.com'
200
+ when 'sa-east-1'
201
+ 's3-sa-east-1.amazonaws.com'
200
202
  when 'us-west-1'
201
203
  's3-us-west-1.amazonaws.com'
202
204
  when 'us-west-2'
203
205
  's3-us-west-2.amazonaws.com'
206
+ when 'sa-east-1'
207
+ 's3-sa-east-1.amazonaws.com'
204
208
  else
205
209
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
206
210
  end
@@ -271,6 +275,8 @@ module Fog
271
275
  's3-eu-west-1.amazonaws.com'
272
276
  when 'us-east-1'
273
277
  's3.amazonaws.com'
278
+ when 'sa-east-1'
279
+ 's3-sa-east-1.amazonaws.com'
274
280
  when 'us-west-1'
275
281
  's3-us-west-1.amazonaws.com'
276
282
  when 'us-west-2'